VirtualBox

Ignore:
Timestamp:
Jun 25, 2009 9:18:46 AM (15 years ago)
Author:
vboxsync
Message:

crOpenGL: fix memory corruption when querying for supported texture compression formats

Location:
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/get_components.py

    r20327 r20916  
    4040        'GL_TEXTURE_INTENSITY_SIZE': 1,
    4141        'GL_TEXTURE_COMPONENTS': 1,
    42         'GL_COMPRESSED_TEXTURE_FORMATS': 1,
    4342        'GL_TEXTURE_RESIDENT': 1
    4443}
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/get_sizes.py

    r20467 r20916  
    301301    'GL_POINT_SPRITE_ARB': (1, 'CR_ARB_point_sprite'),
    302302    'GL_MAX_TEXTURE_LOD_BIAS_EXT': (1, 'CR_EXT_texture_lod_bias'),
    303     'GL_COMPRESSED_TEXTURE_FORMATS_ARB': (1, 'CR_ARB_texture_compression'),
    304303    'GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB': (1, 'CR_ARB_texture_compression'),
    305304    'GL_PROGRAM_ERROR_POSITION_NV': (1, 'CR_NV_vertex_program'),
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_simpleget.py

    r15532 r20916  
    2727
    2828for index in range(len(funcs)):
    29         func_name = funcs[index]
    30         params = apiutil.Parameters(func_name)
    31         print 'void SERVER_DISPATCH_APIENTRY crServerDispatch%s( %s )' % ( func_name, apiutil.MakeDeclarationString(params))
    32         print '{'
    33         print '\t%s *get_values;' % types[index]
    34         print '\tint tablesize = __numValues( pname ) * sizeof(%s);' % types[index]
    35         print '\t(void) params;'
    36         print '\tget_values = (%s *) crAlloc( tablesize );' % types[index]
    37         print '\tcr_server.head_spu->dispatch_table.%s( pname, get_values );' % func_name
    38         print '\tcrServerReturnValue( get_values, tablesize );'
    39         print '\tcrFree(get_values);'
    40         print '}\n'
     29    func_name = funcs[index]
     30    params = apiutil.Parameters(func_name)
     31    print 'void SERVER_DISPATCH_APIENTRY crServerDispatch%s( %s )' % ( func_name, apiutil.MakeDeclarationString(params))
     32    print '{'
     33    print '\t%s *get_values;' % types[index]
     34    print '\tint tablesize;'
     35    print """
     36    #ifdef CR_ARB_texture_compression
     37    if (GL_COMPRESSED_TEXTURE_FORMATS_ARB == pname)
     38    {
     39        GLint numtexfmts = 0;
     40        cr_server.head_spu->dispatch_table.GetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, &numtexfmts);
     41        tablesize = numtexfmts * sizeof(%s);
     42    }
     43    else
     44    #endif
     45    {
     46        tablesize = __numValues( pname ) * sizeof(%s);
     47    }
     48    """ % (types[index], types[index])
     49    print '\t(void) params;'
     50    print '\tget_values = (%s *) crAlloc( tablesize );' % types[index]
     51    print '\tcr_server.head_spu->dispatch_table.%s( pname, get_values );' % func_name
     52    print '\tcrServerReturnValue( get_values, tablesize );'
     53    print '\tcrFree(get_values);'
     54    print '}\n'
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette