• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python retrace.Retracer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: extractArg

    def extractArg(self, function, arg, arg_type, lvalue, rvalue):
        if function.name in self.array_pointer_function_names and arg.name == 'pointer':
            print '    %s = static_cast<%s>(retrace::toPointer(%s, true));' % (lvalue, arg_type, rvalue)
            return

        if function.name in self.draw_elements_function_names and arg.name == 'indices' or\
           function.name in self.draw_indirect_function_names and arg.name == 'indirect':
            self.extractOpaqueArg(function, arg, arg_type, lvalue, rvalue)
            return

        # Handle pointer with offsets into the current pack pixel buffer
        # object.
        if function.name in self.pack_function_names and arg.output:
            self.extractOpaqueArg(function, arg, arg_type, lvalue, rvalue)
            return

        if arg.type is glapi.GLlocation \
           and 'program' not in function.argNames():
            print '    GLint program = -1;'
            print '    glGetIntegerv(GL_CURRENT_PROGRAM, &program);'
        
        if arg.type is glapi.GLlocationARB \
           and 'programObj' not in function.argNames():
            print '    GLhandleARB programObj = glGetHandleARB(GL_PROGRAM_OBJECT_ARB);'

        Retracer.extractArg(self, function, arg, arg_type, lvalue, rvalue)

        # Don't try to use more samples than the implementation supports
        if arg.name == 'samples':
            assert arg.type is glapi.GLsizei
            print '    GLint max_samples = 0;'
            print '    glGetIntegerv(GL_MAX_SAMPLES, &max_samples);'
            print '    if (samples > max_samples) {'
            print '        samples = max_samples;'
            print '    }'
开发者ID:berkus,项目名称:apitrace,代码行数:35,代码来源:glretrace.py


示例2: retraceApi

    def retraceApi(self, api):
        print '''
static HINSTANCE g_hDll = NULL;

static PROC
__getPublicProcAddress(LPCSTR lpProcName)
{
    if (!g_hDll) {
        char szDll[MAX_PATH] = {0};
        
        if (!GetSystemDirectoryA(szDll, MAX_PATH)) {
            return NULL;
        }
        
        strcat(szDll, "\\\\%s");
        
        g_hDll = LoadLibraryA(szDll);
        if (!g_hDll) {
            return NULL;
        }
    }
        
    return GetProcAddress(g_hDll, lpProcName);
}

''' % api.name

        dispatcher = Dispatcher()
        dispatcher.dispatch_api(api)

        Retracer.retraceApi(self, api)
开发者ID:netconstructor,项目名称:apitrace,代码行数:31,代码来源:dllretrace.py


示例3: call_function

    def call_function(self, function):
        if function.name == "glViewport":
            print '    bool reshape_window = false;'
            print '    if (x + width > glretrace::window_width) {'
            print '        glretrace::window_width = x + width;'
            print '        reshape_window = true;'
            print '    }'
            print '    if (y + height > glretrace::window_height) {'
            print '        glretrace::window_height = y + height;'
            print '        reshape_window = true;'
            print '    }'
            print '    if (reshape_window) {'
            print '        // XXX: does not always work'
            print '        glretrace::drawable->resize(glretrace::window_width, glretrace::window_height);'
            print '        reshape_window = false;'
            print '    }'

        if function.name == "glEnd":
            print '    glretrace::insideGlBeginEnd = false;'
        
        Retracer.call_function(self, function)

        if function.name == "glBegin":
            print '    glretrace::insideGlBeginEnd = true;'
        else:
            # glGetError is not allowed inside glBegin/glEnd
            print '    glretrace::checkGlError();'
开发者ID:bgirard,项目名称:apitrace,代码行数:27,代码来源:glretrace.py


示例4: extract_arg

    def extract_arg(self, function, arg, arg_type, lvalue, rvalue):
        if function.name in self.array_pointer_function_names and arg.name == "pointer":
            print "    %s = static_cast<%s>(%s.toPointer());" % (lvalue, arg_type, rvalue)
            return

        if function.name in self.draw_elements_function_names and arg.name == "indices":
            self.extract_opaque_arg(function, arg, arg_type, lvalue, rvalue)
            return

        if arg.type is glapi.GLlocation and "program" not in [arg.name for arg in function.args]:
            print "    GLint program = -1;"
            print "    glGetIntegerv(GL_CURRENT_PROGRAM, &program);"

        if arg.type is glapi.GLlocationARB and "programObj" not in [arg.name for arg in function.args]:
            print "    GLhandleARB programObj = glGetHandleARB(GL_PROGRAM_OBJECT_ARB);"

        Retracer.extract_arg(self, function, arg, arg_type, lvalue, rvalue)

        # Don't try to use more samples than the implementation supports
        if arg.name == "samples":
            assert arg.type is glapi.GLsizei
            print "    GLint max_samples = 0;"
            print "    glGetIntegerv(GL_MAX_SAMPLES, &max_samples);"
            print "    if (samples > max_samples) {"
            print "        samples = max_samples;"
            print "    }"
开发者ID:pzick,项目名称:apitrace,代码行数:26,代码来源:glretrace.py


示例5: call_function

    def call_function(self, function):
        if function.name == "glViewport":
            print '    bool reshape_window = false;'
            print '    if (x + width > glretrace::window_width) {'
            print '        glretrace::window_width = x + width;'
            print '        reshape_window = true;'
            print '    }'
            print '    if (y + height > glretrace::window_height) {'
            print '        glretrace::window_height = y + height;'
            print '        reshape_window = true;'
            print '    }'
            print '    if (reshape_window) {'
            print '        // XXX: does not always work'
            print '        glretrace::drawable->resize(glretrace::window_width, glretrace::window_height);'
            print '        reshape_window = false;'
            print '    }'

        if function.name == "glEnd":
            print '    glretrace::insideGlBeginEnd = false;'
        
        Retracer.call_function(self, function)

        if function.name == "glBegin":
            print '    glretrace::insideGlBeginEnd = true;'
        elif function.name.startswith('gl'):
            # glGetError is not allowed inside glBegin/glEnd
            print '    glretrace::checkGlError(call.no);'

        if function.name == 'glFlush':
            print '    if (!glretrace::double_buffer) {'
            print '        glretrace::frame_complete(call.no);'
            print '    }'
开发者ID:mariuz,项目名称:apitrace,代码行数:32,代码来源:glretrace.py


示例6: extract_arg

    def extract_arg(self, function, arg, arg_type, lvalue, rvalue):
        if function.name in self.array_pointer_function_names and arg.name == 'pointer':
            print '    %s = static_cast<%s>(%s.toPointer());' % (lvalue, arg_type, rvalue)
            return

        if function.name in self.draw_elements_function_names and arg.name == 'indices':
            print '    %s = %s.toPointer();' % (lvalue, rvalue)
            return

        if arg.type is glapi.GLlocation \
           and 'program' not in [arg.name for arg in function.args]:
            print '    GLint program = -1;'
            print '    glGetIntegerv(GL_CURRENT_PROGRAM, &program);'
        
        if arg.type is glapi.GLlocationARB \
           and 'programObj' not in [arg.name for arg in function.args]:
            print '    GLhandleARB programObj = glGetHandleARB(GL_PROGRAM_OBJECT_ARB);'

        Retracer.extract_arg(self, function, arg, arg_type, lvalue, rvalue)

        # Don't try to use more samples than the implementation supports
        if arg.name == 'samples':
            assert arg.type is glapi.GLsizei
            print '    GLint max_samples = 0;'
            print '    glGetIntegerv(GL_MAX_SAMPLES, &max_samples);'
            print '    if (samples > max_samples) {'
            print '        samples = max_samples;'
            print '    }'
开发者ID:mysticbob,项目名称:apitrace,代码行数:28,代码来源:glretrace.py


示例7: retrace_function_body

    def retrace_function_body(self, function):
        is_array_pointer = function.name in self.array_pointer_function_names
        is_draw_array = function.name in self.draw_array_function_names
        is_draw_elements = function.name in self.draw_elements_function_names

        if is_array_pointer or is_draw_array or is_draw_elements:
            print '    if (glretrace::parser.version < 1) {'

            if is_array_pointer or is_draw_array:
                print '        GLint __array_buffer = 0;'
                print '        glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &__array_buffer);'
                print '        if (!__array_buffer) {'
                self.fail_function(function)
                print '        }'

            if is_draw_elements:
                print '        GLint __element_array_buffer = 0;'
                print '        glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &__element_array_buffer);'
                print '        if (!__element_array_buffer) {'
                self.fail_function(function)
                print '        }'
            
            print '    }'

        Retracer.retrace_function_body(self, function)

        if function.name in ('glFlush', 'glFinish'):
            print '    if (!glretrace::double_buffer) {'
            print '        glretrace::frame_complete(call.no);'
            print '    }'

        if function.name == 'glReadPixels':
            print '    glFinish();'
            print '    glretrace::snapshot(call.no);'
开发者ID:mysticbob,项目名称:apitrace,代码行数:34,代码来源:glretrace.py


示例8: retrace_function_body

    def retrace_function_body(self, function):
        is_array_pointer = function.name in self.array_pointer_function_names
        is_draw_array = function.name in self.draw_array_function_names
        is_draw_elements = function.name in self.draw_elements_function_names

        if is_array_pointer or is_draw_array or is_draw_elements:
            print '    if (Trace::Parser::version < 1) {'

            if is_array_pointer or is_draw_array:
                print '        GLint __array_buffer = 0;'
                print '        glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &__array_buffer);'
                print '        if (!__array_buffer) {'
                self.fail_function(function)
                print '        }'

            if is_draw_elements:
                print '        GLint __element_array_buffer = 0;'
                print '        glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &__element_array_buffer);'
                print '        if (!__element_array_buffer) {'
                self.fail_function(function)
                print '        }'
            
            print '    }'

        Retracer.retrace_function_body(self, function)
开发者ID:bgirard,项目名称:apitrace,代码行数:25,代码来源:glretrace.py


示例9: retrace_function_body

    def retrace_function_body(self, function):
        is_array_pointer = function.name in self.array_pointer_function_names
        is_draw_array = function.name in self.draw_array_function_names
        is_draw_elements = function.name in self.draw_elements_function_names
        is_misc_draw = function.name in self.misc_draw_function_names

        if is_array_pointer or is_draw_array or is_draw_elements:
            print "    if (glretrace::parser.version < 1) {"

            if is_array_pointer or is_draw_array:
                print "        GLint __array_buffer = 0;"
                print "        glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &__array_buffer);"
                print "        if (!__array_buffer) {"
                self.fail_function(function)
                print "        }"

            if is_draw_elements:
                print "        GLint __element_array_buffer = 0;"
                print "        glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &__element_array_buffer);"
                print "        if (!__element_array_buffer) {"
                self.fail_function(function)
                print "        }"

            print "    }"

        # When no pack buffer object is bound, the pack functions are no-ops.
        if function.name in self.pack_function_names:
            print "    GLint __pack_buffer = 0;"
            print "    glGetIntegerv(GL_PIXEL_PACK_BUFFER_BINDING, &__pack_buffer);"
            print "    if (!__pack_buffer) {"
            if function.name == "glReadPixels":
                print "    glFinish();"
                print "    if (glretrace::snapshot_frequency == glretrace::FREQUENCY_FRAME ||"
                print "        glretrace::snapshot_frequency == glretrace::FREQUENCY_FRAMEBUFFER) {"
                print "        glretrace::snapshot(call.no);"
                print "    }"
            print "        return;"
            print "    }"

        # Pre-snapshots
        if function.name in self.bind_framebuffer_function_names:
            print "    if (glretrace::snapshot_frequency == glretrace::FREQUENCY_FRAMEBUFFER) {"
            print "        glretrace::snapshot(call.no - 1);"
            print "    }"
        if function.name == "glFrameTerminatorGREMEDY":
            print "    glretrace::frame_complete(call);"
            return

        Retracer.retrace_function_body(self, function)

        # Post-snapshots
        if function.name in ("glFlush", "glFinish"):
            print "    if (!glretrace::double_buffer) {"
            print "        glretrace::frame_complete(call);"
            print "    }"
        if is_draw_array or is_draw_elements or is_misc_draw:
            print "    if (glretrace::snapshot_frequency == glretrace::FREQUENCY_DRAW) {"
            print "        glretrace::snapshot(call.no);"
            print "    }"
开发者ID:rawoul,项目名称:apitrace,代码行数:59,代码来源:glretrace.py


示例10: extractArg

    def extractArg(self, function, arg, arg_type, lvalue, rvalue):
        if function.name in self.array_pointer_function_names and arg.name == 'pointer':
            print '    %s = static_cast<%s>(retrace::toPointer(%s, true));' % (lvalue, arg_type, rvalue)
            return

        if function.name in self.draw_elements_function_names and arg.name == 'indices' or\
           function.name in self.draw_indirect_function_names and arg.name == 'indirect':
            self.extractOpaqueArg(function, arg, arg_type, lvalue, rvalue)
            return

        # Handle pointer with offsets into the current pack pixel buffer
        # object.
        if function.name in self.pack_function_names and arg.output:
            assert isinstance(arg_type, (stdapi.Pointer, stdapi.Array, stdapi.Blob, stdapi.Opaque))
            print '    %s = static_cast<%s>((%s).toPointer());' % (lvalue, arg_type, rvalue)
            return

        if arg.type is glapi.GLlocation \
           and 'program' not in function.argNames():
            # Determine the active program for uniforms swizzling
            print '    GLint program = -1;'
            print '    if (glretrace::insideList) {'
            print '        // glUseProgram & glUseProgramObjectARB are display-list-able'
            print r'    glretrace::Context *currentContext = glretrace::getCurrentContext();'
            print '        program = _program_map[currentContext->activeProgram];'
            print '    } else {'
            print '        GLint pipeline = 0;'
            print '        if (_pipelineHasBeenBound) {'
            print '            glGetIntegerv(GL_PROGRAM_PIPELINE_BINDING, &pipeline);'
            print '        }'
            print '        if (pipeline) {'
            print '            glGetProgramPipelineiv(pipeline, GL_ACTIVE_PROGRAM, &program);'
            print '        } else {'
            print '            glGetIntegerv(GL_CURRENT_PROGRAM, &program);'
            print '        }'
            print '    }'
            print

        if arg.type is glapi.GLlocationARB \
           and 'programObj' not in function.argNames():
            print '    GLhandleARB programObj = glGetHandleARB(GL_PROGRAM_OBJECT_ARB);'

        Retracer.extractArg(self, function, arg, arg_type, lvalue, rvalue)

        # Don't try to use more samples than the implementation supports
        if arg.name == 'samples':
            assert arg.type is glapi.GLsizei
            print '    GLint max_samples = 0;'
            print '    glGetIntegerv(GL_MAX_SAMPLES, &max_samples);'
            print '    if (samples > max_samples) {'
            print '        samples = max_samples;'
            print '    }'

        # These parameters are referred beyond the call life-time
        # TODO: Replace ad-hoc solution for bindable parameters with general one
        if function.name in ('glFeedbackBuffer', 'glSelectBuffer') and arg.output:
            print '    _allocator.bind(%s);' % arg.name
开发者ID:Hsaniva,项目名称:apitrace,代码行数:57,代码来源:glretrace.py


示例11: retraceApi

    def retraceApi(self, api):
        # Ensure pack function have side effects
        abort = False
        for function in api.getAllFunctions():
            if not function.sideeffects and self.pack_function_regex.match(function.name):
                sys.stderr.write('error: function %s must have sideeffects\n' % function.name)
                abort = True
        if abort:
            sys.exit(1)

        Retracer.retraceApi(self, api)
开发者ID:devedse,项目名称:apitrace,代码行数:11,代码来源:glretrace.py


示例12: retraceFunctionBody

    def retraceFunctionBody(self, function):
        is_array_pointer = function.name in self.array_pointer_function_names
        is_draw_arrays = self.draw_arrays_function_regex.match(function.name) is not None
        is_draw_elements = self.draw_elements_function_regex.match(function.name) is not None
        is_draw_indirect = self.draw_indirect_function_regex.match(function.name) is not None
        is_misc_draw = self.misc_draw_function_regex.match(function.name)

        # For backwards compatibility with old traces where non VBO drawing was supported
        if (is_array_pointer or is_draw_arrays or is_draw_elements) and not is_draw_indirect:
            print '    if (retrace::parser->getVersion() < 1) {'

            if is_array_pointer or is_draw_arrays:
                print '        GLint _array_buffer = 0;'
                print '        glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &_array_buffer);'
                print '        if (!_array_buffer) {'
                self.failFunction(function)
                print '        }'

            if is_draw_elements:
                print '        GLint _element_array_buffer = 0;'
                print '        glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &_element_array_buffer);'
                print '        if (!_element_array_buffer) {'
                self.failFunction(function)
                print '        }'
            
            print '    }'

        # When no pack buffer object is bound, the pack functions are no-ops.
        if self.pack_function_regex.match(function.name):
            print '    GLint _pack_buffer = 0;'
            print '    glGetIntegerv(GL_PIXEL_PACK_BUFFER_BINDING, &_pack_buffer);'
            print '    if (!_pack_buffer) {'
            print '        return;'
            print '    }'

        # Pre-snapshots
        if self.bind_framebuffer_function_regex.match(function.name):
            print '    assert(call.flags & trace::CALL_FLAG_SWAP_RENDERTARGET);'
        if function.name == 'glStringMarkerGREMEDY':
            return
        if function.name == 'glFrameTerminatorGREMEDY':
            print '    glretrace::frame_complete(call);'
            return

        Retracer.retraceFunctionBody(self, function)

        # Post-snapshots
        if function.name in ('glFlush', 'glFinish'):
            print '    if (!retrace::doubleBuffer) {'
            print '        glretrace::frame_complete(call);'
            print '    }'
        if is_draw_arrays or is_draw_elements or is_misc_draw:
            print '    assert(call.flags & trace::CALL_FLAG_RENDER);'
开发者ID:devedse,项目名称:apitrace,代码行数:53,代码来源:glretrace.py


示例13: extractArg

    def extractArg(self, function, arg, arg_type, lvalue, rvalue):
        if function.name in self.array_pointer_function_names and arg.name == 'pointer':
            print '    %s = static_cast<%s>(retrace::toPointer(%s, true));' % (lvalue, arg_type, rvalue)
            return

        if self.draw_elements_function_regex.match(function.name) and arg.name == 'indices' or\
           self.draw_indirect_function_regex.match(function.name) and arg.name == 'indirect':
            self.extractOpaqueArg(function, arg, arg_type, lvalue, rvalue)
            return

        # Handle pointer with offsets into the current pack pixel buffer
        # object.
        if self.pack_function_regex.match(function.name) and arg.output:
            assert isinstance(arg_type, (stdapi.Pointer, stdapi.Array, stdapi.Blob, stdapi.Opaque))
            print '    %s = static_cast<%s>((%s).toPointer());' % (lvalue, arg_type, rvalue)
            return
        if function.name.startswith('glGetQueryObject') and arg.output:
            print '    %s = static_cast<%s>((%s).toPointer());' % (lvalue, arg_type, rvalue)
            return

        if (arg.type.depends(glapi.GLlocation) or \
            arg.type.depends(glapi.GLsubroutine)) \
           and 'program' not in function.argNames():
            # Determine the active program for uniforms swizzling
            print '    GLint program = _getActiveProgram();'

        if arg.type is glapi.GLlocationARB \
           and 'programObj' not in function.argNames():
            print '    GLhandleARB programObj = glGetHandleARB(GL_PROGRAM_OBJECT_ARB);'

        Retracer.extractArg(self, function, arg, arg_type, lvalue, rvalue)

        # Don't try to use more samples than the implementation supports
        if arg.name == 'samples':
            if function.name == 'glRasterSamplesEXT':
                assert arg.type is glapi.GLuint
                print '    GLint max_samples = 0;'
                print '    glGetIntegerv(GL_MAX_RASTER_SAMPLES_EXT, &max_samples);'
                print '    if (samples > static_cast<GLuint>(max_samples)) {'
                print '        samples = static_cast<GLuint>(max_samples);'
                print '    }'
            else:
                assert arg.type is glapi.GLsizei
                print '    GLint max_samples = 0;'
                print '    glGetIntegerv(GL_MAX_SAMPLES, &max_samples);'
                print '    if (samples > max_samples) {'
                print '        samples = max_samples;'
                print '    }'

        # These parameters are referred beyond the call life-time
        # TODO: Replace ad-hoc solution for bindable parameters with general one
        if function.name in ('glFeedbackBuffer', 'glSelectBuffer') and arg.output:
            print '    _allocator.bind(%s);' % arg.name
开发者ID:janesma,项目名称:apitrace,代码行数:53,代码来源:glretrace.py


示例14: extractArg

    def extractArg(self, function, arg, arg_type, lvalue, rvalue):
        if function.name in self.array_pointer_function_names and arg.name == "pointer":
            print "    %s = static_cast<%s>(retrace::toPointer(%s, true));" % (lvalue, arg_type, rvalue)
            return

        if (
            function.name in self.draw_elements_function_names
            and arg.name == "indices"
            or function.name in self.draw_indirect_function_names
            and arg.name == "indirect"
        ):
            self.extractOpaqueArg(function, arg, arg_type, lvalue, rvalue)
            return

        # Handle pointer with offsets into the current pack pixel buffer
        # object.
        if function.name in self.pack_function_names and arg.output:
            assert isinstance(arg_type, (stdapi.Pointer, stdapi.Array, stdapi.Blob, stdapi.Opaque))
            print "    %s = static_cast<%s>((%s).toPointer());" % (lvalue, arg_type, rvalue)
            return

        if arg.type is glapi.GLlocation and "program" not in function.argNames():
            # Determine the active program for uniforms swizzling
            print "    GLint program = -1;"
            print "    GLint pipeline = 0;"
            print "    if (_pipelineHasBeenBound) {"
            print "        glGetIntegerv(GL_PROGRAM_PIPELINE_BINDING, &pipeline);"
            print "    }"
            print "    if (pipeline) {"
            print "        glGetProgramPipelineiv(pipeline, GL_ACTIVE_PROGRAM, &program);"
            print "    } else {"
            print "        glGetIntegerv(GL_CURRENT_PROGRAM, &program);"
            print "    }"
            print

        if arg.type is glapi.GLlocationARB and "programObj" not in function.argNames():
            print "    GLhandleARB programObj = glGetHandleARB(GL_PROGRAM_OBJECT_ARB);"

        Retracer.extractArg(self, function, arg, arg_type, lvalue, rvalue)

        # Don't try to use more samples than the implementation supports
        if arg.name == "samples":
            assert arg.type is glapi.GLsizei
            print "    GLint max_samples = 0;"
            print "    glGetIntegerv(GL_MAX_SAMPLES, &max_samples);"
            print "    if (samples > max_samples) {"
            print "        samples = max_samples;"
            print "    }"

        # These parameters are referred beyond the call life-time
        # TODO: Replace ad-hoc solution for bindable parameters with general one
        if function.name in ("glFeedbackBuffer", "glSelectBuffer") and arg.output:
            print "    _allocator.bind(%s);" % arg.name
开发者ID:solochang,项目名称:apitrace,代码行数:53,代码来源:glretrace.py


示例15: retraceFunctionBody

    def retraceFunctionBody(self, function):
        is_array_pointer = function.name in self.array_pointer_function_names
        is_draw_array = function.name in self.draw_array_function_names
        is_draw_elements = function.name in self.draw_elements_function_names
        is_misc_draw = function.name in self.misc_draw_function_names

        if is_array_pointer or is_draw_array or is_draw_elements:
            print '    if (retrace::parser.version < 1) {'

            if is_array_pointer or is_draw_array:
                print '        GLint _array_buffer = 0;'
                print '        glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &_array_buffer);'
                print '        if (!_array_buffer) {'
                self.failFunction(function)
                print '        }'

            if is_draw_elements:
                print '        GLint _element_array_buffer = 0;'
                print '        glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &_element_array_buffer);'
                print '        if (!_element_array_buffer) {'
                self.failFunction(function)
                print '        }'
            
            print '    }'

        # When no pack buffer object is bound, the pack functions are no-ops.
        if function.name in self.pack_function_names:
            print '    GLint _pack_buffer = 0;'
            print '    glGetIntegerv(GL_PIXEL_PACK_BUFFER_BINDING, &_pack_buffer);'
            print '    if (!_pack_buffer) {'
            print '        return;'
            print '    }'

        # Pre-snapshots
        if function.name in self.bind_framebuffer_function_names:
            print '    assert(call.flags & trace::CALL_FLAG_SWAP_RENDERTARGET);'
        if function.name == 'glStringMarkerGREMEDY':
            return
        if function.name == 'glFrameTerminatorGREMEDY':
            print '    glretrace::frame_complete(call);'
            return

        Retracer.retraceFunctionBody(self, function)

        # Post-snapshots
        if function.name in ('glFlush', 'glFinish'):
            print '    if (!retrace::doubleBuffer) {'
            print '        glretrace::frame_complete(call);'
            print '    }'
        if is_draw_array or is_draw_elements or is_misc_draw:
            print '    assert(call.flags & trace::CALL_FLAG_RENDER);'
开发者ID:Acidburn0zzz,项目名称:apitrace,代码行数:51,代码来源:glretrace.py


示例16: extract_arg

    def extract_arg(self, function, arg, arg_type, lvalue, rvalue):
        if function.name in self.array_pointer_function_names and arg.name == 'pointer':
            print '    %s = %s.blob();' % (lvalue, rvalue)
            return

        if function.name in self.draw_elements_function_names and arg.name == 'indices':
            print '    %s = %s.blob();' % (lvalue, rvalue)
            return

        if function.name.startswith('glUniform') and function.args[0].name == arg.name == 'location':
            print '    GLint program = -1;'
            print '    glGetIntegerv(GL_CURRENT_PROGRAM, &program);'

        Retracer.extract_arg(self, function, arg, arg_type, lvalue, rvalue)
开发者ID:bgirard,项目名称:apitrace,代码行数:14,代码来源:glretrace.py


示例17: extractArg

    def extractArg(self, function, arg, arg_type, lvalue, rvalue):
        if function.name in self.array_pointer_function_names and arg.name == 'pointer':
            print '    %s = static_cast<%s>(retrace::toPointer(%s, true));' % (lvalue, arg_type, rvalue)
            return

        if function.name in self.draw_elements_function_names and arg.name == 'indices' or\
           function.name in self.draw_indirect_function_names and arg.name == 'indirect':
            self.extractOpaqueArg(function, arg, arg_type, lvalue, rvalue)
            return

        # Handle pointer with offsets into the current pack pixel buffer
        # object.
        if function.name in self.pack_function_names and arg.output:
            assert isinstance(arg_type, (stdapi.Pointer, stdapi.Array, stdapi.Blob, stdapi.Opaque))
            print '    %s = static_cast<%s>((%s).toPointer());' % (lvalue, arg_type, rvalue)
            return

        if arg.type is glapi.GLlocation \
           and 'program' not in function.argNames():
            print '    GLint program = -1;'
            print '    glGetIntegerv(GL_CURRENT_PROGRAM, &program);'
        
        if arg.type is glapi.GLlocationARB \
           and 'programObj' not in function.argNames():
            print '    GLhandleARB programObj = glGetHandleARB(GL_PROGRAM_OBJECT_ARB);'

        Retracer.extractArg(self, function, arg, arg_type, lvalue, rvalue)

        # Don't try to use more samples than the implementation supports
        if arg.name == 'samples':
            assert arg.type is glapi.GLsizei
            print '    GLint max_samples = 0;'
            print '    glGetIntegerv(GL_MAX_SAMPLES, &max_samples);'
            print '    if (samples > max_samples) {'
            print '        samples = max_samples;'
            print '    }'

        # These parameters are referred beyond the call life-time
        # TODO: Replace ad-hoc solution for bindable parameters with general one
        if function.name in ('glFeedbackBuffer', 'glSelectBuffer') and arg.output:
            print '    _allocator.bind(%s);' % arg.name
开发者ID:netconstructor,项目名称:apitrace,代码行数:41,代码来源:glretrace.py


示例18: invokeFunction

    def invokeFunction(self, function):
        # Infer the drawable size from GL calls
        if function.name == "glViewport":
            print '    glretrace::updateDrawable(x + width, y + height);'
        if function.name == "glViewportArray":
            # We are concerned about drawables so only care for the first viewport
            print '    if (first == 0 && count > 0) {'
            print '        GLfloat x = v[0], y = v[1], w = v[2], h = v[3];'
            print '        glretrace::updateDrawable(x + w, y + h);'
            print '    }'
        if function.name == "glViewportIndexedf":
            print '    if (index == 0) {'
            print '        glretrace::updateDrawable(x + w, y + h);'
            print '    }'
        if function.name == "glViewportIndexedfv":
            print '    if (index == 0) {'
            print '        GLfloat x = v[0], y = v[1], w = v[2], h = v[3];'
            print '        glretrace::updateDrawable(x + w, y + h);'
            print '    }'
        if function.name in ('glBlitFramebuffer', 'glBlitFramebufferEXT'):
            # Some applications do all their rendering in a framebuffer, and
            # then just blit to the drawable without ever calling glViewport.
            print '    glretrace::updateDrawable(std::max(dstX0, dstX1), std::max(dstY0, dstY1));'

        if function.name == "glEnd":
            print '    glretrace::insideGlBeginEnd = false;'

        if function.name.startswith('gl') and not function.name.startswith('glX'):
            print r'    if (!glretrace::context && !glretrace::benchmark && !retrace::profiling) {'
            print r'        retrace::warning(call) << "no current context\n";'
            print r'    }'

        if function.name == 'memcpy':
            print '    if (!dest || !src || !n) return;'

        # Destroy the buffer mapping
        if function.name in self.unmap_function_names:
            print r'        GLvoid *ptr = NULL;'
            if function.name == 'glUnmapBuffer':
                print r'            glGetBufferPointerv(target, GL_BUFFER_MAP_POINTER, &ptr);'
            elif function.name == 'glUnmapBufferARB':
                print r'            glGetBufferPointervARB(target, GL_BUFFER_MAP_POINTER_ARB, &ptr);'
            elif function.name == 'glUnmapBufferOES':
                print r'            glGetBufferPointervOES(target, GL_BUFFER_MAP_POINTER_OES, &ptr);'
            elif function.name == 'glUnmapNamedBufferEXT':
                print r'            glGetNamedBufferPointervEXT(buffer, GL_BUFFER_MAP_POINTER, &ptr);'
            elif function.name == 'glUnmapObjectBufferATI':
                # TODO
                pass
            else:
                assert False
            print r'        if (ptr) {'
            print r'            retrace::delRegionByPointer(ptr);'
            print r'        } else {'
            print r'            retrace::warning(call) << "no current context\n";'
            print r'        }'
        
        Retracer.invokeFunction(self, function)

        # Error checking
        if function.name == "glBegin":
            print '    glretrace::insideGlBeginEnd = true;'
        elif function.name.startswith('gl'):
            # glGetError is not allowed inside glBegin/glEnd
            print '    if (!glretrace::benchmark && !retrace::profiling && !glretrace::insideGlBeginEnd) {'
            print '        glretrace::checkGlError(call);'
            if function.name in ('glProgramStringARB', 'glProgramStringNV'):
                print r'        GLint error_position = -1;'
                print r'        glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &error_position);'
                print r'        if (error_position != -1) {'
                print r'            const char *error_string = (const char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB);'
                print r'            retrace::warning(call) << error_string << "\n";'
                print r'        }'
            if function.name == 'glCompileShader':
                print r'        GLint compile_status = 0;'
                print r'        glGetShaderiv(shader, GL_COMPILE_STATUS, &compile_status);'
                print r'        if (!compile_status) {'
                print r'             GLint info_log_length = 0;'
                print r'             glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &info_log_length);'
                print r'             GLchar *infoLog = new GLchar[info_log_length];'
                print r'             glGetShaderInfoLog(shader, info_log_length, NULL, infoLog);'
                print r'             retrace::warning(call) << infoLog << "\n";'
                print r'             delete [] infoLog;'
                print r'        }'
            if function.name == 'glLinkProgram':
                print r'        GLint link_status = 0;'
                print r'        glGetProgramiv(program, GL_LINK_STATUS, &link_status);'
                print r'        if (!link_status) {'
                print r'             GLint info_log_length = 0;'
                print r'             glGetProgramiv(program, GL_INFO_LOG_LENGTH, &info_log_length);'
                print r'             GLchar *infoLog = new GLchar[info_log_length];'
                print r'             glGetProgramInfoLog(program, info_log_length, NULL, infoLog);'
                print r'             retrace::warning(call) << infoLog << "\n";'
                print r'             delete [] infoLog;'
                print r'        }'
            if function.name == 'glCompileShaderARB':
                print r'        GLint compile_status = 0;'
                print r'        glGetObjectParameterivARB(shaderObj, GL_OBJECT_COMPILE_STATUS_ARB, &compile_status);'
                print r'        if (!compile_status) {'
                print r'             GLint info_log_length = 0;'
#.........这里部分代码省略.........
开发者ID:netconstructor,项目名称:apitrace,代码行数:101,代码来源:glretrace.py


示例19: call_function

    def call_function(self, function):
        # Infer the drawable size from GL calls
        if function.name == "glViewport":
            print "    glretrace::updateDrawable(x + width, y + height);"
        if function.name in ("glBlitFramebuffer", "glBlitFramebufferEXT"):
            # Some applications do all their rendering in a framebuffer, and
            # then just blit to the drawable without ever calling glViewport.
            print "    glretrace::updateDrawable(std::max(dstX0, dstX1), std::max(dstY0, dstY1));"

        if function.name == "glEnd":
            print "    glretrace::insideGlBeginEnd = false;"

        if function.name == "memcpy":
            print "    if (!dest || !src || !n) return;"

        Retracer.call_function(self, function)

        # Error checking
        if function.name == "glBegin":
            print "    glretrace::insideGlBeginEnd = true;"
        elif function.name.startswith("gl"):
            # glGetError is 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python models.Engine类代码示例发布时间:2022-05-26
下一篇:
Python rethinkdb.table_list函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap