KstBindAxis::KstBindAxis(KJS::ExecState *exec, Kst2DPlotPtr d, bool isX) : QObject(), KstBinding("Axis", false), _d(d.data()), _xAxis(isX) { KJS::Object o(this); addBindings(exec, o); }
void foo() { Empty e; Other o(e); bar(o); }
KstBindPoint::KstBindPoint(KJS::ExecState *exec, double x, double y) : KstBinding("Point"), _x(x), _y(y) { KJS::Object o(this); addBindings(exec, o); }
rarray Env::array_new(int size) { return o(Array::create(private_->state(), size)); }
int main(int argc, char** argv) { int ppw=10; // Point per wavelength std::string file="/home/tbetcke/svn/numerical_coercivity/data/trapping"; int numrange_n=50; // Number of discretization points for num. range. int computenorm=0; // Set to 1 to compute norm and condition number std::vector<double> freqs; freqs.push_back(8); //freqs.push_back(10); //freqs.push_back(50); //freqs.push_back(100); //freqs.push_back(200); //freqs.push_back(500); clock_t start, finish; double time; start=clock(); double a=0.31; double c=1; double l=c-a; std::vector<bem2d::Point> trapping; trapping.push_back(bem2d::Point(0,0)); trapping.push_back(bem2d::Point(-c,0)); trapping.push_back(bem2d::Point(-c,-l)); trapping.push_back(bem2d::Point(l,-l)); trapping.push_back(bem2d::Point(l,2*c-l)); trapping.push_back(bem2d::Point(-c,2*c-l)); trapping.push_back(bem2d::Point(-c,2*a)); trapping.push_back(bem2d::Point(0,2*a)); #ifdef BEM2DMPI MPI_Init(&argc, &argv); int nprow=2; // Number of rows in process grid int npcol=1; // Number of columns in process grid int mb=24; // Row Block size int nb=24; // Column Block size bem2d::BlacsSystem* b=bem2d::BlacsSystem::Initialize(nprow,npcol,mb,nb); // Exit if Context could not be created or process does not belong to context if (!b) { std::cout << "Could not create Blacs context" << std::endl; MPI_Finalize(); exit(1); } if ((b->get_myrow()==-1)&&(b->get_mycol()==-1)) { MPI_Finalize(); exit(0); } #endif for (int j=0;j<freqs.size();j++){ bem2d::freqtype k={(double)freqs[j],0}; double eta1=k.re; // Coupling between conj. double and single layer pot. bem2d::Polygon poly(trapping,ppw,k,10,0.15); bem2d::pGeometry pgeom=poly.GetGeometry(); bem2d::WriteDomain("/home/svn/numerical_coercivity/data/trapping_shape",pgeom,5); bem2d::PolBasis::AddBasis(2,pgeom); // Add constant basis functions // Discretize the single and double layer potential bem2d::SingleLayer sl(k); bem2d::ConjDoubleLayer cdl(k); bem2d::QuadOption quadopts; quadopts.L=3; quadopts.N=5; quadopts.sigma=0.15; #ifdef BEM2DMPI if (b->IsRoot()){ std::cout << "Discretize Kernels with n=" << pgeom->size() << std::endl; } #else std::cout << "Discretize Kernels with n=" << pgeom->size() << std::endl; #endif bem2d::Matrix dsl=*(DiscreteKernel(*pgeom,quadopts,sl)); bem2d::Matrix dcdl=*(DiscreteKernel(*pgeom,quadopts,cdl)); bem2d::Matrix Id=*(EvalIdent(*pgeom, quadopts)); bem2d::Matrix combined1=Id+2.0*dcdl-bem2d::complex(0,2.0)*eta1*dsl; combined1=bem2d::ChangeBasis(combined1,Id); #ifdef BEM2DMPI if (b->IsRoot()){ std::cout << "Compute Eigenvalues and norm" << std::endl; } #else std::cout << "Compute Eigenvalues and norm" << std::endl; #endif double norm; double cond; bem2d::pcvector eigvals; bem2d::Eigenvalues(combined1,eigvals); if (computenorm){ bem2d::L2NormCond(combined1,norm,cond); // Write out norm and condition number #ifdef BEM2DMPI if (b->IsRoot()){ #endif std::ostringstream osnormcond; osnormcond << file << "_normcond_" << k.re; std::string s0=osnormcond.str(); std::ofstream o(s0.c_str()); o << norm << std::endl << cond << std::endl; o.close(); #ifdef BEM2DMPI } #endif } // Write out eigenvalues #ifdef BEM2DMPI if (b->IsRoot()){ #endif std::ostringstream os; os << file << "_eig_" << k.re; std::string s=os.str(); std::ofstream o1(s.c_str()); for (int i=0;i<eigvals->size();i++) o1 << std::real((*eigvals)[i]) << " " << std::imag((*eigvals)[i]) << std::endl; o1.close(); #ifdef BEM2DMPI } #endif #ifdef BEM2DMPI if (b->IsRoot()){ std::cout << "Compute Numerical Range" << std::endl; } #else std::cout << "Compute Numerical Range" << std::endl; #endif std::ostringstream os2; os2 << file << "_range_" << k.re; NumRange(combined1, numrange_n, os2.str()); } finish=clock(); time=(double(finish)-double(start))/CLOCKS_PER_SEC/60; #ifdef BEM2DMPI bem2d::BlacsSystem::Release(); MPI_Finalize(); #endif }
rstring Env::to_s(robject obj) { return o(s(obj)->to_s(private_->state())); }
rsymbol Env::method_file(rcompiled_code code) { return o(i(code)->file()); }
static void TransformsAndCenters( vector<TAffine> &transforms, vector<Point> ¢ers, const vector<triangle> &tri, const vector<Point> &orig, const vector<Point> &cpts, const TAffine &tr_guess, FILE* flog ) { fprintf( flog, "\n---- Transforms ----\n" ); int ntri = tri.size(); for( int k = 0; k < ntri; ++k ) { const triangle& T = tri[k]; int i0 = T.v[0], i1 = T.v[1], i2 = T.v[2]; // Find transformation that maps original control points // (orig) into optimized (cpts). // // Begin with a transform mapping a unit right triangle // { (0,0), (1,0), (0,1) } in abstract global space to // the respective orig vertices { o0, o1, o2 }. To see // how simple this really is, just apply the TAffine (o) // that we define below to each of the global vertices. const Point& o0 = orig[i0], o1 = orig[i1], o2 = orig[i2]; TAffine o( o1.x - o0.x, o2.x - o0.x, o0.x, o1.y - o0.y, o2.y - o0.y, o0.y ); // And make a like mapping from global space to (cpts) const Point& c0 = cpts[i0], c1 = cpts[i1], c2 = cpts[i2]; TAffine c( c1.x - c0.x, c2.x - c0.x, c0.x, c1.y - c0.y, c2.y - c0.y, c0.y ); // Now make transform t = c * o-inv from orig to cpts TAffine t, oi; oi.InverseOf( o ); t = c * oi; t.TPrint( flog ); // Sanity check the "angular" change if( (fabs( t.t[0] - 1.0 ) > 0.1 && fabs( t.t[0] - tr_guess.t[0] ) > 0.1) || (fabs( t.t[4] - 1.0 ) > 0.1 && fabs( t.t[4] - tr_guess.t[4] ) > 0.1) ) { fprintf( flog, "Large deviation in t[0], t[4]: vertices %d %d %d\n", i0, i1, i2 ); fprintf( flog, "orig (%f %f) (%f %f) (%f %f).\n", o0.x, o0.y, o1.x, o1.y, o2.x, o2.y ); fprintf( flog, "cpts (%f %f) (%f %f) (%f %f)\n", c0.x, c0.y, c1.x, c1.y, c2.x, c2.y ); } transforms.push_back( t ); // Each center is initially just a triangle centroid, // although any point interior to triangle will do. double cenx = (o0.x + o1.x + o2.x) / 3.0, ceny = (o0.y + o1.y + o2.y) / 3.0; // Now we jiggle along a line segment from centroid // to vertex 0. The purpose is that in rare instances // when affines are all the same because optimizer did // nothing, if centers are also colinear, then solver // matrices become degenerate. Jiggling avoids that. double seglenscl = double(rand()) / (10.0 * RAND_MAX); cenx += seglenscl * (o0.x - cenx); ceny += seglenscl * (o0.y - ceny); centers.push_back( Point( cenx, ceny ) ); } }
rsymbol Env::method_file(rmethod code) { return o(i(code)->file()); }
KstBindDataVector::KstBindDataVector(KJS::ExecState *exec, KstRVectorPtr v) : KstBindVector(exec, v.data(), "DataVector") { KJS::Object o(this); addBindings(exec, o); }
KstBindDataVector::KstBindDataVector(KJS::ExecState *exec, KJS::Object *globalObject) : KstBindVector(exec, globalObject, "DataVector") { KJS::Object o(this); addBindings(exec, o); }
void hongocompleto() { int i=0; do{ //for(i=6;i<9;i++) //{ setbkcolor(WHITE); construccion(); ////C setcolor (7); settextstyle (0,0,5); outtextxy (30,50,"C"); ////A setcolor (7); settextstyle (0,0,5); outtextxy (70,55,"A"); /////R setcolor (7); settextstyle (0,0,5); outtextxy (110,50,"R"); /////G setcolor (7); settextstyle (0,0,5); outtextxy (150,55,"G"); /////A setcolor (7); settextstyle (0,0,5); outtextxy (190,50,"A"); /////N setcolor (7); settextstyle (0,0,5); outtextxy (230,55,"N"); /////D setcolor (7); settextstyle (0,0,5); outtextxy (270,50,"D"); /////O setcolor (7); settextstyle (0,0,5); outtextxy (310,55,"O"); c(); //a1(); //r(); //g(); //a2(); //n(); //d(); //o(); //c(); delay(200); cabeza(); a1(); delay(200); ojo(); r(); delay(200); mancha1(); g(); delay(200); mancha2(); a2(); delay(200); mancha3(); n(); delay(200); mancha4(); d(); delay(200); mancha5(); o(); delay(200); //getch(); i=i++; //kbhit(); }while (i<2); //}while (!kbhit()); }
void test_o() { int* ip1 = o(PromotesToIntValue); double* dp1 = o(PromotesToUnsignedIntValue); }
int main(int argc, char *argv[]) { bool error = false; uint8_t buffer[256]; uint16_t bufferSize = 256; StreamParser p(streamReader, buffer, bufferSize, handlers, 1, NULL); while(p.parse() >= 0); int16_t theInt = 400; float theFloat = 213423.23466432; uint16_t functionID = 1; char *stri = (char *)"hello world"; uint8_t indexTable[] = { Object::T_UINT16, Object::T_INT16, Object::T_STRING, Object::T_FLOAT, Object::T_INT32, Object::T_INT64, (uint8_t)(strlen(stri) + 1) }; Object o(indexTable, 6); uint8_t dataBuffer[o.getDataSize()]; o.setDataBuffer(dataBuffer); o.uint16At(0, functionID); //function id o.int16At(1, theInt); //payload argument o.strAt(2, stri, strlen(stri) + 1); if(!o.floatAt(3, theFloat)) { printf("Failed to set float value\n"); } o.int32At(4, 345589619); o.int64At(5, 9384760934765065ll); if(o.int64At(5) != 9384760934765065ll) { printf("Retrieved int64 does not equal actual A:%lld, R:%lld\n", (long long int)9384760934765065ll, (long long int)o.int64At(5)); } if(o.int32At(4) != 345589619) { printf("Retrieved int32 does not equal actual\n"); } if(o.floatAt(3) != theFloat) { printf("Retrieved float does not equal actual A:%f, R:%f\n", theFloat, o.floatAt(3)); } if(o.int16At(1) != theInt) { printf("Retrieved int does not equal actual A:%d R:%d\n", theInt, o.int16At(1)); } StreamParser::PacketHeader ph = StreamParser::makePacket(16, o.getSize()); printf("generated packet: "); printHex(&ph, sizeof(ph)); o.writeTo(writer, NULL); printf("\n"); testBuffer = ((uint8_t *)(&ph)); testBufferSize = sizeof(StreamParser::PacketHeader); testBufferIndex = 0; printf("rpc call: "); if(rpc.call(10, "cCds", -10, 10, 320, "hello world") <= 0) { printf("error doing rpc call"); } printf("\n"); if(error) { printf("FAIELD: Object & RPC buffer tests\n"); } else { printf("PASSED: Object & RPC buffer tests\n"); } printf("Calling socket tests\n"); socketTest(); printf("PASSED: Socket Tests\n"); }
rstring Env::symbol_to_string(rsymbol sym) { return o(i(sym)->to_str(private_->state())); }
void DebugWindow::setText(const Ogre::String& text) { CeGuiString o(text.c_str()); mText->setText(o); }
rstring Env::string_new(const char* ptr) { return o(String::create(private_->state(), ptr)); }
/** * Use pipe_screen::get_param() to query PIPE_CAP_ values to determine * which GL extensions are supported. * Quite a few extensions are always supported because they are standard * features or can be built on top of other gallium features. * Some fine tuning may still be needed. */ void st_init_extensions(struct st_context *st) { struct pipe_screen *screen = st->pipe->screen; struct gl_context *ctx = st->ctx; int i, glsl_feature_level; GLboolean *extensions = (GLboolean *) &ctx->Extensions; static const struct st_extension_cap_mapping cap_mapping[] = { { o(ARB_base_instance), PIPE_CAP_START_INSTANCE }, { o(ARB_buffer_storage), PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT }, { o(ARB_depth_clamp), PIPE_CAP_DEPTH_CLIP_DISABLE }, { o(ARB_depth_texture), PIPE_CAP_TEXTURE_SHADOW_MAP }, { o(ARB_draw_buffers_blend), PIPE_CAP_INDEP_BLEND_FUNC }, { o(ARB_draw_instanced), PIPE_CAP_TGSI_INSTANCEID }, { o(ARB_fragment_program_shadow), PIPE_CAP_TEXTURE_SHADOW_MAP }, { o(ARB_instanced_arrays), PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR }, { o(ARB_occlusion_query), PIPE_CAP_OCCLUSION_QUERY }, { o(ARB_occlusion_query2), PIPE_CAP_OCCLUSION_QUERY }, { o(ARB_point_sprite), PIPE_CAP_POINT_SPRITE }, { o(ARB_seamless_cube_map), PIPE_CAP_SEAMLESS_CUBE_MAP }, { o(ARB_shader_stencil_export), PIPE_CAP_SHADER_STENCIL_EXPORT }, { o(ARB_shader_texture_lod), PIPE_CAP_SM3 }, { o(ARB_shadow), PIPE_CAP_TEXTURE_SHADOW_MAP }, { o(ARB_texture_mirror_clamp_to_edge), PIPE_CAP_TEXTURE_MIRROR_CLAMP }, { o(ARB_texture_non_power_of_two), PIPE_CAP_NPOT_TEXTURES }, { o(ARB_timer_query), PIPE_CAP_QUERY_TIMESTAMP }, { o(ARB_transform_feedback2), PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME }, { o(ARB_transform_feedback3), PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME }, { o(EXT_blend_equation_separate), PIPE_CAP_BLEND_EQUATION_SEPARATE }, { o(EXT_draw_buffers2), PIPE_CAP_INDEP_BLEND_ENABLE }, { o(EXT_stencil_two_side), PIPE_CAP_TWO_SIDED_STENCIL }, { o(EXT_texture_array), PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS }, { o(EXT_texture_filter_anisotropic), PIPE_CAP_ANISOTROPIC_FILTER }, { o(EXT_texture_mirror_clamp), PIPE_CAP_TEXTURE_MIRROR_CLAMP }, { o(EXT_texture_swizzle), PIPE_CAP_TEXTURE_SWIZZLE }, { o(EXT_transform_feedback), PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS }, { o(AMD_seamless_cubemap_per_texture), PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE }, { o(ATI_separate_stencil), PIPE_CAP_TWO_SIDED_STENCIL }, { o(ATI_texture_mirror_once), PIPE_CAP_TEXTURE_MIRROR_CLAMP }, { o(NV_conditional_render), PIPE_CAP_CONDITIONAL_RENDER }, { o(NV_texture_barrier), PIPE_CAP_TEXTURE_BARRIER }, /* GL_NV_point_sprite is not supported by gallium because we don't * support the GL_POINT_SPRITE_R_MODE_NV option. */ { o(OES_standard_derivatives), PIPE_CAP_SM3 }, { o(ARB_texture_cube_map_array), PIPE_CAP_CUBE_MAP_ARRAY }, { o(ARB_texture_multisample), PIPE_CAP_TEXTURE_MULTISAMPLE }, { o(ARB_texture_query_lod), PIPE_CAP_TEXTURE_QUERY_LOD }, { o(ARB_sample_shading), PIPE_CAP_SAMPLE_SHADING }, }; /* Required: render target and sampler support */ static const struct st_extension_format_mapping rendertarget_mapping[] = { { { o(ARB_texture_float) }, { PIPE_FORMAT_R32G32B32A32_FLOAT, PIPE_FORMAT_R16G16B16A16_FLOAT } }, { { o(ARB_texture_rgb10_a2ui) }, { PIPE_FORMAT_R10G10B10A2_UINT, PIPE_FORMAT_B10G10R10A2_UINT }, GL_TRUE }, /* at least one format must be supported */ { { o(EXT_framebuffer_sRGB) }, { PIPE_FORMAT_A8B8G8R8_SRGB, PIPE_FORMAT_B8G8R8A8_SRGB }, GL_TRUE }, /* at least one format must be supported */ { { o(EXT_packed_float) }, { PIPE_FORMAT_R11G11B10_FLOAT } }, { { o(EXT_texture_integer) }, { PIPE_FORMAT_R32G32B32A32_UINT, PIPE_FORMAT_R32G32B32A32_SINT } }, { { o(ARB_texture_rg) }, { PIPE_FORMAT_R8_UNORM, PIPE_FORMAT_R8G8_UNORM } }, }; /* Required: depth stencil and sampler support */ static const struct st_extension_format_mapping depthstencil_mapping[] = { { { o(ARB_depth_buffer_float) }, { PIPE_FORMAT_Z32_FLOAT, PIPE_FORMAT_Z32_FLOAT_S8X24_UINT } }, }; /* Required: sampler support */ static const struct st_extension_format_mapping texture_mapping[] = { { { o(ARB_texture_compression_rgtc) }, { PIPE_FORMAT_RGTC1_UNORM, PIPE_FORMAT_RGTC1_SNORM, PIPE_FORMAT_RGTC2_UNORM, PIPE_FORMAT_RGTC2_SNORM } }, { { o(EXT_texture_compression_latc) }, { PIPE_FORMAT_LATC1_UNORM, PIPE_FORMAT_LATC1_SNORM, PIPE_FORMAT_LATC2_UNORM, PIPE_FORMAT_LATC2_SNORM } }, { { o(EXT_texture_compression_s3tc), o(ANGLE_texture_compression_dxt) }, { PIPE_FORMAT_DXT1_RGB, PIPE_FORMAT_DXT1_RGBA, PIPE_FORMAT_DXT3_RGBA, PIPE_FORMAT_DXT5_RGBA } }, { { o(EXT_texture_shared_exponent) }, { PIPE_FORMAT_R9G9B9E5_FLOAT } }, { { o(EXT_texture_snorm) }, { PIPE_FORMAT_R8G8B8A8_SNORM } }, { { o(EXT_texture_sRGB), o(EXT_texture_sRGB_decode) }, { PIPE_FORMAT_A8B8G8R8_SRGB, PIPE_FORMAT_B8G8R8A8_SRGB }, GL_TRUE }, /* at least one format must be supported */ { { o(ATI_texture_compression_3dc) }, { PIPE_FORMAT_LATC2_UNORM } }, { { o(MESA_ycbcr_texture) }, { PIPE_FORMAT_UYVY, PIPE_FORMAT_YUYV }, GL_TRUE }, /* at least one format must be supported */ { { o(OES_compressed_ETC1_RGB8_texture) }, { PIPE_FORMAT_ETC1_RGB8 } }, { { o(ARB_stencil_texturing) }, { PIPE_FORMAT_X24S8_UINT, PIPE_FORMAT_S8X24_UINT }, GL_TRUE }, /* at least one format must be supported */ }; /* Required: vertex fetch support. */ static const struct st_extension_format_mapping vertex_mapping[] = { { { o(ARB_vertex_type_2_10_10_10_rev) }, { PIPE_FORMAT_R10G10B10A2_UNORM, PIPE_FORMAT_B10G10R10A2_UNORM, PIPE_FORMAT_R10G10B10A2_SNORM, PIPE_FORMAT_B10G10R10A2_SNORM, PIPE_FORMAT_R10G10B10A2_USCALED, PIPE_FORMAT_B10G10R10A2_USCALED, PIPE_FORMAT_R10G10B10A2_SSCALED, PIPE_FORMAT_B10G10R10A2_SSCALED } }, { { o(ARB_vertex_type_10f_11f_11f_rev) }, { PIPE_FORMAT_R11G11B10_FLOAT } }, }; static const struct st_extension_format_mapping tbo_rgb32[] = { { {o(ARB_texture_buffer_object_rgb32) }, { PIPE_FORMAT_R32G32B32_FLOAT, PIPE_FORMAT_R32G32B32_UINT, PIPE_FORMAT_R32G32B32_SINT, } }, }; /* * Extensions that are supported by all Gallium drivers: */ ctx->Extensions.ARB_ES2_compatibility = GL_TRUE; ctx->Extensions.ARB_draw_elements_base_vertex = GL_TRUE; ctx->Extensions.ARB_explicit_attrib_location = GL_TRUE; ctx->Extensions.ARB_fragment_coord_conventions = GL_TRUE; ctx->Extensions.ARB_fragment_program = GL_TRUE; ctx->Extensions.ARB_fragment_shader = GL_TRUE; ctx->Extensions.ARB_half_float_vertex = GL_TRUE; ctx->Extensions.ARB_internalformat_query = GL_TRUE; ctx->Extensions.ARB_map_buffer_range = GL_TRUE; ctx->Extensions.ARB_texture_border_clamp = GL_TRUE; /* XXX temp */ ctx->Extensions.ARB_texture_cube_map = GL_TRUE; ctx->Extensions.ARB_texture_env_combine = GL_TRUE; ctx->Extensions.ARB_texture_env_crossbar = GL_TRUE; ctx->Extensions.ARB_texture_env_dot3 = GL_TRUE; ctx->Extensions.ARB_vertex_program = GL_TRUE; ctx->Extensions.ARB_vertex_shader = GL_TRUE; ctx->Extensions.EXT_blend_color = GL_TRUE; ctx->Extensions.EXT_blend_func_separate = GL_TRUE; ctx->Extensions.EXT_blend_minmax = GL_TRUE; ctx->Extensions.EXT_gpu_program_parameters = GL_TRUE; ctx->Extensions.EXT_pixel_buffer_object = GL_TRUE; ctx->Extensions.EXT_point_parameters = GL_TRUE; ctx->Extensions.EXT_provoking_vertex = GL_TRUE; ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE; ctx->Extensions.EXT_vertex_array_bgra = GL_TRUE; ctx->Extensions.ATI_texture_env_combine3 = GL_TRUE; ctx->Extensions.MESA_pack_invert = GL_TRUE; ctx->Extensions.NV_fog_distance = GL_TRUE; ctx->Extensions.NV_texture_env_combine4 = GL_TRUE; ctx->Extensions.NV_texture_rectangle = GL_TRUE; ctx->Extensions.NV_vdpau_interop = GL_TRUE; ctx->Extensions.OES_EGL_image = GL_TRUE; ctx->Extensions.OES_EGL_image_external = GL_TRUE; ctx->Extensions.OES_draw_texture = GL_TRUE; /* Expose the extensions which directly correspond to gallium caps. */ for (i = 0; i < Elements(cap_mapping); i++) { if (screen->get_param(screen, cap_mapping[i].cap)) { extensions[cap_mapping[i].extension_offset] = GL_TRUE; } } /* Expose the extensions which directly correspond to gallium formats. */ init_format_extensions(st, rendertarget_mapping, Elements(rendertarget_mapping), PIPE_TEXTURE_2D, PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW); init_format_extensions(st, depthstencil_mapping, Elements(depthstencil_mapping), PIPE_TEXTURE_2D, PIPE_BIND_DEPTH_STENCIL | PIPE_BIND_SAMPLER_VIEW); init_format_extensions(st, texture_mapping, Elements(texture_mapping), PIPE_TEXTURE_2D, PIPE_BIND_SAMPLER_VIEW); init_format_extensions(st, vertex_mapping, Elements(vertex_mapping), PIPE_BUFFER, PIPE_BIND_VERTEX_BUFFER); /* Figure out GLSL support. */ glsl_feature_level = screen->get_param(screen, PIPE_CAP_GLSL_FEATURE_LEVEL); ctx->Const.GLSLVersion = glsl_feature_level; if (glsl_feature_level >= 330) ctx->Const.GLSLVersion = 330; _mesa_override_glsl_version(st->ctx); if (st->options.force_glsl_version > 0 && st->options.force_glsl_version <= ctx->Const.GLSLVersion) { ctx->Const.ForceGLSLVersion = st->options.force_glsl_version; } /* This extension needs full OpenGL 3.2, but we don't know if that's * supported at this point. Only check the GLSL version. */ if (ctx->Const.GLSLVersion >= 150 && screen->get_param(screen, PIPE_CAP_TGSI_VS_LAYER)) { ctx->Extensions.AMD_vertex_shader_layer = GL_TRUE; } if (ctx->Const.GLSLVersion >= 130) { ctx->Const.NativeIntegers = GL_TRUE; ctx->Const.MaxClipPlanes = 8; /* Extensions that either depend on GLSL 1.30 or are a subset thereof. */ ctx->Extensions.ARB_conservative_depth = GL_TRUE; ctx->Extensions.ARB_shading_language_packing = GL_TRUE; ctx->Extensions.OES_depth_texture_cube_map = GL_TRUE; ctx->Extensions.ARB_shading_language_420pack = GL_TRUE; if (!st->options.disable_shader_bit_encoding) { ctx->Extensions.ARB_shader_bit_encoding = GL_TRUE; } ctx->Extensions.EXT_shader_integer_mix = GL_TRUE; } else { /* Optional integer support for GLSL 1.2. */ if (screen->get_shader_param(screen, PIPE_SHADER_VERTEX, PIPE_SHADER_CAP_INTEGERS) && screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_INTEGERS)) { ctx->Const.NativeIntegers = GL_TRUE; ctx->Extensions.EXT_shader_integer_mix = GL_TRUE; } } /* Below are the cases which cannot be moved into tables easily. */ if (!ctx->Mesa_DXTn && !st->options.force_s3tc_enable) { ctx->Extensions.EXT_texture_compression_s3tc = GL_FALSE; ctx->Extensions.ANGLE_texture_compression_dxt = GL_FALSE; } if (screen->get_shader_param(screen, PIPE_SHADER_GEOMETRY, PIPE_SHADER_CAP_MAX_INSTRUCTIONS) > 0) { #if 0 /* XXX re-enable when GLSL compiler again supports geometry shaders */ ctx->Extensions.ARB_geometry_shader4 = GL_TRUE; #endif } ctx->Extensions.NV_primitive_restart = GL_TRUE; if (!screen->get_param(screen, PIPE_CAP_PRIMITIVE_RESTART)) { ctx->Const.PrimitiveRestartInSoftware = GL_TRUE; } /* ARB_color_buffer_float. */ if (screen->get_param(screen, PIPE_CAP_VERTEX_COLOR_UNCLAMPED)) { ctx->Extensions.ARB_color_buffer_float = GL_TRUE; if (!screen->get_param(screen, PIPE_CAP_VERTEX_COLOR_CLAMPED)) { st->clamp_vert_color_in_shader = TRUE; } if (!screen->get_param(screen, PIPE_CAP_FRAGMENT_COLOR_CLAMPED)) { st->clamp_frag_color_in_shader = TRUE; } /* For drivers which cannot do color clamping, it's better to just * disable ARB_color_buffer_float in the core profile, because * the clamping is deprecated there anyway. */ if (ctx->API == API_OPENGL_CORE && (st->clamp_frag_color_in_shader || st->clamp_vert_color_in_shader)) { st->clamp_vert_color_in_shader = GL_FALSE; st->clamp_frag_color_in_shader = GL_FALSE; ctx->Extensions.ARB_color_buffer_float = GL_FALSE; } } if (screen->fence_finish) { ctx->Extensions.ARB_sync = GL_TRUE; } /* Maximum sample count. */ for (i = 16; i > 0; --i) { enum pipe_format pformat = st_choose_format(st, GL_RGBA, GL_NONE, GL_NONE, PIPE_TEXTURE_2D, i, PIPE_BIND_RENDER_TARGET, FALSE); if (pformat != PIPE_FORMAT_NONE) { ctx->Const.MaxSamples = i; ctx->Const.MaxColorTextureSamples = i; break; } } for (i = ctx->Const.MaxSamples; i > 0; --i) { enum pipe_format pformat = st_choose_format(st, GL_DEPTH_STENCIL, GL_NONE, GL_NONE, PIPE_TEXTURE_2D, i, PIPE_BIND_DEPTH_STENCIL, FALSE); if (pformat != PIPE_FORMAT_NONE) { ctx->Const.MaxDepthTextureSamples = i; break; } } for (i = ctx->Const.MaxSamples; i > 0; --i) { enum pipe_format pformat = st_choose_format(st, GL_RGBA_INTEGER, GL_NONE, GL_NONE, PIPE_TEXTURE_2D, i, PIPE_BIND_RENDER_TARGET, FALSE); if (pformat != PIPE_FORMAT_NONE) { ctx->Const.MaxIntegerSamples = i; break; } } if (ctx->Const.MaxSamples == 1) { /* one sample doesn't really make sense */ ctx->Const.MaxSamples = 0; } else if (ctx->Const.MaxSamples >= 2) { ctx->Extensions.EXT_framebuffer_multisample = GL_TRUE; ctx->Extensions.EXT_framebuffer_multisample_blit_scaled = GL_TRUE; } if (ctx->Const.MaxSamples == 0 && screen->get_param(screen, PIPE_CAP_FAKE_SW_MSAA)) { ctx->Const.FakeSWMSAA = GL_TRUE; ctx->Extensions.EXT_framebuffer_multisample = GL_TRUE; ctx->Extensions.EXT_framebuffer_multisample_blit_scaled = GL_TRUE; ctx->Extensions.ARB_texture_multisample = GL_TRUE; } if (ctx->Const.MaxDualSourceDrawBuffers > 0 && !st->options.disable_blend_func_extended) ctx->Extensions.ARB_blend_func_extended = GL_TRUE; st->has_time_elapsed = screen->get_param(screen, PIPE_CAP_QUERY_TIME_ELAPSED); if (st->has_time_elapsed || ctx->Extensions.ARB_timer_query) { ctx->Extensions.EXT_timer_query = GL_TRUE; } if (ctx->Extensions.ARB_transform_feedback2 && ctx->Extensions.ARB_draw_instanced) { ctx->Extensions.ARB_transform_feedback_instanced = GL_TRUE; } if (st->options.force_glsl_extensions_warn) ctx->Const.ForceGLSLExtensionsWarn = 1; if (st->options.disable_glsl_line_continuations) ctx->Const.DisableGLSLLineContinuations = 1; ctx->Const.MinMapBufferAlignment = screen->get_param(screen, PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT); if (screen->get_param(screen, PIPE_CAP_TEXTURE_BUFFER_OBJECTS)) { ctx->Extensions.ARB_texture_buffer_object = GL_TRUE; ctx->Const.MaxTextureBufferSize = _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE), (1u << 31) - 1); ctx->Const.TextureBufferOffsetAlignment = screen->get_param(screen, PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT); if (ctx->Const.TextureBufferOffsetAlignment) ctx->Extensions.ARB_texture_buffer_range = GL_TRUE; init_format_extensions(st, tbo_rgb32, Elements(tbo_rgb32), PIPE_BUFFER, PIPE_BIND_SAMPLER_VIEW); } if (screen->get_param(screen, PIPE_CAP_MIXED_FRAMEBUFFER_SIZES)) { ctx->Extensions.ARB_framebuffer_object = GL_TRUE; } /* Unpacking a varying in the fragment shader costs 1 texture indirection. * If the number of available texture indirections is very limited, then we * prefer to disable varying packing rather than run the risk of varying * packing preventing a shader from running. */ if (screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS) <= 8) { /* We can't disable varying packing if transform feedback is available, * because transform feedback code assumes a packed varying layout. */ if (!ctx->Extensions.EXT_transform_feedback) ctx->Const.DisableVaryingPacking = GL_TRUE; } if (ctx->API == API_OPENGL_CORE) { ctx->Const.MaxViewports = screen->get_param(screen, PIPE_CAP_MAX_VIEWPORTS); if (ctx->Const.MaxViewports >= 16) { ctx->Const.ViewportBounds.Min = -16384.0; ctx->Const.ViewportBounds.Max = 16384.0; ctx->Extensions.ARB_viewport_array = GL_TRUE; } } if (ctx->Const.MaxProgramTextureGatherComponents > 0) ctx->Extensions.ARB_texture_gather = GL_TRUE; }
rsymbol Env::string_to_symbol(rstring str) { return o(i(str)->to_sym(private_->state())); }
KstBindPluginManager::KstBindPluginManager(KJS::ExecState *exec) : KstBinding("PluginManager", false) { KJS::Object o(this); addBindings(exec, o); }
rtable Env::table_new() { return o(LookupTable::create(private_->state())); }
// @node maya shader node name void Visitor::visitFile(const char* node) { CM_TRACE_FUNC("Visitor::visitFile("<<node<<")"); OutputHelper o(RSLfile); o.addInclude("file.h"); o.beginRSL( node ); MString mayaTexName(getFileNodeImageName(node)); MString texName = mayaTexName + ".tex"; //system("txmake mayaTexName texName"); IfMErrorWarn(MGlobal::executeCommand("system(\"txmake "+mayaTexName+" "+texName+"\")", true)); //input o.addRSLVariable( "", "float", "alphaGain", "alphaGain", node); o.addRSLVariable("uniform", "float", "alphaIsLuminance", "alphaIsLuminance", node); o.addRSLVariable( "", "float", "alphaOffset", "alphaOffset", node); o.addRSLVariable( "", "color", "colorGain", "colorGain", node); o.addRSLVariable( "", "color", "colorOffset", "colorOffset", node); o.addRSLVariable( "", "color", "defaultColor", "defaultColor", node); o.addRSLVariable( "", "float2", "uvCoord", "uvCoord",node); //texName o.addRSLVariable("uniform", "float", "filterType", "filterType", node); o.addRSLVariable("uniform", "float", "filter", "filter", node); o.addRSLVariable( "", "float", "filterOffset", "filterOffset", node); o.addRSLVariable("uniform", "float", "invert", "invert", node); o.addRSLVariable("uniform", "float", "fileHasAlpha", "fileHasAlpha", node); //o.addRSLVariable("index", "num_channels", "num_channels", node); //output o.addRSLVariable( "", "float", "outAlpha", "outAlpha", node); o.addRSLVariable( "", "vector", "outColor", "outColor", node); o.addRSLVariable( "", "vector", "outTransparency", "outTransparency", node); o.addToRSL("{"); o.addToRSL(" color _outColor;"); o.addToRSL(" color _outTransparency;"); o.addToRSL(" maya_file(" //Inputs "alphaGain, \n\t" "alphaIsLuminance, \n\t" "alphaOffset, \n\t" "colorGain, \n\t" "colorOffset, \n\t" "defaultColor, \n\t" "\""+texName+"\", \n\t" "filterType, \n\t" "filter, \n\t" "filterOffset, \n\t" "invert, \n\t" "uvCoord, \n\t" //Outputs "outAlpha, \n\t" "_outColor, \n\t" "_outTransparency \n" " );"); o.addToRSL(" outColor = vector _outColor;"); o.addToRSL(" outTransparency = vector _outTransparency;"); o.addToRSL("}"); o.endRSL(); }
void ShrubberyCreationForm::action() const { std::ofstream o((this->_target + "_shrubbery").c_str()); o << "ASCII trees" << std::endl; }
RMF::NodeHandle get_node_from_association(RMF::FileHandle nh, Object *oi) { AssociationType o(oi); return nh.get_node_from_association(o); }
char TmultiScore::debug() { QTextStream o(stdout); o << "\033[01;35m[SCORE]\033[01;00m"; return 32; }
rinteger Env::integer_new(r_mint val) { return o(Integer::from(private_->state(), val)); }
polynomial& operator=(const polynomial<T>& o) { vals = std::make_shared<std::vector<T>>(o.size()); copy_n(&o(0),o.size(),&element(0)); return *this; }
rsymbol Env::symbol(const char* data) { return o(private_->state()->symbol(data)); }
void ClassBinding::write(string dir, const set<string>& includes, string* bindingNS) { // Calculate the constructor string. size_t index = uniquename.rfind(SCOPE_REPLACEMENT); string constructorString = ""; string* constructorUniqueName = NULL; if (index != uniquename.npos && index != uniquename.length()) constructorString += uniquename.substr(index + SCOPE_REPLACEMENT_SIZE); else constructorString += uniquename; // Generate a constructor function if there isn't one // and the class doesn't have an inaccessible constructor. FunctionBinding b(classname, uniquename); b.name = constructorString; b.returnParam = FunctionBinding::Param(FunctionBinding::Param::TYPE_CONSTRUCTOR, FunctionBinding::Param::KIND_POINTER, refId); b.type = FunctionBinding::MEMBER_FUNCTION; b.own = true; map<string, vector<FunctionBinding> >::iterator iter = bindings.find(b.getFunctionName()); if (iter == bindings.end()) { if (!inaccessibleConstructor) { bindings[b.getFunctionName()].push_back(b); constructorUniqueName = new string(b.getFunctionName()); } } else { constructorUniqueName = new string(iter->second[0].getFunctionName()); } // Calculate the destructor string. index = uniquename.rfind(SCOPE_REPLACEMENT); string destructorString = "~"; string* destructorUniqueName = NULL; if (index != uniquename.npos && index != uniquename.length()) destructorString += uniquename.substr(index + SCOPE_REPLACEMENT_SIZE); else destructorString += uniquename; // Generate a destructor function if there isn't one // and the class doesn't have an inaccessible destructor // or the class is derived from Ref. b = FunctionBinding(classname, uniquename); b.name = destructorString; b.returnParam = FunctionBinding::Param(FunctionBinding::Param::TYPE_DESTRUCTOR); b.type = FunctionBinding::MEMBER_FUNCTION; iter = bindings.find(b.getFunctionName()); if (iter == bindings.end()) { if (!inaccessibleDestructor || Generator::getInstance()->isRef(classname)) { bindings[b.getFunctionName()].push_back(b); destructorUniqueName = new string(b.getFunctionName()); } } else { destructorUniqueName = new string(iter->second[0].getFunctionName()); } // Write out the header. { string path = dir + string("lua_") + uniquename + string(".h"); ofstream o(path.c_str()); if (!o) { GP_ERROR("Failed to open file '%s' for generating Lua bindings.", path.c_str()); return; } string includeGuard = string("lua_") + uniquename + string("_H_"); transform(includeGuard.begin(), includeGuard.end(), includeGuard.begin(), ::toupper); o << "#ifndef " << includeGuard << "\n"; o << "#define " << includeGuard << "\n\n"; if (bindingNS) { o << "namespace " << *bindingNS << "\n"; o << "{\n\n"; } o << "// Lua bindings for " << classname << ".\n"; // Write out the binding functions declarations. iter = bindings.begin(); for (; iter != bindings.end(); iter++) { o << "int " << iter->second[0].getFunctionName() << "(lua_State* state);\n"; } o << "\n"; // Write out the signature of the function used to register the class with Lua. o << "void luaRegister_" << uniquename << "();\n\n"; if (bindingNS) o << "}\n\n"; o << "#endif\n"; o.close(); } // Write out the implementation. { string path = dir + string("lua_") + uniquename + string(".cpp"); ofstream o(path.c_str()); if (!o) { GP_ERROR("Failed to open file '%s' for generating Lua bindings.", path.c_str()); return; } o << "#include \"Base.h\"\n"; o << "#include \"ScriptController.h\"\n"; o << "#include \"lua_" << uniquename << ".h\"\n"; // Ensure we include the original class header, even // if the list of includes doesn't have it. if (includes.find(include) == includes.end()) o << "#include \"" << include << "\"\n"; for (set<string>::iterator includeIter = includes.begin(); includeIter != includes.end(); includeIter++) { o << "#include \"" << *includeIter << "\"\n"; } o << "\n"; // If the original class is part of a namespace and we aren't generating into that namespace, // include its member with a 'using' statement. if (ns.length() > 0 && (!bindingNS || (*bindingNS != ns))) { o << "using " << ns << ";\n\n"; } if (bindingNS) { o << "namespace " << *bindingNS << "\n"; o << "{\n\n"; } // Write out the function used to register the class with Lua. o << "void luaRegister_" << uniquename << "()\n"; o << "{\n"; // Get the member functions ready to bind. iter = bindings.begin(); bool hasMembers = false; for (; iter != bindings.end(); iter++) { for (unsigned int i = 0, count = iter->second.size(); i < count; i++) { if (iter->second[i].type == FunctionBinding::MEMBER_FUNCTION || iter->second[i].type == FunctionBinding::MEMBER_CONSTANT || iter->second[i].type == FunctionBinding::MEMBER_VARIABLE) { hasMembers = true; break; } } if (hasMembers) break; } if (hasMembers) { o << " const luaL_Reg lua_members[] = \n"; o << " {\n"; iter = bindings.begin(); for (; iter != bindings.end(); iter++) { for (unsigned int i = 0, count = iter->second.size(); i < count; i++) { if ((iter->second[i].type == FunctionBinding::MEMBER_FUNCTION || iter->second[i].type == FunctionBinding::MEMBER_CONSTANT || iter->second[i].type == FunctionBinding::MEMBER_VARIABLE) && iter->second[i].returnParam.type != FunctionBinding::Param::TYPE_CONSTRUCTOR && iter->second[i].returnParam.type != FunctionBinding::Param::TYPE_DESTRUCTOR) { o << " {\"" << iter->second[i].name << "\", " << iter->second[i].getFunctionName() << "},\n"; break; } } } o << " {NULL, NULL}\n"; o << " };\n"; } else { o << " const luaL_Reg* lua_members = NULL;\n"; } // Get the static functions ready to bind. iter = bindings.begin(); bool hasStatics = false; for (; iter != bindings.end(); iter++) { for (unsigned int i = 0, count = iter->second.size(); i < count; i++) { if (iter->second[i].type == FunctionBinding::STATIC_FUNCTION || iter->second[i].type == FunctionBinding::STATIC_CONSTANT || iter->second[i].type == FunctionBinding::STATIC_VARIABLE) { hasStatics = true; break; } } if (hasStatics) break; } if (hasStatics) { o << " const luaL_Reg lua_statics[] = \n"; o << " {\n"; iter = bindings.begin(); for (; iter != bindings.end(); iter++) { for (unsigned int i = 0, count = iter->second.size(); i < count; i++) { if (iter->second[i].type == FunctionBinding::STATIC_FUNCTION || iter->second[i].type == FunctionBinding::STATIC_CONSTANT || iter->second[i].type == FunctionBinding::STATIC_VARIABLE) { o << " {\"" << iter->second[i].name << "\", " << iter->second[i].getFunctionName() << "},\n"; break; } } } o << " {NULL, NULL}\n"; o << " };\n"; } else { o << " const luaL_Reg* lua_statics = NULL;\n"; } // Output the scope path for the class (used for inner classes). vector<string> scopePath = Generator::getScopePath(classname, ns); o << " std::vector<std::string> scopePath;\n"; for (vector<string>::iterator scopeIter = scopePath.begin(); scopeIter != scopePath.end(); scopeIter++) { o << " scopePath.push_back(\"" << *scopeIter << "\");\n"; } // Register the class (its member and static functions and constructor and destructor). o << "\n ScriptUtil::registerClass(\"" << uniquename << "\", lua_members, "; o << ((constructorUniqueName) ? *constructorUniqueName : "NULL") << ", "; o << ((destructorUniqueName) ? *destructorUniqueName : "NULL") << ", "; o << "lua_statics, scopePath);\n"; o << "}\n\n"; // Write out the function used to get the instance for // calling member functions and variables. generateInstanceGetter(o, classname, uniquename); // Write out the binding functions. iter = bindings.begin(); for (; iter != bindings.end(); iter++) { FunctionBinding::write(o, iter->second); } if (bindingNS) o << "}\n"; o.close(); } SAFE_DELETE(constructorUniqueName); SAFE_DELETE(destructorUniqueName); }
QJsonObject RemDev::newNotification(const QString &method, const QJsonObject ¶ms) const { QJsonObject o(rpc_seed); o.insert("method", method); if (params.size()) o.insert("params", params); return o; }