VirtualBox

Changeset 21308 in vbox for trunk/src/VBox/HostServices


Ignore:
Timestamp:
Jul 7, 2009 10:49:52 AM (16 years ago)
Author:
vboxsync
Message:

crOpenGL: use host side VBO when possible

Location:
trunk/src/VBox/HostServices/SharedOpenGL
Files:
6 edited

Legend:

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

    r20916 r21308  
    403403            return temp->num_values;
    404404    }
    405     crWarning( "Invalid pname to __numValues: 0x%x\\n", (int) pname );
     405    crDebug( "Invalid pname to __numValues: 0x%x\\n", (int) pname );
    406406    return 0;
    407407}
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_simpleget.py

    r21033 r21308  
    4949    print '\t(void) params;'
    5050    print '\tget_values = (%s *) crAlloc( tablesize );' % types[index]
     51    print '\tif (tablesize>0)'
    5152    print '\tcr_server.head_spu->dispatch_table.%s( pname, get_values );' % func_name
    5253    print """
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack.py

    r15532 r21308  
    2828
    2929static void crUnpackExtend(void);
     30static void crUnpackExtendDbg(void);
     31
     32/*#define CR_UNPACK_DEBUG_OPCODES*/
     33/*#define CR_UNPACK_DEBUG_LAST_OPCODES*/
    3034"""
    3135
    32 
     36nodebug_opcodes = [
     37    "CR_MULTITEXCOORD2FARB_OPCODE",
     38    "CR_VERTEX3F_OPCODE",
     39    "CR_NORMAL3F_OPCODE",
     40    "CR_COLOR4UB_OPCODE",
     41    "CR_LOADIDENTITY_OPCODE",
     42    "CR_MATRIXMODE_OPCODE",
     43    "CR_LOADMATRIXF_OPCODE",
     44    "CR_DISABLE_OPCODE",
     45    "CR_COLOR4F_OPCODE",
     46    "CR_ENABLE_OPCODE",
     47    "CR_BEGIN_OPCODE",
     48    "CR_END_OPCODE",
     49    "CR_SECONDARYCOLOR3FEXT_OPCODE"
     50]
     51
     52nodebug_extopcodes = [
     53    "CR_ACTIVETEXTUREARB_EXTEND_OPCODE"
     54]
    3355
    3456#
     
    199221    cr_unpackData = (const unsigned char *)data;
    200222
     223    crDebug("crUnpack: %d opcodes", num_opcodes);
     224
    201225    for (i = 0 ; i < num_opcodes ; i++)
    202226    {
     
    211235    if "pack" in apiutil.ChromiumProps(func_name):
    212236        print '\t\t\tcase %s:' % apiutil.OpcodeName( func_name )
    213 #        print '\t\t\t\tcrDebug("Unpack: %s");' % apiutil.OpcodeName( func_name )
     237        if not apiutil.OpcodeName(func_name) in nodebug_opcodes:
     238            print """
     239#ifdef CR_UNPACK_DEBUG_LAST_OPCODES
     240                if (i==(num_opcodes-1))
     241#endif
     242#if defined(CR_UNPACK_DEBUG_OPCODES) || defined(CR_UNPACK_DEBUG_LAST_OPCODES)
     243                crDebug("Unpack: %s");
     244#endif """ % apiutil.OpcodeName(func_name)
    214245        print '\t\t\t\tcrUnpack%s(); \n\t\t\t\tbreak;' % func_name
    215246
    216247print """       
    217             case CR_EXTEND_OPCODE: crUnpackExtend(); break;
     248            case CR_EXTEND_OPCODE:
     249                #ifdef CR_UNPACK_DEBUG_OPCODES
     250                    crUnpackExtendDbg();
     251                #else
     252                # ifdef CR_UNPACK_DEBUG_LAST_OPCODES
     253                    if (i==(num_opcodes-1)) crUnpackExtendDbg();
     254                    else
     255                # endif
     256                    crUnpackExtend();
     257                #endif
     258                break;
    218259            default:
    219260                crError( "Unknown opcode: %d", *unpack_opcodes );
     
    263304    INCR_VAR_PTR();
    264305}"""
     306
     307print 'static void crUnpackExtendDbg(void)'
     308print '{'
     309print '\tGLenum extend_opcode = %s;' % ReadData( 4, 'GLenum' );
     310print ''
     311print '\t/*crDebug(\"Unpacking extended opcode \%d", extend_opcode);*/'
     312print '\tswitch( extend_opcode )'
     313print '\t{'
     314
     315
     316#
     317# Emit switch statement for extended opcodes
     318#
     319for func_name in keys:
     320    if "extpack" in apiutil.ChromiumProps(func_name):
     321        print '\t\tcase %s:' % apiutil.ExtendedOpcodeName( func_name )
     322        if not apiutil.ExtendedOpcodeName(func_name) in nodebug_extopcodes:
     323            print '\t\t\tcrDebug("Unpack: %s");' % apiutil.ExtendedOpcodeName( func_name )
     324        print '\t\t\tcrUnpackExtend%s( );' % func_name
     325        print '\t\t\tbreak;'
     326
     327print """       default:
     328            crError( "Unknown extended opcode: %d", (int) extend_opcode );
     329            break;
     330    }
     331    INCR_VAR_PTR();
     332}"""
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_arrays.c

    r21306 r21308  
    117117void crUnpackExtendDrawElements(void)
    118118{
    119     GLenum mode = READ_DATA( 8, GLenum );
    120     GLsizei count = READ_DATA( 12, GLsizei );
    121     GLenum type = READ_DATA( 16, GLenum );
     119    GLenum mode         = READ_DATA( 8, GLenum );
     120    GLsizei count       = READ_DATA( 12, GLsizei );
     121    GLenum type         = READ_DATA( 16, GLenum );
    122122    GLintptrARB indices = READ_DATA( 20, GLintptrARB );
    123     cr_unpackDispatch.DrawElements( mode, count, type, (void *) indices);
     123    void * indexptr;
     124#ifdef CR_ARB_vertex_buffer_object
     125    GLboolean hasidxdata = READ_DATA(24, GLboolean);
     126    indexptr = hasidxdata ? DATA_POINTER(24+sizeof(GLboolean), void) : (void*)indices;
     127#else
     128    indexptr = DATA_POINTER(24, void);
     129#endif
     130    /*crDebug("DrawElements: count=%i, indexptr=%p, hasidx=%p", count, indexptr, hasidxdata);*/
     131    cr_unpackDispatch.DrawElements(mode, count, type, indexptr);
    124132}
    125133
    126134void crUnpackExtendDrawRangeElements(void)
    127135{
    128     GLenum mode = READ_DATA( 8, GLenum );
    129     GLuint start = READ_DATA( 12, GLuint );
    130     GLuint end = READ_DATA( 16, GLuint );
    131     GLsizei count = READ_DATA( 20, GLsizei );
    132     GLenum type = READ_DATA( 24, GLenum );
     136    GLenum mode         = READ_DATA( 8, GLenum );
     137    GLuint start        = READ_DATA( 12, GLuint );
     138    GLuint end          = READ_DATA( 16, GLuint );
     139    GLsizei count       = READ_DATA( 20, GLsizei );
     140    GLenum type         = READ_DATA( 24, GLenum );
    133141    GLintptrARB indices = READ_DATA( 28, GLintptrARB );
    134     cr_unpackDispatch.DrawRangeElements( mode, start, end, count, type, (void *) indices);
     142    void * indexptr;
     143#ifdef CR_ARB_vertex_buffer_object
     144    GLboolean hasidxdata = READ_DATA(32, GLboolean);
     145    indexptr = hasidxdata ? DATA_POINTER(32+sizeof(GLboolean), void) : (void*)indices;
     146#else
     147    indexptr = DATA_POINTER(32, void);
     148#endif
     149    cr_unpackDispatch.DrawRangeElements(mode, start, end, count, type, indexptr);
    135150}
    136151
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_bufferobject.c

    r21306 r21308  
    3232void crUnpackExtendBufferDataARB( void )
    3333{
    34     GLenum target = READ_DATA( sizeof(int) + 4, GLenum );
    35     GLsizeiptrARB size = READ_DATA( sizeof(int) + 8, GLsizeiptrARB );
    36     GLenum usage = READ_DATA( sizeof(int) + 12, GLenum );
    37     GLvoid *data = DATA_POINTER( sizeof(int) + 16, GLvoid );
     34    GLenum target      = READ_DATA(sizeof(int) + 4, GLenum);
     35    GLsizeiptrARB size = READ_DATA(sizeof(int) + 8, GLsizeiptrARB);
     36    GLenum usage       = READ_DATA(sizeof(int) + 12, GLenum);
     37    GLboolean hasdata  = READ_DATA(sizeof(int) + 16, GLboolean);
     38    GLvoid *data       = DATA_POINTER(sizeof(int) + 16 + sizeof(GLboolean), GLvoid);
    3839
    3940    CRASSERT(sizeof(GLsizeiptrARB) == 4);
    40     CRASSERT(usage == GL_STATIC_DRAW_ARB);
     41    /*@todo, why?*/
     42    /*CRASSERT(usage == GL_STATIC_DRAW_ARB);*/
    4143
    42     cr_unpackDispatch.BufferDataARB( target, size, data, usage );
     44    cr_unpackDispatch.BufferDataARB(target, size, hasdata ? data:NULL, usage);
    4345}
    4446
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpacker.h

    r15532 r21308  
    1313#define DLLDATA(type) DECLEXPORT(type)
    1414
     15#include "cr_version.h"
    1516#include "cr_unpack.h"
    1617#include "unpack_extend.h"
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