当前位置: 首页>>代码示例>>Python>>正文


Python gltrace.GlTracer类代码示例

本文整理汇总了Python中gltrace.GlTracer的典型用法代码示例。如果您正苦于以下问题:Python GlTracer类的具体用法?Python GlTracer怎么用?Python GlTracer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了GlTracer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: traceFunctionImplBody

    def traceFunctionImplBody(self, function):
        GlTracer.traceFunctionImplBody(self, function)

        if function.name == 'eglCreateContext':
            print '    if (_result != EGL_NO_CONTEXT)'
            print '        gltrace::createContext((uintptr_t)_result);'

        if function.name == 'eglMakeCurrent':
            print '    if (_result) {'
            print '        // update the profile'
            print '        if (ctx != EGL_NO_CONTEXT) {'
            print '            EGLint api = EGL_OPENGL_ES_API, version = 1;'
            print '            gltrace::setContext((uintptr_t)ctx);'
            print '            gltrace::Context *tr = gltrace::getContext();'
            print '            _eglQueryContext(dpy, ctx, EGL_CONTEXT_CLIENT_TYPE, &api);'
            print '            _eglQueryContext(dpy, ctx, EGL_CONTEXT_CLIENT_VERSION, &version);'
            print '            if (api == EGL_OPENGL_API)'
            print '                tr->profile = gltrace::PROFILE_COMPAT;'
            print '            else if (version == 1)'
            print '                tr->profile = gltrace::PROFILE_ES1;'
            print '            else'
            print '                tr->profile = gltrace::PROFILE_ES2;'
            print '        } else {'
            print '            gltrace::clearContext();'
            print '        }'
            print '    }'

        if function.name == 'eglDestroyContext':
            print '    if (_result) {'
            print '        gltrace::releaseContext((uintptr_t)ctx);'
            print '    }'
开发者ID:ds-hwang,项目名称:apitrace,代码行数:31,代码来源:egltrace.py

示例2: traceFunctionImplBody

    def traceFunctionImplBody(self, function):
        GlTracer.traceFunctionImplBody(self, function)

        if function.name == 'eglCreateContext':
            print '    if (_result != EGL_NO_CONTEXT)'
            print '        gltrace::createContext((uintptr_t)_result);'

        if function.name == 'eglMakeCurrent':
            print r'    if (_result) {'
            print r'        // update the profile'
            print r'        if (ctx != EGL_NO_CONTEXT) {'
            print r'            gltrace::setContext((uintptr_t)ctx);'
            print r'            gltrace::Context *tr = gltrace::getContext();'
            print r'            EGLint api = EGL_OPENGL_ES_API;'
            print r'            _eglQueryContext(dpy, ctx, EGL_CONTEXT_CLIENT_TYPE, &api);'
            print r'            if (api == EGL_OPENGL_API) {'
            print r'                assert(tr->profile.api == glfeatures::API_GL);'
            print r'            } else if (api == EGL_OPENGL_ES_API) {'
            print r'                EGLint client_version = 1;'
            print r'                _eglQueryContext(dpy, ctx, EGL_CONTEXT_CLIENT_VERSION, &client_version);'
            print r'                if (tr->profile.api != glfeatures::API_GLES ||'
            print r'                    tr->profile.major < client_version) {'
            print r'                    std::string version = tr->profile.str();'
            print r'                    os::log("apitrace: warning: eglMakeCurrent: expected OpenGL ES %i.x context, but got %s\n",'
            print r'                            client_version, version.c_str());'
            print r'                }'
            print r'            } else {'
            print r'                assert(0);'
            print r'            }'
            print r'        } else {'
            print r'            gltrace::clearContext();'
            print r'        }'
            print r'    }'

        if function.name == 'eglDestroyContext':
            print '    if (_result) {'
            print '        gltrace::releaseContext((uintptr_t)ctx);'
            print '    }'

        if function.name == 'glEGLImageTargetTexture2DOES':
            print '    image_info *info = _EGLImageKHR_get_image_info(target, image);'
            print '    if (info) {'
            print '        GLint level = 0;'
            print '        GLint internalformat = info->internalformat;'
            print '        GLsizei width = info->width;'
            print '        GLsizei height = info->height;'
            print '        GLint border = 0;'
            print '        GLenum format = info->format;'
            print '        GLenum type = info->type;'
            print '        const GLvoid * pixels = info->pixels;'
            self.emitFakeTexture2D()
            print '        _EGLImageKHR_free_image_info(info);'
            print '    }'
开发者ID:ShuangxueBai,项目名称:apitrace,代码行数:53,代码来源:egltrace.py

示例3: traceFunctionImplBody

    def traceFunctionImplBody(self, function):
        GlTracer.traceFunctionImplBody(self, function)

        if function.name == 'eglCreateContext':
            print '    if (_result != EGL_NO_CONTEXT)'
            print '        gltrace::createContext((uintptr_t)_result);'

        if function.name == 'eglMakeCurrent':
            print '    if (_result) {'
            print '        // update the profile'
            print '        if (ctx != EGL_NO_CONTEXT) {'
            print '            gltrace::setContext((uintptr_t)ctx);'
            print '#ifndef NDEBUG'
            print '            gltrace::Context *tr = gltrace::getContext();'
            print '            EGLint api = EGL_OPENGL_ES_API;'
            print '            _eglQueryContext(dpy, ctx, EGL_CONTEXT_CLIENT_TYPE, &api);'
            print '            if (api == EGL_OPENGL_API) {'
            print '                assert(tr->profile.api == glprofile::API_GL);'
            print '            } else if (api == EGL_OPENGL_ES_API) {'
            print '                assert(tr->profile.api == glprofile::API_GLES);'
            print '                EGLint version = 1;'
            print '                _eglQueryContext(dpy, ctx, EGL_CONTEXT_CLIENT_VERSION, &version);'
            print '                assert(tr->profile.major >= version);'
            print '            } else {'
            print '                assert(0);'
            print '            }'
            print '#endif'
            print '        } else {'
            print '            gltrace::clearContext();'
            print '        }'
            print '    }'

        if function.name == 'eglDestroyContext':
            print '    if (_result) {'
            print '        gltrace::releaseContext((uintptr_t)ctx);'
            print '    }'

        if function.name == 'glEGLImageTargetTexture2DOES':
            print '    image_info *info = _EGLImageKHR_get_image_info(target, image);'
            print '    if (info) {'
            print '        GLint level = 0;'
            print '        GLint internalformat = info->internalformat;'
            print '        GLsizei width = info->width;'
            print '        GLsizei height = info->height;'
            print '        GLint border = 0;'
            print '        GLenum format = info->format;'
            print '        GLenum type = info->type;'
            print '        const GLvoid * pixels = info->pixels;'
            self.emitFakeTexture2D()
            print '        _EGLImageKHR_free_image_info(info);'
            print '    }'
开发者ID:galek,项目名称:apitrace,代码行数:51,代码来源:egltrace.py

示例4: trace_function_impl_body

    def trace_function_impl_body(self, function):
        GlTracer.trace_function_impl_body(self, function)

        if function.name == "eglMakeCurrent":
            print "    // update the profile"
            print "    if (ctx != EGL_NO_CONTEXT) {"
            print "        EGLint api = EGL_OPENGL_ES_API, version = 1;"
            print "        tracer_context *tr = __get_context();"
            print "        __eglQueryContext(dpy, ctx, EGL_CONTEXT_CLIENT_TYPE, &api);"
            print "        __eglQueryContext(dpy, ctx, EGL_CONTEXT_CLIENT_VERSION, &version);"
            print "        if (api == EGL_OPENGL_API)"
            print "            tr->profile = PROFILE_COMPAT;"
            print "        else if (version == 1)"
            print "            tr->profile = PROFILE_ES1;"
            print "        else"
            print "            tr->profile = PROFILE_ES2;"
            print "    }"
开发者ID:kalyankondapally,项目名称:apitrace,代码行数:17,代码来源:egltrace.py

示例5: traceFunctionImplBody

    def traceFunctionImplBody(self, function):
        if function.name in self.destroyContextFunctionNames:
            print '    gltrace::releaseContext((uintptr_t)ctx);'

        GlTracer.traceFunctionImplBody(self, function)

        if function.name in self.createContextFunctionNames:
            print '    if (_result != NULL)'
            print '        gltrace::createContext((uintptr_t)_result);'

        if function.name in self.makeCurrentFunctionNames:
            print '    if (_result) {'
            print '        if (ctx != NULL)'
            print '            gltrace::setContext((uintptr_t)ctx);'
            print '        else'
            print '            gltrace::clearContext();'
            print '    }'
开发者ID:wanderview,项目名称:apitrace,代码行数:17,代码来源:glxtrace.py

示例6: traceFunctionImplBody

    def traceFunctionImplBody(self, function):
        GlTracer.traceFunctionImplBody(self, function)

        if function.name == 'eglMakeCurrent':
            print '    // update the profile'
            print '    if (ctx != EGL_NO_CONTEXT) {'
            print '        EGLint api = EGL_OPENGL_ES_API, version = 1;'
            print '        gltrace::Context *tr = gltrace::getContext();'
            print '        __eglQueryContext(dpy, ctx, EGL_CONTEXT_CLIENT_TYPE, &api);'
            print '        __eglQueryContext(dpy, ctx, EGL_CONTEXT_CLIENT_VERSION, &version);'
            print '        if (api == EGL_OPENGL_API)'
            print '            tr->profile = gltrace::PROFILE_COMPAT;'
            print '        else if (version == 1)'
            print '            tr->profile = gltrace::PROFILE_ES1;'
            print '        else'
            print '            tr->profile = gltrace::PROFILE_ES2;'
            print '    }'
开发者ID:netconstructor,项目名称:apitrace,代码行数:17,代码来源:egltrace.py

示例7: traceFunctionImplBody

    def traceFunctionImplBody(self, function):
        GlTracer.traceFunctionImplBody(self, function)

        if function.name == "eglCreateContext":
            print "    if (_result != EGL_NO_CONTEXT)"
            print "        gltrace::createContext((uintptr_t)_result);"

        if function.name == "eglMakeCurrent":
            print "    if (_result) {"
            print "        // update the profile"
            print "        if (ctx != EGL_NO_CONTEXT) {"
            print "            EGLint api = EGL_OPENGL_ES_API, version = 1;"
            print "            gltrace::setContext((uintptr_t)ctx);"
            print "            gltrace::Context *tr = gltrace::getContext();"
            print "            _eglQueryContext(dpy, ctx, EGL_CONTEXT_CLIENT_TYPE, &api);"
            print "            _eglQueryContext(dpy, ctx, EGL_CONTEXT_CLIENT_VERSION, &version);"
            print "            if (api == EGL_OPENGL_API)"
            print "                tr->profile = gltrace::PROFILE_COMPAT;"
            print "            else if (version == 1)"
            print "                tr->profile = gltrace::PROFILE_ES1;"
            print "            else"
            print "                tr->profile = gltrace::PROFILE_ES2;"
            print "        } else {"
            print "            gltrace::clearContext();"
            print "        }"
            print "    }"

        if function.name == "eglDestroyContext":
            print "    if (_result) {"
            print "        gltrace::releaseContext((uintptr_t)ctx);"
            print "    }"

        if function.name == "glEGLImageTargetTexture2DOES":
            print "    image_info *info = _EGLImageKHR_get_image_info(target, image);"
            print "    if (info) {"
            print "        GLint level = 0;"
            print "        GLint internalformat = info->internalformat;"
            print "        GLsizei width = info->width;"
            print "        GLsizei height = info->height;"
            print "        GLint border = 0;"
            print "        GLenum format = info->format;"
            print "        GLenum type = info->type;"
            print "        const GLvoid * pixels = info->pixels;"
            self.emitFakeTexture2D()
            print "        _EGLImageKHR_free_image_info(info);"
            print "    }"
开发者ID:stroyan,项目名称:apitrace,代码行数:46,代码来源:egltrace.py

示例8: wrap_ret

    def wrap_ret(self, function, instance):
        GlTracer.wrap_ret(self, function, instance)

        if function.name == "wglGetProcAddress":
            print '    if (%s) {' % instance
        
            func_dict = dict([(f.name, f) for f in glapi.functions + wglapi.functions])

            def handle_case(function_name):
                f = func_dict[function_name]
                ptype = function_pointer_type(f)
                pvalue = function_pointer_value(f)
                print '    %s = (%s)%s;' % (pvalue, ptype, instance)
                print '    %s = (%s)&%s;' % (instance, function.type, f.name);
        
            def handle_default():
                print '    os::log("apitrace: warning: unknown function \\"%s\\"\\n", lpszProc);'

            string_switch('lpszProc', func_dict.keys(), handle_case, handle_default)
            print '    }'
开发者ID:kalyankondapally,项目名称:apitrace,代码行数:20,代码来源:wgltrace.py

示例9: wrap_ret

    def wrap_ret(self, function, instance):
        GlTracer.wrap_ret(self, function, instance)

        if function.name == "wglGetProcAddress":
            print "    if (%s) {" % instance

            func_dict = dict([(f.name, f) for f in glapi.functions + wglapi.functions])

            def handle_case(function_name):
                f = func_dict[function_name]
                ptype = function_pointer_type(f)
                pvalue = function_pointer_value(f)
                print "    %s = (%s)%s;" % (pvalue, ptype, instance)
                print "    %s = (%s)&%s;" % (instance, function.type, f.name)

            def handle_default():
                print '    OS::DebugMessage("apitrace: unknown function \\"%s\\"\\n", lpszProc);'

            string_switch("lpszProc", func_dict.keys(), handle_case, handle_default)
            print "    }"
开发者ID:mysticbob,项目名称:apitrace,代码行数:20,代码来源:wgltrace.py

示例10: traceFunctionImplBody

    def traceFunctionImplBody(self, function):
        if function.name.startswith('wgl'):
            # When implementing WGL extensions OpenGL ICDs often have no
            # alternative to calling back into OPENGL32.DLL's wgl* entry points
            # due to lack of extensibility in the ICD interface.  These
            # internal calls are not only visually confusing but can actually
            # cause problems when tracing, and replaying.  A particularly nasty
            # case is wglCreateContextAttribsARB which ends up calling
            # wglCreateContext/wglCreateLayerContext to obtain a HGLRC that's
            # recognizable by OPENGL32.DLL.  Therefore we need to detect and
            # dispatch internal calls, without further ado.
            print r'    if (_reentrant) {'
            self.invokeFunction(function)
            if function.type is not Void:
                print '    return _result;'
            print r'    }'
            print r'    ReentryScope _reentry;'
            print r'    (void)_reentry;'
            print

        if function.name in self.destroyContextFunctionNames:
            # Unlike other GL APIs like EGL or GLX, WGL will make the context
            # inactive if it's currently the active context.
            print '    if (_wglGetCurrentContext() == hglrc) {'
            print '        gltrace::clearContext();'
            print '    }'
            print '    gltrace::releaseContext((uintptr_t)hglrc);'

        GlTracer.traceFunctionImplBody(self, function)

        if function.name in self.createContextFunctionNames:
            print '    if (_result)'
            print '        gltrace::createContext((uintptr_t)_result);'

        if function.name in self.makeCurrentFunctionNames:
            print '    if (_result) {'
            print '        if (hglrc != NULL)'
            print '            gltrace::setContext((uintptr_t)hglrc);'
            print '        else'
            print '            gltrace::clearContext();'
            print '    }'
开发者ID:Acidburn0zzz,项目名称:apitrace,代码行数:41,代码来源:wgltrace.py

示例11: traceFunctionImplBody

    def traceFunctionImplBody(self, function):
        if function.name in self.destroyContextFunctionNames:
            # Unlike other GL APIs like EGL or GLX, WGL will make the context
            # inactive if it's currently the active context.
            print '    if (_wglGetCurrentContext() == hglrc) {'
            print '        gltrace::clearContext();'
            print '    }'
            print '    gltrace::releaseContext((uintptr_t)hglrc);'

        GlTracer.traceFunctionImplBody(self, function)

        if function.name in self.createContextFunctionNames:
            print '    if (_result)'
            print '        gltrace::createContext((uintptr_t)_result);'

        if function.name in self.makeCurrentFunctionNames:
            print '    if (_result) {'
            print '        if (hglrc != NULL)'
            print '            gltrace::setContext((uintptr_t)hglrc);'
            print '        else'
            print '            gltrace::clearContext();'
            print '    }'
开发者ID:RAOF,项目名称:apitrace,代码行数:22,代码来源:wgltrace.py

示例12: traceFunctionImplBody

    def traceFunctionImplBody(self, function):
        if function.name == "CGLReleaseContext":
            # Unlike other GL APIs like EGL or GLX, CGL will make the context
            # not current if it's the current context.
            print "    if (_CGLGetContextRetainCount(ctx) == 1) {"
            print "        if (gltrace::releaseContext((uintptr_t)ctx)) {"
            print "            if (_CGLGetCurrentContext() == ctx) {"
            print "                gltrace::clearContext();"
            print "            }"
            print "        }"
            print "    }"

        if function.name == "CGLDestroyContext":
            # The same rule applies here about the  as for CGLReleaseContext.
            print "    if (gltrace::releaseContext((uintptr_t)ctx)) {"
            print "        if (_CGLGetCurrentContext() == ctx) {"
            print "            gltrace::clearContext();"
            print "        }"
            print "    }"

        GlTracer.traceFunctionImplBody(self, function)

        if function.name == "CGLCreateContext":
            print "    if (_result == kCGLNoError) {"
            print "        gltrace::createContext((uintptr_t)*ctx);"
            print "    }"

        if function.name == "CGLSetCurrentContext":
            print "    if (_result == kCGLNoError) {"
            print "        if (ctx != NULL) {"
            print "            gltrace::setContext((uintptr_t)ctx);"
            print "        } else {"
            print "            gltrace::clearContext();"
            print "        }"
            print "    }"

        if function.name == "CGLRetainContext":
            print "    gltrace::retainContext((uintptr_t)ctx);"
开发者ID:elsonLee,项目名称:apitrace,代码行数:38,代码来源:cgltrace.py

示例13: wrap_ret

    def wrap_ret(self, function, instance):
        GlTracer.wrap_ret(self, function, instance)

        if function.name == "eglGetProcAddress":
            print "    %s = __unwrap_proc_addr(procname, %s);" % (instance, instance)
开发者ID:kalyankondapally,项目名称:apitrace,代码行数:5,代码来源:egltrace.py

示例14: wrapRet

    def wrapRet(self, function, instance):
        GlTracer.wrapRet(self, function, instance)

        if function.name in ("glXGetProcAddress", "glXGetProcAddressARB"):
            print '    %s = __unwrap_proc_addr(procName, %s);' % (instance, instance)
开发者ID:berkus,项目名称:apitrace,代码行数:5,代码来源:glxtrace.py

示例15: traceFunctionImplBody

    def traceFunctionImplBody(self, function):
        if function.name in self.destroyContextFunctionNames:
            print '    gltrace::releaseContext((uintptr_t)ctx);'

        GlTracer.traceFunctionImplBody(self, function)

        if function.name in self.createContextFunctionNames:
            print '    if (_result != NULL)'
            print '        gltrace::createContext((uintptr_t)_result);'

        if function.name in self.makeCurrentFunctionNames:
            print '    if (_result) {'
            print '        if (ctx != NULL)'
            print '            gltrace::setContext((uintptr_t)ctx);'
            print '        else'
            print '            gltrace::clearContext();'
            print '    }'

        if function.name == 'glXBindTexImageEXT':
            # FIXME: glXBindTexImageEXT gets called frequently, so we should
            # avoid recording the same data over and over again somehow, e.g.:
            # - get the pixels before and after glXBindTexImageEXT, and only
            #   emit emitFakeTexture2D when it changes
            # - keep a global hash of the pixels
            # FIXME: Handle mipmaps
            print r'''
                unsigned glx_target = 0;
                _glXQueryDrawable(display, drawable, GLX_TEXTURE_TARGET_EXT, &glx_target);
                GLenum target;
                switch (glx_target) {
                // FIXME
                //case GLX_TEXTURE_1D_EXT:
                //    target = GL_TEXTURE_1D;
                //    break;
                case GLX_TEXTURE_2D_EXT:
                    target = GL_TEXTURE_2D;
                    break;
                case GLX_TEXTURE_RECTANGLE_EXT:
                    target = GL_TEXTURE_RECTANGLE;
                    break;
                default:
                    os::log("apitrace: warning: %s: unsupported GLX_TEXTURE_TARGET_EXT 0x%u\n", __FUNCTION__, glx_target);
                    target = GL_NONE;
                    break;
                }
                GLint level = 0;
                GLint internalformat = GL_NONE;
                _glGetTexLevelParameteriv(target, level, GL_TEXTURE_INTERNAL_FORMAT, &internalformat);
                // XXX: GL_TEXTURE_INTERNAL_FORMAT cannot be trusted on NVIDIA
                // -- it sometimes returns GL_BGRA, even though GL_BGR/BGRA is
                // not a valid internal format.
                switch (internalformat) {
                case GL_BGR:
                    internalformat = GL_RGB;
                    break;
                case GL_BGRA:
                    internalformat = GL_RGBA;
                    break;
                }
                GLint width = 0;
                _glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &width);
                GLint height = 0;
                _glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &height);
                GLint border = 0;
                // XXX: We always use GL_RGBA format to read the pixels because:
                // - some implementations (Mesa) seem to return bogus results
                //   for GLX_TEXTURE_FORMAT_EXT
                // - hardware usually stores GL_RGB with 32bpp, so it should be
                //   faster to read/write
                // - it is more robust against GL_(UN)PACK_ALIGNMENT state
                //   changes
                // The drawback is that traces will be slightly bigger.
                GLenum format = GL_RGBA;
                GLenum type = GL_UNSIGNED_BYTE;
                if (target && internalformat && height && width) {
                    // FIXME: This assumes (UN)PACK state (in particular
                    // GL_(UN)PACK_ROW_LENGTH) is set to its defaults. We
                    // really should temporarily reset the state here (and emit
                    // according fake calls) to cope when its not. At very
                    // least we need a heads up warning that this will cause
                    // problems.
                    GLint alignment = 4;
                    GLint row_stride = _align(width * 4, alignment);
                    GLvoid * pixels = malloc(height * row_stride);
                    _glGetTexImage(target, level, format, type, pixels);
            '''
            self.emitFakeTexture2D()
            print r'''
开发者ID:PeterLValve,项目名称:apitrace,代码行数:88,代码来源:glxtrace.py


注:本文中的gltrace.GlTracer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。