示例#1
0
    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 "    }"
示例#2
0
    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 '    }'
示例#3
0
    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 '    }'
示例#4
0
    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>(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.extract_opaque_arg(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.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 '    }'
示例#5
0
    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)
示例#6
0
    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)