VirtualBox

Changeset 27091 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Mar 5, 2010 2:13:31 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
58419
Message:

crOpenGL: add GL_ARB_pixel_buffer_object support

Location:
trunk/src/VBox
Files:
33 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_bufferobject.c

    r21382 r27091  
    1111#include "packspu_proto.h"
    1212
     13static void packspu_GetHostBufferSubDataARB( GLenum target, GLintptrARB offset, GLsizeiptrARB size, void * data )
     14{
     15    GET_THREAD(thread);
     16    int writeback = 1;
     17
     18    crPackGetBufferSubDataARB(target, offset, size, data, &writeback);
     19
     20    packspuFlush((void *) thread);
     21
     22    while (writeback)
     23        crNetRecv();
     24}
    1325
    1426void * PACKSPU_APIENTRY
     
    1729    GET_CONTEXT(ctx);
    1830    void *buffer;
    19 #if 0
    20     CRBufferObject *bufObj;
    21     GLint size = -1;
     31    CRBufferObject *pBufObj;
    2232
    23     (void) crStateMapBufferARB( target, access );
     33    CRASSERT(GL_TRUE == ctx->clientState->bufferobject.retainBufferData);
     34    buffer = crStateMapBufferARB(target, access);
    2435
    25     crStateGetBufferParameterivARB(target, GL_BUFFER_SIZE_ARB, &size);
    26     if (size <= 0)
    27         return NULL;
     36#ifdef CR_ARB_pixel_buffer_object
     37    if (buffer)
     38    {
     39        pBufObj = crStateGetBoundBufferObject(target, &ctx->clientState->bufferobject);
     40        CRASSERT(pBufObj);
    2841
    29     if (crStateGetError()) {
    30         /* something may have gone wrong already */
    31         return NULL;
     42        if (pBufObj->bResyncOnRead &&
     43            access != GL_WRITE_ONLY_ARB)
     44        {
     45            /*fetch data from host side*/
     46            packspu_GetHostBufferSubDataARB(target, 0, pBufObj->size, buffer);
     47        }
    3248    }
    33 
    34     /* allocate buffer space */
    35     buffer = crAlloc(size);
    36     if (!buffer) {
    37         return NULL;
    38     }
    39 
    40     /* update state tracker info */
    41     if (target == GL_ARRAY_BUFFER_ARB) {
    42         bufObj = ctx->clientState->bufferobject.arrayBuffer;
    43     }
    44     else {
    45         CRASSERT(target == GL_ELEMENT_ARRAY_BUFFER_ARB);
    46         bufObj = ctx->clientState->bufferobject.elementsBuffer;
    47     }
    48     bufObj->pointer = buffer;
    49 
    50     /* Get current buffer data from server.
    51      * Ideally, if we could detect that the entire buffer was being
    52      * rewritten, we wouldn't have to fetch the current data here.
    53      */
    54     packspu_GetBufferSubDataARB(target, 0, bufObj->size, buffer);
    55 #else
    56     CRASSERT(GL_TRUE == ctx->clientState->bufferobject.retainBufferData);
    57     buffer = crStateMapBufferARB(target, access);
    5849#endif
    5950
     
    6354void PACKSPU_APIENTRY packspu_GetBufferSubDataARB( GLenum target, GLintptrARB offset, GLsizeiptrARB size, void * data )
    6455{
     56    GET_CONTEXT(ctx);
     57
     58#ifdef CR_ARB_pixel_buffer_object
     59    CRBufferObject *pBufObj;
     60
     61    pBufObj = crStateGetBoundBufferObject(target, &ctx->clientState->bufferobject);
     62
     63    if (pBufObj && pBufObj->bResyncOnRead)
     64    {
     65        packspu_GetHostBufferSubDataARB(target, offset, size, data);
     66        return;
     67    }
     68#endif
     69   
    6570    crStateGetBufferSubDataARB(target, offset, size, data);
    6671}
     
    7580    CRBufferObject *bufObj;
    7681
    77     if (target == GL_ARRAY_BUFFER_ARB) {
    78         bufObj = ctx->clientState->bufferobject.arrayBuffer;
    79     }
    80     else {
    81         CRASSERT(target == GL_ELEMENT_ARRAY_BUFFER_ARB);
    82         bufObj = ctx->clientState->bufferobject.elementsBuffer;
    83     }
     82    bufObj = crStateGetBoundBufferObject(target, &ctx->clientState->bufferobject);
    8483
    8584    /* send new buffer contents to server */
     
    124123}
    125124
    126 
    127125/*
    128126 * Need to update our local state for vertex arrays.
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_misc.c

    r24815 r27091  
    240240    return return_val;
    241241}
     242
     243void PACKSPU_APIENTRY packspu_GetPolygonStipple( GLubyte * mask )
     244{
     245    GET_THREAD(thread);
     246    int writeback = 1;
     247
     248    if (pack_spu.swap)
     249    {
     250        crPackGetPolygonStippleSWAP( mask, &writeback );
     251    }
     252    else
     253    {
     254        crPackGetPolygonStipple( mask, &writeback );
     255    }
     256
     257#ifdef CR_ARB_pixel_buffer_object
     258    if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
     259#endif
     260    {
     261        packspuFlush( (void *) thread );
     262        while (writeback)
     263            crNetRecv();
     264    }
     265}
     266
     267void PACKSPU_APIENTRY packspu_GetPixelMapfv( GLenum map, GLfloat * values )
     268{
     269    GET_THREAD(thread);
     270    int writeback = 1;
     271
     272    if (pack_spu.swap)
     273    {
     274        crPackGetPixelMapfvSWAP( map, values, &writeback );
     275    }
     276    else
     277    {
     278        crPackGetPixelMapfv( map, values, &writeback );
     279    }
     280
     281#ifdef CR_ARB_pixel_buffer_object
     282    if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
     283#endif
     284    {
     285        packspuFlush( (void *) thread );
     286        while (writeback)
     287            crNetRecv();
     288    }
     289}
     290
     291void PACKSPU_APIENTRY packspu_GetPixelMapuiv( GLenum map, GLuint * values )
     292{
     293    GET_THREAD(thread);
     294    int writeback = 1;
     295
     296    if (pack_spu.swap)
     297    {
     298        crPackGetPixelMapuivSWAP( map, values, &writeback );
     299    }
     300    else
     301    {
     302        crPackGetPixelMapuiv( map, values, &writeback );
     303    }
     304
     305#ifdef CR_ARB_pixel_buffer_object
     306    if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
     307#endif
     308    {
     309        packspuFlush( (void *) thread );
     310        while (writeback)
     311            crNetRecv();
     312    }
     313}
     314
     315void PACKSPU_APIENTRY packspu_GetPixelMapusv( GLenum map, GLushort * values )
     316{
     317    GET_THREAD(thread);
     318    int writeback = 1;
     319
     320    if (pack_spu.swap)
     321    {
     322        crPackGetPixelMapusvSWAP( map, values, &writeback );
     323    }
     324    else
     325    {
     326        crPackGetPixelMapusv( map, values, &writeback );
     327    }
     328
     329#ifdef CR_ARB_pixel_buffer_object
     330    if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
     331#endif
     332    {
     333        packspuFlush( (void *) thread );
     334        while (writeback)
     335            crNetRecv();
     336    }
     337}
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_pixel.c

    r26407 r27091  
    184184    ContextInfo *ctx = thread->currentContext;
    185185    CRClientState *clientState = &(ctx->clientState->client);
    186     int writeback;
    187     pack_spu.ReadPixels++;
    188     if (pack_spu.swap)
    189         crPackReadPixelsSWAP( x, y, width, height, format, type, pixels,
    190                             &(clientState->pack), &writeback );
    191     else
    192         crPackReadPixels( x, y, width, height, format, type, pixels,
    193                             &(clientState->pack), &writeback );
    194     packspuFlush( (void *) thread );
    195     while (pack_spu.ReadPixels)
    196         crNetRecv();
     186    int writeback;   
     187
     188    if (pack_spu.swap)
     189    {
     190        crPackReadPixelsSWAP(x, y, width, height, format, type, pixels,
     191                             &(clientState->pack), &writeback);
     192    }
     193    else
     194    {
     195        crPackReadPixels(x, y, width, height, format, type, pixels,
     196                         &(clientState->pack), &writeback);
     197    }
     198
     199#ifdef CR_ARB_pixel_buffer_object
     200    if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
     201#endif
     202    {
     203        pack_spu.ReadPixels++;
     204
     205        packspuFlush((void *) thread);
     206        while (pack_spu.ReadPixels)
     207            crNetRecv();
     208    }
    197209}
    198210
     
    225237    if (!packspu_CheckTexImageParams(internalformat, format, type))
    226238    {
    227         if (pixels)
     239        if (pixels || crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
    228240        {
    229241            crWarning("packspu_TexImage1D invalid internalFormat(%x)/format(%x)/type(%x)", internalformat, format, type);
     
    248260    if (!packspu_CheckTexImageParams(internalformat, format, type))
    249261    {
    250         if (pixels)
     262        if (pixels || crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
    251263        {
    252264            crWarning("packspu_TexImage2D invalid internalFormat(%x)/format(%x)/type(%x)", internalformat, format, type);
     
    359371    else
    360372        crPackGetTexImage( target, level, format, type, pixels, &(clientState->pack), &writeback );
    361     packspuFlush( (void *) thread );
    362     while (writeback)
    363         crNetRecv();
    364 }
     373
     374#ifdef CR_ARB_pixel_buffer_object
     375    if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
     376#endif
     377    {
     378        packspuFlush( (void *) thread );
     379        while (writeback)
     380            crNetRecv();
     381    }
     382}
     383
     384void PACKSPU_APIENTRY packspu_GetCompressedTexImageARB( GLenum target, GLint level, GLvoid * img )
     385{
     386    GET_THREAD(thread);
     387    int writeback = 1;
     388
     389    if (pack_spu.swap)
     390    {
     391        crPackGetCompressedTexImageARBSWAP( target, level, img, &writeback );
     392    }
     393    else
     394    {
     395        crPackGetCompressedTexImageARB( target, level, img, &writeback );
     396    }
     397
     398#ifdef CR_ARB_pixel_buffer_object
     399    if (!crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
     400#endif
     401    {
     402        packspuFlush( (void *) thread );
     403        while (writeback)
     404            crNetRecv();
     405    }
     406}
  • trunk/src/VBox/Additions/common/crOpenGL/pack/packspu_special

    r26407 r27091  
    9696BindTexture
    9797DeleteTextures
     98GetPolygonStipple
     99GetPixelMapfv
     100GetPixelMapuiv
     101GetPixelMapusv
     102GetCompressedTexImageARB
  • trunk/src/VBox/GuestHost/OpenGL/glapi_parser/apiutil.py

    r20467 r27091  
    612612        'GLsizeiptrARB': 4, # XXX or 8 bytes?
    613613        'GLhandleARB': 4,
    614         'GLcharARB': 1
     614        'GLcharARB': 1,
     615    'uintptr_t': 4
    615616}
    616617
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_extstring.h

    r22284 r27091  
    9494        "GL_ARB_vertex_buffer_object "
    9595#endif
     96#ifdef CR_ARB_pixel_buffer_object
     97    "GL_ARB_pixel_buffer_object "
     98#endif
    9699#ifdef CR_ARB_vertex_program
    97100        "GL_ARB_vertex_program "
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_protocol.h

    r23399 r27091  
    1616/*For now guest is allowed to connect host opengl service if protocol version matches exactly*/
    1717/*Note: that after any change to this file, or glapi_parser\apispec.txt version should be changed*/
    18 #define CR_PROTOCOL_VERSION_MAJOR 5
     18#define CR_PROTOCOL_VERSION_MAJOR 6
    1919#define CR_PROTOCOL_VERSION_MINOR 1
    2020
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_version.h

    r22284 r27091  
    122122#define CR_EXT_compiled_vertex_array 1
    123123
     124#define CR_ARB_pixel_buffer_object 1
     125
    124126#endif /* CR_VERSION_H */
  • trunk/src/VBox/GuestHost/OpenGL/include/state/cr_bufferobject.h

    r23123 r27091  
    1919        CRbitvalue      arrayBinding[CR_MAX_BITARRAY];
    2020        CRbitvalue      elementsBinding[CR_MAX_BITARRAY];
     21    CRbitvalue  packBinding[CR_MAX_BITARRAY];
     22    CRbitvalue  unpackBinding[CR_MAX_BITARRAY];
    2123} CRBufferObjectBits;
    2224
     
    3436        GLvoid *pointer;  /* only valid while buffer is mapped */
    3537        GLvoid *data;     /* the buffer data, if retainBufferData is true */
     38    GLboolean bResyncOnRead; /* buffer data could be changed on server side,
     39                                so we need to resync every time guest wants to read from it*/
    3640        CRbitvalue dirty[CR_MAX_BITARRAY];  /* dirty data or state */
    3741        GLintptrARB dirtyStart, dirtyLength; /* dirty region */
     
    4246        CRBufferObject *arrayBuffer;
    4347        CRBufferObject *elementsBuffer;
     48    CRBufferObject *packBuffer;
     49    CRBufferObject *unpackBuffer;
    4450
    4551        CRBufferObject *nullBuffer;  /* name = 0 */
     
    5056} CRBufferObjectState;
    5157
     58DECLEXPORT(CRBufferObject *) crStateGetBoundBufferObject(GLenum target, CRBufferObjectState *b);
     59DECLEXPORT(GLboolean) crStateIsBufferBound(GLenum target);
    5260
    5361#ifdef __cplusplus
  • trunk/src/VBox/GuestHost/OpenGL/include/state/cr_limits.h

    r26407 r27091  
    228228        GLboolean ARB_transpose_matrix;
    229229        GLboolean ARB_vertex_buffer_object;
     230    GLboolean ARB_pixel_buffer_object;
    230231        GLboolean ARB_vertex_program;
    231232        GLboolean ARB_window_pos;
  • trunk/src/VBox/GuestHost/OpenGL/include/state/cr_texture.h

    r25154 r27091  
    2222 */
    2323#define CR_STATE_NO_TEXTURE_IMAGE_STORE
     24
     25#if defined(CR_ARB_pixel_buffer_object) && !defined(CR_STATE_NO_TEXTURE_IMAGE_STORE)
     26#error CR_ARB_pixel_buffer_object not supported without CR_STATE_NO_TEXTURE_IMAGE_STORE
     27#endif
    2428
    2529#define CR_MAX_MIPMAP_LEVELS 20
  • trunk/src/VBox/GuestHost/OpenGL/packer/pack_pixelmap.c

    r27073 r27091  
    77#include "packer.h"
    88#include "cr_mem.h"
     9#include "cr_glstate.h"
    910
    1011static unsigned char * __gl_HandlePixelMapData(GLenum map, GLsizei mapsize, int size_of_value, const GLvoid *values)
    1112{
     13    int nodata = (values == NULL) || crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB);
    1214    int packet_length =
    1315        sizeof( map ) +
    14         sizeof( mapsize ) +
    15         mapsize*size_of_value;
    16     unsigned char *data_ptr = (unsigned char *) crPackAlloc( packet_length );
     16        sizeof( mapsize ) + sizeof(int) + sizeof(uintptr_t);
     17    unsigned char *data_ptr;
     18
     19    if (!nodata)
     20    {
     21        packet_length += mapsize*size_of_value;
     22    }
     23
     24    data_ptr = (unsigned char *) crPackAlloc( packet_length );
    1725
    1826    WRITE_DATA( 0, GLenum, map );
    1927    WRITE_DATA( 4, GLsizei, mapsize );
    20     crMemcpy( data_ptr + 8, values, mapsize*size_of_value );
     28    WRITE_DATA( 8, int, nodata);
     29    WRITE_DATA( 12, uintptr_t, (uintptr_t)values);
     30
     31    if (!nodata)
     32    {
     33        crMemcpy( data_ptr + 16, values, mapsize*size_of_value );
     34    }
     35
    2136    return data_ptr;
    2237}
  • trunk/src/VBox/GuestHost/OpenGL/packer/pack_pixels.c

    r21854 r27091  
    1212
    1313
    14 void PACK_APIENTRY crPackDrawPixels( GLsizei width, GLsizei height,
    15                                                                          GLenum format, GLenum type,
    16                                                                          const GLvoid *pixels,
    17                                                                          const CRPixelPackState *unpackstate )
     14void PACK_APIENTRY crPackDrawPixels(GLsizei width, GLsizei height,
     15                                    GLenum format, GLenum type,
     16                                    const GLvoid *pixels,
     17                                    const CRPixelPackState *unpackstate )
    1818{
    1919    unsigned char *data_ptr;
    2020    int packet_length, imagesize;
    21 
    22     if (pixels == NULL)
    23     {
    24         return;
    25     }
    26 
    27 #if 0
    28     /* WHAT IS THIS FOR?  Disabled by Brian on 3 Dec 2003 */
    29     if (type == GL_BITMAP)
    30     {
    31         crPackBitmap( width, height, 0, 0, 0, 0,
    32                                     (const GLubyte *) pixels, unpackstate );
    33     }
    34 #endif
     21    int noimagedata = (pixels == NULL) || crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB);
    3522
    3623    packet_length =
     
    3825        sizeof( height ) +
    3926        sizeof( format ) +
    40         sizeof( type );
    41 
    42     imagesize = crImageSize( format, type, width, height );
    43 
    44     if (imagesize<=0)
    45     {
    46         crDebug("crPackDrawPixels: 0 image size, ignoring");
    47         return;
    48     }
    49 
    50     packet_length += imagesize;
     27        sizeof( type ) + sizeof(int) + sizeof(uintptr_t);
     28
     29    if (!noimagedata)
     30    {
     31        imagesize = crImageSize( format, type, width, height );
     32
     33        if (imagesize<=0)
     34        {
     35            crDebug("crPackDrawPixels: 0 image size, ignoring");
     36            return;
     37        }
     38        packet_length += imagesize;
     39    }
    5140
    5241    data_ptr = (unsigned char *) crPackAlloc( packet_length );
     
    5544    WRITE_DATA( 8, GLenum, format );
    5645    WRITE_DATA( 12, GLenum, type );
    57 
    58     crPixelCopy2D( width, height,
    59                                  (void *) (data_ptr + 16), format, type, NULL, /* dst */
    60                                  pixels, format, type, unpackstate );  /* src */
     46    WRITE_DATA( 16, GLint, noimagedata );
     47    WRITE_DATA( 20, uintptr_t, (uintptr_t) pixels );
     48
     49    if (!noimagedata)
     50    {
     51        crPixelCopy2D(width, height,
     52                      (void *) (data_ptr + 24), format, type, NULL, /* dst */
     53                      pixels, format, type, unpackstate);  /* src */
     54    }
    6155
    6256    crHugePacket( CR_DRAWPIXELS_OPCODE, data_ptr );
     
    6458}
    6559
    66 void PACK_APIENTRY crPackReadPixels( GLint x, GLint y, GLsizei width,
    67                                                                          GLsizei height, GLenum format,
    68                                                                          GLenum type, GLvoid *pixels,
    69                                                                          const CRPixelPackState *packstate,
    70                                                                          int *writeback)
     60void PACK_APIENTRY crPackReadPixels(GLint x, GLint y, GLsizei width,
     61                                    GLsizei height, GLenum format,
     62                                    GLenum type, GLvoid *pixels,
     63                                    const CRPixelPackState *packstate,
     64                                    int *writeback)
    7165{
    7266    GET_PACKER_CONTEXT(pc);
     
    115109#define CEIL8(N)  (((N) + 7) & ~0x7)
    116110
    117 void PACK_APIENTRY crPackBitmap( GLsizei width, GLsizei height,
    118         GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove,
    119         const GLubyte *bitmap, const CRPixelPackState *unpack )
    120 {
    121     const int isnull = (bitmap == NULL);
     111void PACK_APIENTRY crPackBitmap(GLsizei width, GLsizei height,
     112                                GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove,
     113                                const GLubyte *bitmap, const CRPixelPackState *unpack )
     114{
     115    const int noimagedata = (bitmap == NULL) || crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB);
    122116    unsigned char *data_ptr;
    123117    int data_length = 0;
     
    130124        sizeof( xmove ) +
    131125        sizeof( ymove ) +
    132         sizeof( GLuint );
    133 
    134     if ( bitmap )
     126        sizeof( GLuint ) + sizeof(uintptr_t);
     127
     128    if (!noimagedata)
    135129    {
    136130        data_length = CEIL8(width) * height / 8;
    137131        packet_length += data_length;
    138 
    139         data_ptr = (unsigned char *) crPackAlloc( packet_length );
    140         destBitmap = data_ptr + 28;
    141 
    142         crBitmapCopy(width, height, destBitmap, bitmap, unpack);
    143         /*
    144         crMemcpy(destBitmap, bitmap, data_length);
    145         */
    146     }
    147     else {
    148         data_ptr = (unsigned char *) crPackAlloc( packet_length );
    149     }
     132    }
     133
     134    data_ptr = (unsigned char *) crPackAlloc( packet_length );
    150135
    151136    WRITE_DATA( 0, GLsizei, width );
     
    155140    WRITE_DATA( 16, GLfloat, xmove );
    156141    WRITE_DATA( 20, GLfloat, ymove );
    157     WRITE_DATA( 24, GLuint, isnull );
     142    WRITE_DATA( 24, GLuint, noimagedata );
     143    WRITE_DATA( 28, uintptr_t, (uintptr_t) bitmap);
     144
     145    crBitmapCopy(width, height, (GLubyte *)(data_ptr + 32), bitmap, unpack);
    158146
    159147    crHugePacket( CR_BITMAP_OPCODE, data_ptr );
  • trunk/src/VBox/GuestHost/OpenGL/packer/pack_stipple.c

    r15532 r27091  
    88#include "cr_opcodes.h"
    99#include "cr_mem.h"
    10 
     10#include "cr_glstate.h"
    1111
    1212void PACK_APIENTRY crPackPolygonStipple( const GLubyte *mask )
    1313{
    14         GET_PACKER_CONTEXT(pc);
    15         unsigned char *data_ptr;
    16         int packet_length = 32*32/8;
    17         GET_BUFFERED_POINTER(pc, packet_length );
    18         crMemcpy( data_ptr, mask, 32*32/8 );
    19         WRITE_OPCODE( pc, CR_POLYGONSTIPPLE_OPCODE );
     14    GET_PACKER_CONTEXT(pc);
     15    unsigned char *data_ptr;
     16    int nodata = crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB);
     17    int packet_length = sizeof(int);
     18
     19    if (nodata)
     20        packet_length += sizeof(uintptr_t);
     21    else
     22        packet_length += 32*32/8;
     23
     24    GET_BUFFERED_POINTER(pc, packet_length );
     25    WRITE_DATA_AI(int, nodata);
     26    if (nodata)
     27    {
     28        WRITE_DATA_AI(uintptr_t, (uintptr_t)mask);
     29    }
     30    else
     31    {
     32       crMemcpy( data_ptr, mask, 32*32/8 );
     33    }
     34    WRITE_OPCODE( pc, CR_POLYGONSTIPPLE_OPCODE );
    2035}
  • trunk/src/VBox/GuestHost/OpenGL/packer/pack_texture.c

    r21843 r27091  
    1010#include "cr_string.h"
    1111#include "cr_version.h"
     12#include "cr_glstate.h"
    1213
    1314void PACK_APIENTRY
    1415crPackTexImage1D(GLenum target, GLint level,
    15                                  GLint internalformat, GLsizei width, GLint border,
    16                                  GLenum format, GLenum type, const GLvoid * pixels,
    17                                  const CRPixelPackState * unpackstate)
    18 {
    19     unsigned char *data_ptr;
    20     int packet_length;
    21     int isnull = (pixels == NULL);
     16                 GLint internalformat, GLsizei width, GLint border,
     17                 GLenum format, GLenum type, const GLvoid * pixels,
     18                 const CRPixelPackState * unpackstate)
     19{
     20    unsigned char *data_ptr;
     21    int packet_length;
     22    int noimagedata = (pixels == NULL) || crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB);
    2223
    2324    packet_length =
     
    2627        sizeof(internalformat) +
    2728        sizeof(width) +
    28         sizeof(border) + sizeof(format) + sizeof(type) + sizeof(int);
    29 
    30     if (pixels)
     29        sizeof(border) + sizeof(format) + sizeof(type) + sizeof(int) + sizeof(uintptr_t);
     30
     31    if (!noimagedata)
    3132    {
    3233        packet_length += crImageSize(format, type, width, 1);
     
    4142    WRITE_DATA(20, GLenum, format);
    4243    WRITE_DATA(24, GLenum, type);
    43     WRITE_DATA(28, int, isnull);
    44 
    45     if (pixels)
    46     {
    47         crPixelCopy1D((void *) (data_ptr + 32), format, type,
    48                                     pixels, format, type, width, unpackstate);
     44    WRITE_DATA(28, int, noimagedata);
     45    WRITE_DATA(32, uintptr_t, (uintptr_t) pixels);
     46
     47    if (!noimagedata)
     48    {
     49        crPixelCopy1D((void *) (data_ptr + 36), format, type,
     50                      pixels, format, type, width, unpackstate);
    4951    }
    5052
     
    5557void PACK_APIENTRY
    5658crPackTexImage2D(GLenum target, GLint level,
    57                                  GLint internalformat, GLsizei width, GLsizei height,
    58                                  GLint border, GLenum format, GLenum type,
    59                                  const GLvoid * pixels, const CRPixelPackState * unpackstate)
    60 {
    61     unsigned char *data_ptr;
    62     int packet_length;
    63     const int isnull = (pixels == NULL);
     59                 GLint internalformat, GLsizei width, GLsizei height,
     60                 GLint border, GLenum format, GLenum type,
     61                 const GLvoid * pixels, const CRPixelPackState * unpackstate)
     62{
     63    unsigned char *data_ptr;
     64    int packet_length;
     65    const int noimagedata = (pixels == NULL) || crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB);
    6466    const int is_distrib = ((type == GL_TRUE) || (type == GL_FALSE));
    6567    int distrib_buf_len = 0;
     
    7173        sizeof(width) +
    7274        sizeof(height) +
    73         sizeof(border) + sizeof(format) + sizeof(type) + sizeof(int);
    74 
    75     if (pixels)
     75        sizeof(border) + sizeof(format) + sizeof(type) + sizeof(int) + sizeof(uintptr_t);
     76
     77    if (!noimagedata)
    7678    {
    7779        if (is_distrib)
     
    102104    WRITE_DATA(24, GLenum, format);
    103105    WRITE_DATA(28, GLenum, type);
    104     WRITE_DATA(32, int, isnull);
    105 
    106     if (pixels)
     106    WRITE_DATA(32, int, noimagedata);
     107    WRITE_DATA(36, uintptr_t, (uintptr_t) pixels);
     108
     109    if (!noimagedata)
    107110    {
    108111        if (is_distrib)
    109112        {
    110             crMemcpy((void *) (data_ptr + 36), pixels, distrib_buf_len);
     113            crMemcpy((void *) (data_ptr + 40), pixels, distrib_buf_len);
    111114        }
    112115        else
    113116        {
    114117            crPixelCopy2D(width, height,
    115                                         (void *) (data_ptr + 36), /* dest image addr */
     118                                        (void *) (data_ptr + 40), /* dest image addr */
    116119                                        format, type,             /* dest image format/type */
    117120                                        NULL,   /* dst packing (use default params) */
     
    127130
    128131#if defined( GL_EXT_texture3D )
    129 void PACK_APIENTRY crPackTexImage3DEXT(GLenum target, GLint level,
    130                 GLenum internalformat,
    131                 GLsizei width, GLsizei height, GLsizei depth, GLint border,
    132                 GLenum format, GLenum type, const GLvoid *pixels,
    133                 const CRPixelPackState *unpackstate )
    134 {
    135     unsigned char *data_ptr;
    136     int packet_length;
    137     int isnull = (pixels == NULL);
     132void PACK_APIENTRY
     133crPackTexImage3DEXT(GLenum target, GLint level,
     134                    GLenum internalformat,
     135                    GLsizei width, GLsizei height, GLsizei depth, GLint border,
     136                    GLenum format, GLenum type, const GLvoid *pixels,
     137                    const CRPixelPackState *unpackstate )
     138{
     139    unsigned char *data_ptr;
     140    int packet_length;
     141    int noimagedata = (pixels == NULL) || crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB);
    138142    int is_distrib = ( (type == GL_TRUE) || (type == GL_FALSE) ) ;
    139143    int distrib_buf_len = 0;
     
    150154        sizeof( format ) +
    151155        sizeof( type ) +
    152         sizeof( int );
    153 
    154     if (pixels)
     156        sizeof( int ) + sizeof(uintptr_t);
     157
     158    if (!noimagedata)
    155159    {
    156160        if ( is_distrib )
     
    177181    WRITE_DATA( 28, GLenum, format );
    178182    WRITE_DATA( 32, GLenum, type );
    179     WRITE_DATA( 36, int, isnull );
    180 
    181     if (pixels)
     183    WRITE_DATA( 36, int, noimagedata );
     184    WRITE_DATA( 40, uintptr_t, (uintptr_t) pixels);
     185
     186    if (!noimagedata)
    182187    {
    183188        if ( is_distrib )
    184189        {
    185             crMemcpy( (void*)(data_ptr + 40), pixels, distrib_buf_len ) ;
     190            crMemcpy( (void*)(data_ptr + 44), pixels, distrib_buf_len ) ;
    186191        }
    187192        else
    188193        {               
    189194            crPixelCopy3D( width, height, depth,
    190                                          (void *)(data_ptr + 40), format, type, NULL,
     195                                         (void *)(data_ptr + 44), format, type, NULL,
    191196                                         pixels, format, type, unpackstate );
    192197        }
     
    199204
    200205#ifdef CR_OPENGL_VERSION_1_2
    201 void PACK_APIENTRY crPackTexImage3D(GLenum target, GLint level,
    202                                                                         GLint internalformat,
    203                                                                         GLsizei width, GLsizei height,
    204                                                                         GLsizei depth, GLint border,
    205                                                                         GLenum format, GLenum type,
    206                                                                         const GLvoid *pixels,
    207                                                                         const CRPixelPackState *unpackstate )
    208 {
    209     unsigned char *data_ptr;
    210     int packet_length;
    211     int isnull = (pixels == NULL);
     206void PACK_APIENTRY
     207crPackTexImage3D(GLenum target, GLint level,
     208                 GLint internalformat,
     209                 GLsizei width, GLsizei height,
     210                 GLsizei depth, GLint border,
     211                 GLenum format, GLenum type,
     212                 const GLvoid *pixels,
     213                 const CRPixelPackState *unpackstate )
     214{
     215    unsigned char *data_ptr;
     216    int packet_length;
     217    int noimagedata = (pixels == NULL) || crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB);
    212218    int is_distrib = ( (type == GL_TRUE) || (type == GL_FALSE) ) ;
    213219    int distrib_buf_len = 0;
     
    224230        sizeof( format ) +
    225231        sizeof( type ) +
    226         sizeof( int );
    227 
    228     if (pixels)
     232        sizeof( int ) + sizeof(uintptr_t);
     233
     234    if (!noimagedata)
    229235    {
    230236        if ( is_distrib )
     
    251257    WRITE_DATA( 28, GLenum, format );
    252258    WRITE_DATA( 32, GLenum, type );
    253     WRITE_DATA( 36, int, isnull );
    254 
    255     if (pixels)
     259    WRITE_DATA( 36, int, noimagedata );
     260    WRITE_DATA( 40, uintptr_t, (uintptr_t) pixels);
     261
     262    if (!noimagedata)
    256263    {
    257264        if ( is_distrib )
    258265        {
    259             crMemcpy( (void*)(data_ptr + 40), pixels, distrib_buf_len ) ;
     266            crMemcpy( (void*)(data_ptr + 44), pixels, distrib_buf_len ) ;
    260267        }
    261268        else
    262269        {               
    263270            crPixelCopy3D( width, height, depth,
    264                                          (void *)(data_ptr + 40), format, type, NULL,
     271                                         (void *)(data_ptr + 44), format, type, NULL,
    265272                                         pixels, format, type, unpackstate );
    266273        }
     
    536543void PACK_APIENTRY
    537544crPackTexSubImage3D(GLenum target, GLint level,
    538                                         GLint xoffset, GLint yoffset, GLint zoffset,
    539                                         GLsizei width, GLsizei height, GLsizei depth,
    540                                         GLenum format, GLenum type, const GLvoid * pixels,
    541                                         const CRPixelPackState * unpackstate)
    542 {
    543     unsigned char *data_ptr;
    544     int packet_length;
     545                    GLint xoffset, GLint yoffset, GLint zoffset,
     546                    GLsizei width, GLsizei height, GLsizei depth,
     547                    GLenum format, GLenum type, const GLvoid * pixels,
     548                    const CRPixelPackState * unpackstate)
     549{
     550    unsigned char *data_ptr;
     551    int packet_length;
     552    int noimagedata = (pixels == NULL) || crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB);
    545553
    546554    packet_length =
     
    554562        sizeof(depth) +
    555563        sizeof(format) +
    556         sizeof(type) + crTextureSize(format, type, width, height, depth);
     564        sizeof(type) + sizeof(int) + sizeof(uintptr_t);
     565
     566    if (!noimagedata)
     567    {
     568        packet_length += crTextureSize(format, type, width, height, depth);
     569    }
    557570
    558571    data_ptr = (unsigned char *) crPackAlloc(packet_length);
     
    567580    WRITE_DATA(32, GLenum, format);
    568581    WRITE_DATA(36, GLenum, type);
    569 
    570     crPixelCopy3D(width, height, depth, (GLvoid *) (data_ptr + 40), format, type, NULL, /* dst */
    571                                 pixels, format, type, unpackstate); /* src */
     582    WRITE_DATA(40, GLint, noimagedata);
     583    WRITE_DATA(44, uintptr_t, (uintptr_t) pixels);
     584
     585    if (!noimagedata)
     586    {
     587        crPixelCopy3D(width, height, depth, (GLvoid *) (data_ptr + 48), format, type, NULL, /* dst */
     588                      pixels, format, type, unpackstate); /* src */
     589    }
    572590
    573591    crHugePacket(CR_TEXSUBIMAGE3D_OPCODE, data_ptr);
     
    578596void PACK_APIENTRY
    579597crPackTexSubImage2D(GLenum target, GLint level,
    580                                         GLint xoffset, GLint yoffset, GLsizei width,
    581                                         GLsizei height, GLenum format, GLenum type,
    582                                         const GLvoid * pixels,
    583                                         const CRPixelPackState * unpackstate)
    584 {
    585     unsigned char *data_ptr;
    586     int packet_length;
     598                    GLint xoffset, GLint yoffset, GLsizei width,
     599                    GLsizei height, GLenum format, GLenum type,
     600                    const GLvoid * pixels,
     601                    const CRPixelPackState * unpackstate)
     602{
     603    unsigned char *data_ptr;
     604    int packet_length;
     605    int noimagedata = (pixels == NULL) || crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB);
    587606
    588607    packet_length =
     
    593612        sizeof(width) +
    594613        sizeof(height) +
    595         sizeof(format) + sizeof(type) + crImageSize(format, type, width, height);
     614        sizeof(format) + sizeof(type) + sizeof(int) + sizeof(uintptr_t);
     615
     616    if (!noimagedata)
     617    {
     618        packet_length += crImageSize(format, type, width, height);
     619    }
    596620
    597621    data_ptr = (unsigned char *) crPackAlloc(packet_length);
     
    604628    WRITE_DATA(24, GLenum, format);
    605629    WRITE_DATA(28, GLenum, type);
    606 
    607     crPixelCopy2D(width, height, (GLvoid *) (data_ptr + 32), format, type, NULL,    /* dst */
    608                                 pixels, format, type, unpackstate); /* src */
     630    WRITE_DATA(32, GLint, noimagedata);
     631    WRITE_DATA(36, uintptr_t, (uintptr_t) pixels);
     632
     633    if (!noimagedata)
     634    {
     635        crPixelCopy2D(width, height, (GLvoid *) (data_ptr + 40), format, type, NULL,    /* dst */
     636                      pixels, format, type, unpackstate); /* src */
     637    }
    609638
    610639    crHugePacket(CR_TEXSUBIMAGE2D_OPCODE, data_ptr);
     
    620649    unsigned char *data_ptr;
    621650    int packet_length;
     651    int noimagedata = (pixels == NULL) || crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB);
    622652
    623653    packet_length =
     
    626656        sizeof(xoffset) +
    627657        sizeof(width) +
    628         sizeof(format) + sizeof(type) + crImageSize(format, type, width, 1);
     658        sizeof(format) + sizeof(type) + sizeof(int) + sizeof(uintptr_t);
     659
     660    if (!noimagedata)
     661    {
     662        packet_length += crImageSize(format, type, width, 1);
     663    }
    629664
    630665    data_ptr = (unsigned char *) crPackAlloc(packet_length);
     
    635670    WRITE_DATA(16, GLenum, format);
    636671    WRITE_DATA(20, GLenum, type);
    637 
    638     crPixelCopy1D((GLvoid *) (data_ptr + 24), format, type,
    639                                 pixels, format, type, width, unpackstate);
     672    WRITE_DATA(24, GLint, noimagedata);
     673    WRITE_DATA(28, uintptr_t, (uintptr_t) pixels);
     674
     675    if (!noimagedata)
     676    {
     677        crPixelCopy1D((GLvoid *) (data_ptr + 32), format, type,
     678                      pixels, format, type, width, unpackstate);
     679    }
    640680
    641681    crHugePacket(CR_TEXSUBIMAGE1D_OPCODE, data_ptr);
     
    679719    unsigned char *data_ptr;
    680720    int packet_length;
    681     int isnull = (data == NULL);
     721    int noimagedata = (data == NULL) || crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB);
    682722
    683723    /* All extended opcodes have their first 8 bytes predefined:
     
    693733        sizeof( border ) +
    694734        sizeof( imagesize ) +
    695         sizeof( int ); /* isnull */
    696 
    697     if (data)
     735        sizeof( int ) + sizeof(uintptr_t);
     736
     737    if (!noimagedata)
    698738    {
    699739        packet_length += imagesize;
     
    709749    WRITE_DATA( 20, GLint, border );
    710750    WRITE_DATA( 24, GLsizei, imagesize );
    711     WRITE_DATA( 28, int, isnull );
    712 
    713     if (data) {
    714         crMemcpy( (void *)(data_ptr + 32), (void *)data, imagesize);
     751    WRITE_DATA( 28, int, noimagedata );
     752    WRITE_DATA( 32, uintptr_t, (uintptr_t) data);
     753
     754    if (!noimagedata) {
     755        crMemcpy( (void *)(data_ptr + 36), (void *)data, imagesize);
    715756    }
    716757
     
    723764    unsigned char *data_ptr;
    724765    int packet_length;
    725     int isnull = (data == NULL);
     766    int noimagedata = (data == NULL) || crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB);
    726767
    727768    /* All extended opcodes have their first 8 bytes predefined:
     
    738779        sizeof( border ) +
    739780        sizeof( imagesize ) +
    740         sizeof( int ); /* isnull */
    741 
    742     if (data)
     781        sizeof( int ) + sizeof(uintptr_t);
     782
     783    if (!noimagedata)
    743784    {
    744785        packet_length += imagesize;
     
    756797    WRITE_DATA( 24, GLint, border );
    757798    WRITE_DATA( 28, GLsizei, imagesize );
    758     WRITE_DATA( 32, int, isnull );
    759 
    760     if (data) {
    761         crMemcpy( (void *)(data_ptr + 36), (void *)data, imagesize);
     799    WRITE_DATA( 32, int, noimagedata );
     800    WRITE_DATA( 36, uintptr_t, (uintptr_t) data);
     801
     802    if (!noimagedata) {
     803        crMemcpy( (void *)(data_ptr + 40), (void *)data, imagesize);
    762804    }
    763805
     
    770812    unsigned char *data_ptr;
    771813    int packet_length;
    772     int isnull = (data == NULL);
     814    int noimagedata = (data == NULL) || crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB);
    773815
    774816    /* All extended opcodes have their first 8 bytes predefined:
     
    786828        sizeof( border ) +
    787829        sizeof( imagesize ) +
    788         sizeof( int ); /* isnull */
    789 
    790     if (data)
     830        sizeof( int ) + sizeof(uintptr_t);
     831
     832    if (!noimagedata)
    791833    {
    792834        packet_length += imagesize;
     
    803845    WRITE_DATA( 28, GLint, border );
    804846    WRITE_DATA( 32, GLsizei, imagesize );
    805     WRITE_DATA( 36, int, isnull );
    806 
    807     if (data) {
    808         crMemcpy( (void *)(data_ptr + 40), (void *)data, imagesize);
     847    WRITE_DATA( 36, int, noimagedata );
     848    WRITE_DATA( 40, uintptr_t, (uintptr_t) data);
     849
     850    if (!noimagedata) {
     851        crMemcpy( (void *)(data_ptr + 44), (void *)data, imagesize);
    809852    }
    810853
     
    817860    unsigned char *data_ptr;
    818861    int packet_length;
    819     int isnull = (data == NULL);
     862    int noimagedata = (data == NULL) || crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB);
    820863
    821864    /* All extended opcodes have their first 8 bytes predefined:
     
    831874        sizeof( format ) +
    832875        sizeof( imagesize ) +
    833         sizeof( int ); /* isnull */
    834 
    835     if (data)
     876        sizeof( int ) + sizeof(uintptr_t);
     877
     878    if (!noimagedata)
    836879    {
    837880        packet_length += imagesize;
     
    846889    WRITE_DATA( 20, GLenum, format );
    847890    WRITE_DATA( 24, GLsizei, imagesize );
    848     WRITE_DATA( 28, int, isnull );
    849 
    850     if (data) {
    851         crMemcpy( (void *)(data_ptr + 32), (void *)data, imagesize);
     891    WRITE_DATA( 28, int, noimagedata );
     892    WRITE_DATA( 32, uintptr_t, (uintptr_t) data);
     893
     894    if (!noimagedata) {
     895        crMemcpy( (void *)(data_ptr + 36), (void *)data, imagesize);
    852896    }
    853897
     
    860904    unsigned char *data_ptr;
    861905    int packet_length;
    862     int isnull = (data == NULL);
     906    int noimagedata = (data == NULL) || crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB);
    863907
    864908    /* All extended opcodes have their first 8 bytes predefined:
     
    876920        sizeof( format ) +
    877921        sizeof( imagesize ) +
    878         sizeof( int ); /* isnull */
    879 
    880     if (data)
     922        sizeof( int ) + sizeof(uintptr_t);
     923
     924    if (!noimagedata)
    881925    {
    882926        packet_length += imagesize;
     
    893937    WRITE_DATA( 28, GLenum, format );
    894938    WRITE_DATA( 32, GLsizei, imagesize );
    895     WRITE_DATA( 36, int, isnull );
    896 
    897     if (data) {
    898         crMemcpy( (void *)(data_ptr + 40), (void *)data, imagesize);
     939    WRITE_DATA( 36, int, noimagedata );
     940    WRITE_DATA( 40, uintptr_t, (uintptr_t) data);
     941
     942    if (!noimagedata) {
     943        crMemcpy( (void *)(data_ptr + 44), (void *)data, imagesize);
    899944    }
    900945
     
    907952    unsigned char *data_ptr;
    908953    int packet_length;
    909     int isnull = (data == NULL);
     954    int noimagedata = (data == NULL) || crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB);
    910955
    911956    /* All extended opcodes have their first 8 bytes predefined:
     
    925970        sizeof( format ) +
    926971        sizeof( imagesize ) +
    927         sizeof( int ); /* isnull */
    928 
    929     if (data)
     972        sizeof( int ) + sizeof(uintptr_t);
     973
     974    if (!noimagedata)
    930975    {
    931976        packet_length += imagesize;
     
    944989    WRITE_DATA( 36, GLenum, format );
    945990    WRITE_DATA( 40, GLsizei, imagesize );
    946     WRITE_DATA( 44, int, isnull );
    947 
    948     if (data) {
    949         crMemcpy( (void *)(data_ptr + 48), (void *)data, imagesize);
     991    WRITE_DATA( 44, int, noimagedata );
     992    WRITE_DATA( 48, uintptr_t, (uintptr_t) data);
     993
     994    if (!noimagedata) {
     995        crMemcpy( (void *)(data_ptr + 52), (void *)data, imagesize);
    950996    }
    951997
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_bufferobject.c

    r25303 r27091  
    2121        b->usage = GL_STATIC_DRAW_ARB;
    2222        b->access = GL_READ_WRITE_ARB;
     23        b->bResyncOnRead = GL_FALSE;
    2324    }
    2425    return b;
    2526}
    2627
     28GLboolean crStateIsBufferBound(GLenum target)
     29{
     30    CRContext *g = GetCurrentContext();
     31    CRBufferObjectState *b = &(g->bufferobject);
     32
     33    switch (target)
     34    {
     35        case GL_ARRAY_BUFFER_ARB:
     36            return b->arrayBuffer->name!=0;
     37        case GL_ELEMENT_ARRAY_BUFFER_ARB:
     38            return b->elementsBuffer->name!=0;
     39#ifdef CR_ARB_pixel_buffer_object
     40        case GL_PIXEL_PACK_BUFFER_ARB:
     41            return b->packBuffer->name!=0;
     42        case GL_PIXEL_UNPACK_BUFFER_ARB:
     43            return b->unpackBuffer->name!=0;
     44#endif
     45        default:
     46            return GL_FALSE;
     47    }
     48}
     49
     50CRBufferObject *crStateGetBoundBufferObject(GLenum target, CRBufferObjectState *b)
     51{
     52    switch (target)
     53    {
     54        case GL_ARRAY_BUFFER_ARB:
     55            return b->arrayBuffer;
     56        case GL_ELEMENT_ARRAY_BUFFER_ARB:
     57            return b->elementsBuffer;
     58#ifdef CR_ARB_pixel_buffer_object
     59        case GL_PIXEL_PACK_BUFFER_ARB:
     60            return b->packBuffer;
     61        case GL_PIXEL_UNPACK_BUFFER_ARB:
     62            return b->unpackBuffer;
     63#endif
     64        default:
     65            return NULL;
     66    }
     67}
    2768
    2869void crStateBufferObjectInit (CRContext *ctx)
     
    4687    b->elementsBuffer = b->nullBuffer;
    4788    b->nullBuffer->refCount = 3;
     89#ifdef CR_ARB_pixel_buffer_object
     90    b->packBuffer = b->nullBuffer;
     91    b->unpackBuffer = b->nullBuffer;
     92    b->nullBuffer->refCount += 2;
     93#endif   
    4894
    4995    b->buffers = crAllocHashtable();
     
    92138    FLUSH();
    93139
    94     if (target == GL_ARRAY_BUFFER_ARB) {
    95         oldObj = b->arrayBuffer;
    96     }
    97     else if (target == GL_ELEMENT_ARRAY_BUFFER_ARB) {
    98         oldObj = b->elementsBuffer;
    99     }
    100     else {
    101         crStateError(__LINE__, __FILE__, GL_INVALID_ENUM,
    102                                  "glBindBufferARB(target)");
     140    oldObj = crStateGetBoundBufferObject(target, b);
     141    if (!oldObj)
     142    {
     143        crStateError(__LINE__, __FILE__, GL_INVALID_ENUM, "glBindBufferARB(target)");
    103144        return;
    104145    }
     
    122163    oldObj->refCount--;
    123164
    124     if (target == GL_ARRAY_BUFFER_ARB) {
    125         b->arrayBuffer = newObj;
    126         DIRTY(bb->dirty, g->neg_bitid);
    127         DIRTY(bb->arrayBinding, g->neg_bitid);
    128     }
    129     else {
    130         CRASSERT(target == GL_ELEMENT_ARRAY_BUFFER_ARB);
    131         b->elementsBuffer = newObj;
    132         DIRTY(bb->dirty, g->neg_bitid);
    133         DIRTY(bb->elementsBinding, g->neg_bitid);
     165    switch (target)
     166    {
     167        case GL_ARRAY_BUFFER_ARB:
     168            b->arrayBuffer = newObj;
     169            DIRTY(bb->dirty, g->neg_bitid);
     170            DIRTY(bb->arrayBinding, g->neg_bitid);
     171            break;
     172        case GL_ELEMENT_ARRAY_BUFFER_ARB:
     173            b->elementsBuffer = newObj;
     174            DIRTY(bb->dirty, g->neg_bitid);
     175            DIRTY(bb->elementsBinding, g->neg_bitid);
     176            break;
     177#ifdef CR_ARB_pixel_buffer_object
     178        case GL_PIXEL_PACK_BUFFER_ARB:
     179            b->packBuffer = newObj;
     180            DIRTY(bb->dirty, g->neg_bitid);
     181            DIRTY(bb->packBinding, g->neg_bitid);
     182            break;
     183        case GL_PIXEL_UNPACK_BUFFER_ARB:
     184            b->unpackBuffer = newObj;
     185            DIRTY(bb->dirty, g->neg_bitid);
     186            DIRTY(bb->unpackBinding, g->neg_bitid);
     187            break;
     188#endif
     189        default: /*can't get here*/
     190            CRASSERT(false);
     191            return;
    134192    }
    135193
     
    139197        crHashtableDelete(b->buffers, (unsigned long) oldObj->name, crStateFreeBufferObject);
    140198    }
     199
     200#ifdef IN_GUEST
     201    if (target == GL_PIXEL_PACK_BUFFER_ARB)
     202    {
     203        newObj->bResyncOnRead = GL_TRUE;
     204    }
     205#endif
    141206}
    142207
     
    169234                crHashtableSearch(b->buffers, buffers[i]);
    170235            if (obj) {
    171                 if (obj == b->arrayBuffer) {
     236                if (obj == b->arrayBuffer)
     237                {
    172238                    b->arrayBuffer = b->nullBuffer;
    173239                    b->arrayBuffer->refCount++;
    174240                    DIRTY(bb->dirty, g->neg_bitid);
    175241                    DIRTY(bb->arrayBinding, g->neg_bitid);
    176                 }
    177                 if (obj == b->elementsBuffer) {
     242                }
     243                else if (obj == b->elementsBuffer)
     244                {
    178245                    b->elementsBuffer = b->nullBuffer;
    179246                    b->elementsBuffer->refCount++;
     
    181248                    DIRTY(bb->elementsBinding, g->neg_bitid);
    182249                }
     250#ifdef CR_ARB_pixel_buffer_object
     251                else if (obj == b->packBuffer)
     252                {
     253                    b->packBuffer = b->nullBuffer;
     254                    b->packBuffer->refCount++;
     255                    DIRTY(bb->dirty, g->neg_bitid);
     256                    DIRTY(bb->packBinding, g->neg_bitid);
     257                }
     258                else if (obj == b->unpackBuffer)
     259                {
     260                    b->unpackBuffer = b->nullBuffer;
     261                    b->unpackBuffer->refCount++;
     262                    DIRTY(bb->dirty, g->neg_bitid);
     263                    DIRTY(bb->unpackBinding, g->neg_bitid);
     264                }
     265#endif
    183266                /* @todo check bindings with the vertex arrays */
    184267
     
    285368    }
    286369
    287     if (target == GL_ARRAY_BUFFER_ARB) {
    288         obj = b->arrayBuffer;
    289     }
    290     else if (target == GL_ELEMENT_ARRAY_BUFFER_ARB) {
    291         obj = b->elementsBuffer;
    292     }
    293     else {
    294         crStateError(__LINE__, __FILE__, GL_INVALID_ENUM,
    295                                  "glBufferDataARB(target)");
     370    obj = crStateGetBoundBufferObject(target, b);
     371    if (!obj)
     372    {
     373        crStateError(__LINE__, __FILE__, GL_INVALID_ENUM, "glBufferDataARB(target)");
    296374        return;
    297375    }
     
    352430    }
    353431
    354     if (target == GL_ARRAY_BUFFER_ARB) {
    355         obj = b->arrayBuffer;
    356     }
    357     else if (target == GL_ELEMENT_ARRAY_BUFFER_ARB) {
    358         obj = b->elementsBuffer;
    359     }
    360     else {
    361         crStateError(__LINE__, __FILE__, GL_INVALID_ENUM,
    362                                  "glBufferSubDataARB(target)");
     432    obj = crStateGetBoundBufferObject(target, b);
     433    if (!obj)
     434    {
     435        crStateError(__LINE__, __FILE__, GL_INVALID_ENUM, "glBufferSubDataARB(target)");
    363436        return;
    364437    }
     
    411484    }
    412485
    413     if (target == GL_ARRAY_BUFFER_ARB) {
    414         obj = b->arrayBuffer;
    415     }
    416     else if (target == GL_ELEMENT_ARRAY_BUFFER_ARB) {
    417         obj = b->elementsBuffer;
    418     }
    419     else {
    420         crStateError(__LINE__, __FILE__, GL_INVALID_ENUM,
    421                                  "glGetBufferSubDataARB(target)");
     486    obj = crStateGetBoundBufferObject(target, b);
     487    if (!obj)
     488    {
     489        crStateError(__LINE__, __FILE__, GL_INVALID_ENUM, "glGetBufferSubDataARB(target)");
    422490        return;
    423491    }
     
    462530    }
    463531
    464     if (target == GL_ARRAY_BUFFER_ARB) {
    465         obj = b->arrayBuffer;
    466     }
    467     else if (target == GL_ELEMENT_ARRAY_BUFFER_ARB) {
    468         obj = b->elementsBuffer;
    469     }
    470     else {
    471         crStateError(__LINE__, __FILE__, GL_INVALID_ENUM,
    472                                  "glMapBufferARB(target)");
     532    obj = crStateGetBoundBufferObject(target, b);
     533    if (!obj)
     534    {
     535        crStateError(__LINE__, __FILE__, GL_INVALID_ENUM, "glMapBufferARB(target)");
    473536        return NULL;
    474537    }
     
    515578    }
    516579
    517     if (target == GL_ARRAY_BUFFER_ARB) {
    518         obj = b->arrayBuffer;
    519     }
    520     else if (target == GL_ELEMENT_ARRAY_BUFFER_ARB) {
    521         obj = b->elementsBuffer;
    522     }
    523     else {
    524         crStateError(__LINE__, __FILE__, GL_INVALID_ENUM,
    525                                  "glUnmapBufferARB(target)");
     580    obj = crStateGetBoundBufferObject(target, b);
     581    if (!obj)
     582    {
     583        crStateError(__LINE__, __FILE__, GL_INVALID_ENUM, "glUnmapBufferARB(target)");
    526584        return GL_FALSE;
    527585    }
     
    566624    }
    567625
    568     if (target == GL_ARRAY_BUFFER_ARB) {
    569         obj = b->arrayBuffer;
    570     }
    571     else if (target == GL_ELEMENT_ARRAY_BUFFER_ARB) {
    572         obj = b->elementsBuffer;
    573     }
    574     else {
    575         crStateError(__LINE__, __FILE__, GL_INVALID_ENUM,
    576                                  "glGetBufferParameterivARB(target)");
     626    obj = crStateGetBoundBufferObject(target, b);
     627    if (!obj)
     628    {
     629        crStateError(__LINE__, __FILE__, GL_INVALID_ENUM, "glGetBufferParameterivARB(target)");
    577630        return;
    578631    }
     
    614667    }
    615668
    616     if (target == GL_ARRAY_BUFFER_ARB) {
    617         obj = b->arrayBuffer;
    618     }
    619     else if (target == GL_ELEMENT_ARRAY_BUFFER_ARB) {
    620         obj = b->elementsBuffer;
    621     }
    622     else {
    623         crStateError(__LINE__, __FILE__, GL_INVALID_ENUM,
    624                                  "glGetBufferPointervARB(target)");
     669    obj = crStateGetBoundBufferObject(target, b);
     670    if (!obj)
     671    {
     672        crStateError(__LINE__, __FILE__, GL_INVALID_ENUM, "glGetBufferPointervARB(target)");
    625673        return;
    626674    }
    627675
    628676    if (pname != GL_BUFFER_MAP_POINTER_ARB) {
    629         crStateError(__LINE__, __FILE__, GL_INVALID_ENUM,
    630                                  "glGetBufferPointervARB(pname)");
     677        crStateError(__LINE__, __FILE__, GL_INVALID_ENUM, "glGetBufferPointervARB(pname)");
    631678        return;
    632679    }
     
    672719}
    673720
    674 
    675 void crStateBufferObjectDiff(CRBufferObjectBits *bb, CRbitvalue *bitID,
    676                                                          CRContext *fromCtx, CRContext *toCtx)
     721static crStateBufferObjectIntCmp(CRBufferObjectBits *bb, CRbitvalue *bitID,
     722                                 CRContext *fromCtx, CRContext *toCtx,
     723                                 GLboolean bSwitch)
    677724{
    678725    CRBufferObjectState *from = &(fromCtx->bufferobject);
    679726    const CRBufferObjectState *to = &(toCtx->bufferobject);
    680727
    681     if (!HaveBufferObjectExtension())
    682         return;
    683 
    684     /* ARRAY_BUFFER binding */
    685     if (CHECKDIRTY(bb->arrayBinding, bitID)) {
    686         if (from->arrayBuffer != to->arrayBuffer) {
     728    /* ARRAY_BUFFER */
     729    if (CHECKDIRTY(bb->arrayBinding, bitID))
     730    {
     731        if (from->arrayBuffer != to->arrayBuffer)
     732        {
    687733            GLuint bufferID = to->arrayBuffer ? to->arrayBuffer->name : 0;
    688734            diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, bufferID);
    689             CLEARDIRTY2(bb->arrayBinding, bitID);
    690             from->arrayBuffer = to->arrayBuffer;
    691         }
    692     }
    693 
    694     if (to->arrayBuffer && CHECKDIRTY(to->arrayBuffer->dirty, bitID)) {
     735            if (bSwitch)
     736            {
     737                FILLDIRTY(bb->arrayBinding);
     738            }
     739            else
     740            {
     741                CLEARDIRTY2(bb->arrayBinding, bitID);
     742                from->arrayBuffer = to->arrayBuffer;
     743            }
     744        }
     745        if (bSwitch) CLEARDIRTY2(bb->arrayBinding, bitID);
     746    }
     747
     748    if (to->arrayBuffer && CHECKDIRTY(to->arrayBuffer->dirty, bitID))
     749    {
    695750        /* update array buffer data */
    696751        CRBufferObject *bufObj = to->arrayBuffer;
    697752        CRASSERT(bufObj);
    698         if (bufObj->dirtyStart == 0 && bufObj->dirtyLength == (int) bufObj->size) {
     753        if (bufObj->dirtyStart == 0 && bufObj->dirtyLength == (int) bufObj->size)
     754        {
    699755            /* update whole buffer */
    700756            diff_api.BufferDataARB(GL_ARRAY_BUFFER_ARB, bufObj->size,
    701                                                          bufObj->data, bufObj->usage);
    702         }
    703         else {
     757                                   bufObj->data, bufObj->usage);
     758        }
     759        else
     760        {
    704761            /* update sub buffer */
    705762            diff_api.BufferSubDataARB(GL_ARRAY_BUFFER_ARB,
    706                                                                 bufObj->dirtyStart,
    707                                                                 bufObj->dirtyLength,
    708                                                                 (char *) bufObj->data
    709                                                                 + bufObj->dirtyStart);
    710         }
     763                                      bufObj->dirtyStart, bufObj->dirtyLength,
     764                                      (char *) bufObj->data + bufObj->dirtyStart);
     765        }
     766        if (bSwitch) FILLDIRTY(bufObj->dirty);
    711767        CLEARDIRTY2(bufObj->dirty, bitID);
    712 #if 0
    713         bufObj->dirtyStart = 0;
    714         bufObj->dirtyLength = 0;
    715 #endif
    716     }
    717 
    718     /* ELEMENTS_BUFFER binding */
    719     if (CHECKDIRTY(bb->elementsBinding, bitID)) {
    720         if (from->elementsBuffer != to->elementsBuffer) {
     768    }
     769
     770    /* ELEMENTS_BUFFER */
     771    if (CHECKDIRTY(bb->elementsBinding, bitID))
     772    {
     773        if (from->elementsBuffer != to->elementsBuffer)
     774        {
    721775            GLuint bufferID = to->elementsBuffer ? to->elementsBuffer->name : 0;
    722776            diff_api.BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, bufferID);
    723             CLEARDIRTY2(bb->elementsBinding, bitID);
    724             from->elementsBuffer = to->elementsBuffer;
    725         }
    726     }
    727 
    728     if (to->elementsBuffer && CHECKDIRTY(to->elementsBuffer->dirty, bitID)) {
    729         /* update element buffer data */
     777            if (bSwitch)
     778            {
     779                FILLDIRTY(bb->elementsBinding);
     780            }
     781            else
     782            {
     783                CLEARDIRTY2(bb->elementsBinding, bitID);
     784                from->elementsBuffer = to->elementsBuffer;
     785            }
     786        }
     787        if (bSwitch) CLEARDIRTY2(bb->elementsBinding, bitID);
     788    }
     789
     790    if (to->elementsBuffer && CHECKDIRTY(to->elementsBuffer->dirty, bitID))
     791    {
     792        /* update array buffer data */
    730793        CRBufferObject *bufObj = to->elementsBuffer;
    731794        CRASSERT(bufObj);
    732         if (bufObj->dirtyStart == 0 && bufObj->dirtyLength == (int) bufObj->size) {
     795        if (bufObj->dirtyStart == 0 && bufObj->dirtyLength == (int) bufObj->size)
     796        {
    733797            /* update whole buffer */
    734798            diff_api.BufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, bufObj->size,
    735                                                          bufObj->data, bufObj->usage);
    736         }
    737         else {
     799                                   bufObj->data, bufObj->usage);
     800        }
     801        else
     802        {
    738803            /* update sub buffer */
    739804            diff_api.BufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB,
    740                                                                 bufObj->dirtyStart,
    741                                                                 bufObj->dirtyLength,
    742                                                                 (char *) bufObj->data
    743                                                                 + bufObj->dirtyStart);
    744         }
     805                                      bufObj->dirtyStart, bufObj->dirtyLength,
     806                                      (char *) bufObj->data + bufObj->dirtyStart);
     807        }
     808        if (bSwitch) FILLDIRTY(bufObj->dirty);
    745809        CLEARDIRTY2(bufObj->dirty, bitID);
    746 #if 0
    747         bufObj->dirtyStart = 0;
    748         bufObj->dirtyLength = 0;
    749 #endif
    750     }
     810    }
     811
     812#ifdef CR_ARB_pixel_buffer_object
     813    /* PIXEL_PACK_BUFFER */
     814    if (CHECKDIRTY(bb->packBinding, bitID))
     815    {
     816        if (from->packBuffer != to->packBuffer)
     817        {
     818            GLuint bufferID = to->packBuffer ? to->packBuffer->name : 0;
     819            diff_api.BindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, bufferID);
     820            if (bSwitch)
     821            {
     822                FILLDIRTY(bb->packBinding);
     823            }
     824            else
     825            {
     826                CLEARDIRTY2(bb->packBinding, bitID);
     827                from->packBuffer = to->packBuffer;
     828            }
     829        }
     830        if (bSwitch) CLEARDIRTY2(bb->packBinding, bitID);
     831    }
     832
     833    if (to->packBuffer && CHECKDIRTY(to->packBuffer->dirty, bitID))
     834    {
     835        /* update array buffer data */
     836        CRBufferObject *bufObj = to->packBuffer;
     837        CRASSERT(bufObj);
     838        if (bufObj->dirtyStart == 0 && bufObj->dirtyLength == (int) bufObj->size)
     839        {
     840            /* update whole buffer */
     841            diff_api.BufferDataARB(GL_PIXEL_PACK_BUFFER_ARB, bufObj->size,
     842                                   bufObj->data, bufObj->usage);
     843        }
     844        else
     845        {
     846            /* update sub buffer */
     847            diff_api.BufferSubDataARB(GL_PIXEL_PACK_BUFFER_ARB,
     848                                      bufObj->dirtyStart, bufObj->dirtyLength,
     849                                      (char *) bufObj->data + bufObj->dirtyStart);
     850        }
     851        if (bSwitch) FILLDIRTY(bufObj->dirty);
     852        CLEARDIRTY2(bufObj->dirty, bitID);
     853    }
     854
     855    /* PIXEL_UNPACK_BUFFER */
     856    if (CHECKDIRTY(bb->unpackBinding, bitID))
     857    {
     858        if (from->unpackBuffer != to->unpackBuffer)
     859        {
     860            GLuint bufferID = to->unpackBuffer ? to->unpackBuffer->name : 0;
     861            diff_api.BindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, bufferID);
     862            if (bSwitch)
     863            {
     864                FILLDIRTY(bb->unpackBinding);
     865            }
     866            else
     867            {
     868                CLEARDIRTY2(bb->unpackBinding, bitID);
     869                from->unpackBuffer = to->unpackBuffer;
     870            }
     871        }
     872        if (bSwitch) CLEARDIRTY2(bb->unpackBinding, bitID);
     873    }
     874
     875    if (to->unpackBuffer && CHECKDIRTY(to->unpackBuffer->dirty, bitID))
     876    {
     877        /* update array buffer data */
     878        CRBufferObject *bufObj = to->unpackBuffer;
     879        CRASSERT(bufObj);
     880        if (bufObj->dirtyStart == 0 && bufObj->dirtyLength == (int) bufObj->size)
     881        {
     882            /* update whole buffer */
     883            diff_api.BufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, bufObj->size,
     884                                   bufObj->data, bufObj->usage);
     885        }
     886        else
     887        {
     888            /* update sub buffer */
     889            diff_api.BufferSubDataARB(GL_PIXEL_UNPACK_BUFFER_ARB,
     890                                      bufObj->dirtyStart, bufObj->dirtyLength,
     891                                      (char *) bufObj->data + bufObj->dirtyStart);
     892        }
     893        if (bSwitch) FILLDIRTY(bufObj->dirty);
     894        CLEARDIRTY2(bufObj->dirty, bitID);
     895    }
     896#endif /*ifdef CR_ARB_pixel_buffer_object*/
     897}
     898
     899void crStateBufferObjectDiff(CRBufferObjectBits *bb, CRbitvalue *bitID,
     900                             CRContext *fromCtx, CRContext *toCtx)
     901{
     902    CRBufferObjectState *from = &(fromCtx->bufferobject);
     903    const CRBufferObjectState *to = &(toCtx->bufferobject);
     904
     905    if (!HaveBufferObjectExtension())
     906        return;
     907
     908    crStateBufferObjectIntCmp(bb, bitID, fromCtx, toCtx, GL_FALSE);
    751909}
    752910
     
    758916    if (pBufferObj->data)
    759917    {
     918        /*@todo http://www.opengl.org/registry/specs/ARB/pixel_buffer_object.txt
     919          "While it is entirely legal to create a buffer object by binding
     920          it to GL_ARRAY_BUFFER and loading it with data, then using it
     921          with the GL_PIXEL_UNPACK_BUFFER_ARB or GL_PIXEL_PACK_BUFFER_ARB
     922          binding, such behavior is liable to confuse the driver and may
     923          hurt performance."
     924         */
    760925        diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, pBufferObj->name);
    761926        diff_api.BufferDataARB(GL_ARRAY_BUFFER_ARB, pBufferObj->size, pBufferObj->data, pBufferObj->usage);
     
    8681033        diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, to->arrayBuffer->name);
    8691034        diff_api.BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, to->elementsBuffer->name);
    870     }
    871 
    872     /* ARRAY_BUFFER binding */
    873     if (CHECKDIRTY(bb->arrayBinding, bitID)) {
    874         if (from->arrayBuffer != to->arrayBuffer) {
    875             GLuint bufferID = to->arrayBuffer ? to->arrayBuffer->name : 0;
    876             diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, bufferID);
    877             FILLDIRTY(bb->arrayBinding);
    878         }
    879         CLEARDIRTY2(bb->arrayBinding, bitID);
    880     }
    881 
    882     if (to->arrayBuffer && CHECKDIRTY(to->arrayBuffer->dirty, bitID)) {
    883         /* update array buffer data */
    884         CRBufferObject *bufObj = to->arrayBuffer;
    885         CRASSERT(bufObj);
    886         if (bufObj->dirtyStart == 0 && bufObj->dirtyLength == (int) bufObj->size) {
    887             /* update whole buffer */
    888             diff_api.BufferDataARB(GL_ARRAY_BUFFER_ARB, bufObj->size,
    889                                                          bufObj->data, bufObj->usage);
    890         }
    891         else {
    892             /* update sub buffer */
    893             diff_api.BufferSubDataARB(GL_ARRAY_BUFFER_ARB,
    894                                                                 bufObj->dirtyStart,
    895                                                                 bufObj->dirtyLength,
    896                                                                 (char *) bufObj->data
    897                                                                 + bufObj->dirtyStart);
    898         }
    899         FILLDIRTY(bufObj->dirty);
    900         CLEARDIRTY2(bufObj->dirty, bitID);
    901 #if 0
    902         bufObj->dirtyStart = 0;
    903         bufObj->dirtyLength = 0;
     1035#ifdef CR_ARB_pixel_buffer_object
     1036        diff_api.BindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, to->packBuffer->name);
     1037        diff_api.BindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, to->unpackBuffer->name);
    9041038#endif
    9051039    }
    906 
    907     /* ELEMENTS_BUFFER binding */
    908     if (CHECKDIRTY(bb->elementsBinding, bitID)) {
    909         if (from->elementsBuffer != to->elementsBuffer) {
    910             GLuint bufferID = to->elementsBuffer ? to->elementsBuffer->name : 0;
    911             diff_api.BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, bufferID);
    912             FILLDIRTY(bb->elementsBinding);
    913         }
    914         CLEARDIRTY2(bb->elementsBinding, bitID);
    915     }
    916 
    917     if (to->elementsBuffer && CHECKDIRTY(to->elementsBuffer->dirty, bitID)) {
    918         /* update element buffer data */
    919         CRBufferObject *bufObj = to->elementsBuffer;
    920         CRASSERT(bufObj);
    921         if (bufObj->dirtyStart == 0 && bufObj->dirtyLength == (int) bufObj->size) {
    922             /* update whole buffer */
    923             diff_api.BufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, bufObj->size,
    924                                                          bufObj->data, bufObj->usage);
    925         }
    926         else {
    927             /* update sub buffer */
    928             diff_api.BufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB,
    929                                                                 bufObj->dirtyStart,
    930                                                                 bufObj->dirtyLength,
    931                                                                 (char *) bufObj->data
    932                                                                 + bufObj->dirtyStart);
    933         }
    934         FILLDIRTY(bufObj->dirty);
    935         CLEARDIRTY2(bufObj->dirty, bitID);
    936 #if 0
    937         bufObj->dirtyStart = 0;
    938         bufObj->dirtyLength = 0;
    939 #endif
    940     }
    941 }
    942 
    943 
     1040    else
     1041    {
     1042        crStateBufferObjectIntCmp(bb, bitID, fromCtx, toCtx, GL_TRUE);
     1043    }
     1044}
     1045
     1046
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_extensions_get.txt

    r15532 r27091  
    129129# GL_ARB_point_sprite
    130130GLboolean GL_POINT_SPRITE_ARB GL_ARB_point_sprite g->point.pointSprite
     131
     132# GL_ARB_vertex_buffer_object
     133GLuint GL_ARRAY_BUFFER_BINDING_ARB GL_ARB_vertex_buffer_object g->bufferobject.arrayBuffer->name
     134GLuint GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB GL_ARB_vertex_buffer_object g->bufferobject.elementsBuffer->name
     135
     136# GL_ARB_pixel_buffer_object
     137GLuint GL_PIXEL_PACK_BUFFER_BINDING_ARB GL_ARB_pixel_buffer_object g->bufferobject.packBuffer->name
     138GLuint GL_PIXEL_UNPACK_BUFFER_BINDING_ARB GL_ARB_pixel_buffer_object g->bufferobject.unpackBuffer->name
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_limits.c

    r16574 r27091  
    300300        if (hasExtension((const char*)limits->extensions, "GL_ARB_vertex_buffer_object"))
    301301                extensions->ARB_vertex_buffer_object = GL_TRUE;
     302
     303        if (hasExtension((const char*)limits->extensions, "GL_ARB_pixel_buffer_object"))
     304                extensions->ARB_pixel_buffer_object = GL_TRUE;
    302305
    303306        if (hasExtension((const char*)limits->extensions, "GL_ARB_vertex_program"))
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_pixel.c

    r27072 r27091  
    208208    CRPixelBits *pb = &(sb->pixel);
    209209    GLint i;
     210    GLboolean unpackbuffer = crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB);
    210211
    211212    if (g->current.inBeginEnd) {
     
    228229    case GL_PIXEL_MAP_S_TO_S:
    229230        p->mapStoSsize = mapsize;
    230         for (i=0;i<mapsize;i++) {
    231             p->mapStoS[i] = (GLint) values[i];
    232         }
     231        if (!unpackbuffer)
     232            for (i=0;i<mapsize;i++) {
     233                p->mapStoS[i] = (GLint) values[i];
     234            }
    233235        break;
    234236    case GL_PIXEL_MAP_I_TO_I:
    235237        p->mapItoIsize = mapsize;
     238        if (!unpackbuffer)
    236239        for (i=0;i<mapsize;i++) {
    237240            p->mapItoI[i] = (GLint) values[i];
     
    240243    case GL_PIXEL_MAP_I_TO_R:
    241244        p->mapItoRsize = mapsize;
    242         for (i=0;i<mapsize;i++) {
    243             GLfloat val = CLAMP( values[i], 0.0F, 1.0F );
    244             p->mapItoR[i] = val;
    245         }
     245        if (!unpackbuffer)
     246            for (i=0;i<mapsize;i++) {
     247                GLfloat val = CLAMP( values[i], 0.0F, 1.0F );
     248                p->mapItoR[i] = val;
     249            }
    246250        break;
    247251    case GL_PIXEL_MAP_I_TO_G:
    248252        p->mapItoGsize = mapsize;
    249         for (i=0;i<mapsize;i++) {
    250             GLfloat val = CLAMP( values[i], 0.0F, 1.0F );
    251             p->mapItoG[i] = val;
    252         }
     253        if (!unpackbuffer)
     254            for (i=0;i<mapsize;i++) {
     255                GLfloat val = CLAMP( values[i], 0.0F, 1.0F );
     256                p->mapItoG[i] = val;
     257            }
    253258        break;
    254259    case GL_PIXEL_MAP_I_TO_B:
    255260        p->mapItoBsize = mapsize;
    256         for (i=0;i<mapsize;i++) {
    257                     GLfloat val = CLAMP( values[i], 0.0F, 1.0F );
    258             p->mapItoB[i] = val;
    259         }
     261        if (!unpackbuffer)
     262            for (i=0;i<mapsize;i++) {
     263                GLfloat val = CLAMP( values[i], 0.0F, 1.0F );
     264                p->mapItoB[i] = val;
     265            }
    260266        break;
    261267    case GL_PIXEL_MAP_I_TO_A:
    262268        p->mapItoAsize = mapsize;
    263         for (i=0;i<mapsize;i++) {
    264                     GLfloat val = CLAMP( values[i], 0.0F, 1.0F );
    265             p->mapItoA[i] = val;
    266         }
     269        if (!unpackbuffer)
     270            for (i=0;i<mapsize;i++) {
     271                GLfloat val = CLAMP( values[i], 0.0F, 1.0F );
     272                p->mapItoA[i] = val;
     273            }
    267274        break;
    268275    case GL_PIXEL_MAP_R_TO_R:
    269276        p->mapRtoRsize = mapsize;
    270         for (i=0;i<mapsize;i++) {
    271             p->mapRtoR[i] = CLAMP( values[i], 0.0F, 1.0F );
    272         }
     277        if (!unpackbuffer)
     278            for (i=0;i<mapsize;i++) {
     279                p->mapRtoR[i] = CLAMP( values[i], 0.0F, 1.0F );
     280            }
    273281        break;
    274282    case GL_PIXEL_MAP_G_TO_G:
    275283        p->mapGtoGsize = mapsize;
    276         for (i=0;i<mapsize;i++) {
    277             p->mapGtoG[i] = CLAMP( values[i], 0.0F, 1.0F );
    278         }
     284        if (!unpackbuffer)
     285            for (i=0;i<mapsize;i++) {
     286                p->mapGtoG[i] = CLAMP( values[i], 0.0F, 1.0F );
     287            }
    279288        break;
    280289    case GL_PIXEL_MAP_B_TO_B:
    281290        p->mapBtoBsize = mapsize;
    282         for (i=0;i<mapsize;i++) {
    283             p->mapBtoB[i] = CLAMP( values[i], 0.0F, 1.0F );
    284         }
     291        if (!unpackbuffer)
     292            for (i=0;i<mapsize;i++) {
     293                p->mapBtoB[i] = CLAMP( values[i], 0.0F, 1.0F );
     294            }
    285295        break;
    286296    case GL_PIXEL_MAP_A_TO_A:
    287297        p->mapAtoAsize = mapsize;
    288         for (i=0;i<mapsize;i++) {
    289             p->mapAtoA[i] = CLAMP( values[i], 0.0F, 1.0F );
    290         }
     298        if (!unpackbuffer)
     299            for (i=0;i<mapsize;i++) {
     300                p->mapAtoA[i] = CLAMP( values[i], 0.0F, 1.0F );
     301            }
    291302        break;
    292303    default:
     
    301312void STATE_APIENTRY crStatePixelMapuiv (GLenum map, GLint mapsize, const GLuint * values)
    302313{
    303    GLfloat fvalues[CR_MAX_PIXEL_MAP_TABLE];
    304    GLint i;
    305    if (map==GL_PIXEL_MAP_I_TO_I || map==GL_PIXEL_MAP_S_TO_S) {
    306       for (i=0;i<mapsize;i++) {
    307          fvalues[i] = (GLfloat) values[i];
    308       }
    309    }
    310    else {
    311       for (i=0;i<mapsize;i++) {
    312          fvalues[i] = values[i] / 4294967295.0F;
    313       }
    314    }
    315    crStatePixelMapfv(map, mapsize, fvalues);
     314    GLfloat fvalues[CR_MAX_PIXEL_MAP_TABLE];
     315    GLint i;
     316
     317    if (!crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
     318    {
     319        if (map==GL_PIXEL_MAP_I_TO_I || map==GL_PIXEL_MAP_S_TO_S) {
     320           for (i=0;i<mapsize;i++) {
     321              fvalues[i] = (GLfloat) values[i];
     322           }
     323        }
     324        else {
     325           for (i=0;i<mapsize;i++) {
     326              fvalues[i] = values[i] / 4294967295.0F;
     327           }
     328        }
     329        crStatePixelMapfv(map, mapsize, fvalues);
     330    }
     331    else
     332    {
     333        crStatePixelMapfv(map, mapsize, (const GLfloat*) values);
     334    }
    316335}
    317336 
    318337void STATE_APIENTRY crStatePixelMapusv (GLenum map, GLint mapsize, const GLushort * values)
    319338{
    320    GLfloat fvalues[CR_MAX_PIXEL_MAP_TABLE];
    321    GLint i;
    322    if (map==GL_PIXEL_MAP_I_TO_I || map==GL_PIXEL_MAP_S_TO_S) {
    323       for (i=0;i<mapsize;i++) {
    324          fvalues[i] = (GLfloat) values[i];
    325       }
    326    }
    327    else {
    328       for (i=0;i<mapsize;i++) {
    329          fvalues[i] = values[i] / 65535.0F;
    330       }
    331    }
    332    crStatePixelMapfv(map, mapsize, fvalues);
     339    GLfloat fvalues[CR_MAX_PIXEL_MAP_TABLE];
     340    GLint i;
     341
     342    if (!crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
     343    {
     344        if (map==GL_PIXEL_MAP_I_TO_I || map==GL_PIXEL_MAP_S_TO_S) {
     345           for (i=0;i<mapsize;i++) {
     346              fvalues[i] = (GLfloat) values[i];
     347           }
     348        }
     349        else {
     350           for (i=0;i<mapsize;i++) {
     351              fvalues[i] = values[i] / 65535.0F;
     352           }
     353        }
     354        crStatePixelMapfv(map, mapsize, fvalues);
     355    }
     356    else
     357    {
     358        crStatePixelMapfv(map, mapsize, (const GLfloat*) values);
     359    }
    333360}
    334361
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_polygon.c

    r27069 r27091  
    179179    FLUSH();
    180180
    181     if (!p)
     181    if (!p && !crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
    182182    {
    183183        crStateError(__LINE__, __FILE__, GL_NO_ERROR,
     
    186186    }
    187187
    188     crMemcpy((char*)poly->stipple, (char*)p, 128);
     188    /*@todo track mask if buffer is bound?*/
     189    if (!crStateIsBufferBound(GL_PIXEL_UNPACK_BUFFER_ARB))
     190    {
     191        crMemcpy((char*)poly->stipple, (char*)p, 128);
     192    }
    189193
    190194    DIRTY(pb->dirty, g->neg_bitid);
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_snapshot.c

    r27034 r27091  
    11861186    rc = SSMR3PutU32(pSSM, pContext->bufferobject.elementsBuffer->name);
    11871187    AssertRCReturn(rc, rc);
     1188#ifdef CR_ARB_pixel_buffer_object
     1189    rc = SSMR3PutU32(pSSM, pContext->bufferobject.packBuffer->name);
     1190    AssertRCReturn(rc, rc);
     1191    rc = SSMR3PutU32(pSSM, pContext->bufferobject.unpackBuffer->name);
     1192    AssertRCReturn(rc, rc);
     1193#endif
    11881194    /* Save clint pointers and buffer bindings*/
    11891195    for (i=0; i<CRSTATECLIENT_MAX_VERTEXARRAYS; ++i)
     
    16711677    AssertRCReturn(rc, rc);
    16721678    pContext->bufferobject.elementsBuffer = CRS_GET_BO(ui);
     1679#ifdef CR_ARB_pixel_buffer_object
     1680    rc = SSMR3GetU32(pSSM, &ui);
     1681    AssertRCReturn(rc, rc);
     1682    pContext->bufferobject.packBuffer = CRS_GET_BO(ui);
     1683    rc = SSMR3GetU32(pSSM, &ui);
     1684    AssertRCReturn(rc, rc);
     1685    pContext->bufferobject.unpackBuffer = CRS_GET_BO(ui);
     1686#endif
    16731687#undef CRS_GET_BO
    16741688
     
    19521966        FILLDIRTY(pBits->bufferobject.arrayBinding);
    19531967        FILLDIRTY(pBits->bufferobject.elementsBinding);
     1968# ifdef CR_ARB_pixel_buffer_object
     1969        FILLDIRTY(pBits->bufferobject.packBinding);
     1970        FILLDIRTY(pBits->bufferobject.unpackBinding);
     1971# endif
    19541972#endif
    19551973
  • trunk/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp

    r26407 r27091  
    7171
    7272static const char* gszVBoxOGLSSMMagic = "***OpenGL state data***";
    73 #define SHCROGL_SSM_VERSION 14
     73#define SHCROGL_SSM_VERSION 15
    7474
    7575typedef struct
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_getpixelmap.c

    r15532 r27091  
    1515static GLint __sizeQuery( GLenum map )
    1616{
    17         GLint get_values;
    18         /* Windows compiler gets mad if variables might be uninitialized */
    19         GLenum newmap = GL_PIXEL_MAP_I_TO_I_SIZE;
     17    GLint get_values;
     18    /* Windows compiler gets mad if variables might be uninitialized */
     19    GLenum newmap = GL_PIXEL_MAP_I_TO_I_SIZE;
    2020
    21         switch( map )
    22         {
    23                 case GL_PIXEL_MAP_I_TO_I:
    24                         newmap = GL_PIXEL_MAP_I_TO_I_SIZE;
    25                         break;
    26                 case GL_PIXEL_MAP_S_TO_S:
    27                         newmap = GL_PIXEL_MAP_S_TO_S_SIZE;
    28                         break;
    29                 case GL_PIXEL_MAP_I_TO_R:
    30                         newmap = GL_PIXEL_MAP_I_TO_R_SIZE;
    31                         break;
    32                 case GL_PIXEL_MAP_I_TO_G:
    33                         newmap = GL_PIXEL_MAP_I_TO_G_SIZE;
    34                         break;
    35                 case GL_PIXEL_MAP_I_TO_B:
    36                         newmap = GL_PIXEL_MAP_I_TO_B_SIZE;
    37                         break;
    38                 case GL_PIXEL_MAP_I_TO_A:
    39                         newmap = GL_PIXEL_MAP_I_TO_A_SIZE;
    40                         break;
    41                 case GL_PIXEL_MAP_R_TO_R:
    42                         newmap = GL_PIXEL_MAP_R_TO_R_SIZE;
    43                         break;
    44                 case GL_PIXEL_MAP_G_TO_G:
    45                         newmap = GL_PIXEL_MAP_G_TO_G_SIZE;
    46                         break;
    47                 case GL_PIXEL_MAP_B_TO_B:
    48                         newmap = GL_PIXEL_MAP_B_TO_B_SIZE;
    49                         break;
    50                 case GL_PIXEL_MAP_A_TO_A:
    51                         newmap = GL_PIXEL_MAP_A_TO_A_SIZE;
    52                         break;
    53                 default:
    54                         crError( "Bad map in crServerDispatchGetPixelMap: %d", map );
    55                         break;
    56         }
     21    switch( map )
     22    {
     23        case GL_PIXEL_MAP_I_TO_I:
     24            newmap = GL_PIXEL_MAP_I_TO_I_SIZE;
     25            break;
     26        case GL_PIXEL_MAP_S_TO_S:
     27            newmap = GL_PIXEL_MAP_S_TO_S_SIZE;
     28            break;
     29        case GL_PIXEL_MAP_I_TO_R:
     30            newmap = GL_PIXEL_MAP_I_TO_R_SIZE;
     31            break;
     32        case GL_PIXEL_MAP_I_TO_G:
     33            newmap = GL_PIXEL_MAP_I_TO_G_SIZE;
     34            break;
     35        case GL_PIXEL_MAP_I_TO_B:
     36            newmap = GL_PIXEL_MAP_I_TO_B_SIZE;
     37            break;
     38        case GL_PIXEL_MAP_I_TO_A:
     39            newmap = GL_PIXEL_MAP_I_TO_A_SIZE;
     40            break;
     41        case GL_PIXEL_MAP_R_TO_R:
     42            newmap = GL_PIXEL_MAP_R_TO_R_SIZE;
     43            break;
     44        case GL_PIXEL_MAP_G_TO_G:
     45            newmap = GL_PIXEL_MAP_G_TO_G_SIZE;
     46            break;
     47        case GL_PIXEL_MAP_B_TO_B:
     48            newmap = GL_PIXEL_MAP_B_TO_B_SIZE;
     49            break;
     50        case GL_PIXEL_MAP_A_TO_A:
     51            newmap = GL_PIXEL_MAP_A_TO_A_SIZE;
     52            break;
     53        default:
     54            crError( "Bad map in crServerDispatchGetPixelMap: %d", map );
     55            break;
     56    }
    5757
    58         cr_server.head_spu->dispatch_table.GetIntegerv( newmap, &get_values );
     58    cr_server.head_spu->dispatch_table.GetIntegerv( newmap, &get_values );
    5959
    60         return get_values;
     60    return get_values;
    6161}
    6262
    6363void SERVER_DISPATCH_APIENTRY crServerDispatchGetPixelMapfv( GLenum map, GLfloat *values )
    6464{
    65         int size = sizeof( GLfloat );
    66         int tabsize = __sizeQuery( map );
    67         GLfloat *local_values;
     65#ifdef CR_ARB_pixel_buffer_object
     66    if (crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
     67    {
     68        GLvoid *pbo_offset;
    6869
    69         (void) values;
     70        pbo_offset = (GLfloat*) ((uintptr_t) *((GLvoid**)values));
    7071
    71         size *= tabsize;
    72         local_values = (GLfloat*)crAlloc( size );
     72        cr_server.head_spu->dispatch_table.GetPixelMapfv( map, pbo_offset );
     73    }
     74    else
     75#endif
     76    {
     77        int size = sizeof( GLfloat );
     78        int tabsize = __sizeQuery( map );
     79        GLfloat *local_values;
    7380
    74         cr_server.head_spu->dispatch_table.GetPixelMapfv( map, local_values );
    75         crServerReturnValue( local_values, size );
    76         crFree( local_values );
     81        size *= tabsize;
     82        local_values = (GLfloat*)crAlloc( size );
     83
     84        cr_server.head_spu->dispatch_table.GetPixelMapfv( map, local_values );
     85        crServerReturnValue( local_values, size );
     86        crFree( local_values );
     87    }
    7788}
    7889
    7990void SERVER_DISPATCH_APIENTRY crServerDispatchGetPixelMapuiv( GLenum map, GLuint *values )
    8091{
    81         int size = sizeof( GLuint );
    82         int tabsize = __sizeQuery( map );
    83         GLuint *local_values;
    84         (void) values;
     92#ifdef CR_ARB_pixel_buffer_object
     93    if (crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
     94    {
     95        GLvoid *pbo_offset;
    8596
    86         size *= tabsize;
    87         local_values = (GLuint*)crAlloc( size );
     97        pbo_offset = (GLuint*) ((uintptr_t) *((GLvoid**)values));
    8898
    89         cr_server.head_spu->dispatch_table.GetPixelMapuiv( map, local_values );
    90         crServerReturnValue( local_values, size );
    91         crFree( local_values );
     99        cr_server.head_spu->dispatch_table.GetPixelMapuiv( map, pbo_offset );
     100    }
     101    else
     102#endif
     103    {
     104        int size = sizeof( GLuint );
     105        int tabsize = __sizeQuery( map );
     106        GLuint *local_values;
     107
     108        size *= tabsize;
     109        local_values = (GLuint*)crAlloc( size );
     110
     111        cr_server.head_spu->dispatch_table.GetPixelMapuiv( map, local_values );
     112        crServerReturnValue( local_values, size );
     113        crFree( local_values );
     114    }
    92115}
    93116
    94117void SERVER_DISPATCH_APIENTRY crServerDispatchGetPixelMapusv( GLenum map, GLushort *values )
    95118{
    96         int size = sizeof( GLushort );
    97         int tabsize = __sizeQuery( map );
    98         GLushort *local_values;
    99         (void) values;
     119#ifdef CR_ARB_pixel_buffer_object
     120    if (crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
     121    {
     122        GLvoid *pbo_offset;
    100123
    101         size *= tabsize;
    102         local_values = (GLushort*)crAlloc( size );
     124        pbo_offset = (GLushort*) ((uintptr_t) *((GLvoid**)values));
    103125
    104         cr_server.head_spu->dispatch_table.GetPixelMapusv( map, local_values );
    105         crServerReturnValue( local_values, size );
    106         crFree( local_values );
     126        cr_server.head_spu->dispatch_table.GetPixelMapusv( map, pbo_offset );
     127    }
     128    else
     129#endif
     130    {
     131        int size = sizeof( GLushort );
     132        int tabsize = __sizeQuery( map );
     133        GLushort *local_values;
     134
     135        size *= tabsize;
     136        local_values = (GLushort*)crAlloc( size );
     137
     138        cr_server.head_spu->dispatch_table.GetPixelMapusv( map, local_values );
     139        crServerReturnValue( local_values, size );
     140        crFree( local_values );
     141    }
    107142}
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_getteximage.c

    r21832 r27091  
    1818    GLsizei width, height, depth, size;
    1919    GLvoid *buffer = NULL;
     20
     21
     22#ifdef CR_ARB_pixel_buffer_object
     23    if (crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
     24    {
     25        GLvoid *pbo_offset;
     26
     27        /*pixels are actualy a pointer to location of 8byte network pointer in hgcm buffer
     28          regarless of guest/host bitness we're using only 4lower bytes as there're no
     29          pbo>4gb (yet?)
     30         */
     31        pbo_offset = (GLvoid*) ((uintptr_t) *((GLvoid**)pixels));
     32
     33        cr_server.head_spu->dispatch_table.GetTexImage(target, level, format, type, pbo_offset);
     34
     35        return;
     36    }
     37#endif
    2038
    2139    cr_server.head_spu->dispatch_table.GetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &width);
     
    5169    GLvoid *buffer=NULL;
    5270
     71#ifdef CR_ARB_pixel_buffer_object
     72    if (crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
     73    {
     74        GLvoid *pbo_offset;
     75
     76        pbo_offset = (GLvoid*) ((uintptr_t) *((GLvoid**)img));
     77
     78        cr_server.head_spu->dispatch_table.GetCompressedTexImageARB(target, level, pbo_offset);
     79
     80        return;
     81    }
     82#endif
     83
    5384    cr_server.head_spu->dispatch_table.GetTexLevelParameteriv(target, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &size);
    5485
     
    6798
    6899#endif /* CR_ARB_texture_compression */
     100
     101void SERVER_DISPATCH_APIENTRY crServerDispatchGetPolygonStipple( GLubyte * mask )
     102{
     103#ifdef CR_ARB_pixel_buffer_object
     104    if (crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
     105    {
     106        GLvoid *pbo_offset;
     107
     108        pbo_offset = (GLubyte*) ((uintptr_t) *((GLvoid**)mask));
     109
     110        cr_server.head_spu->dispatch_table.GetPolygonStipple(pbo_offset);
     111    }
     112    else
     113#endif
     114    {   
     115        GLubyte local_mask[128];
     116
     117        cr_server.head_spu->dispatch_table.GetPolygonStipple( local_mask );
     118        crServerReturnValue( &(local_mask[0]), 128*sizeof(GLubyte) );
     119    }
     120}
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_readpixels.c

    r27043 r27091  
    1717
    1818void SERVER_DISPATCH_APIENTRY
    19 crServerDispatchReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
    20                                                         GLenum format, GLenum type, GLvoid *pixels)
     19crServerDispatchReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
     20                           GLenum format, GLenum type, GLvoid *pixels)
    2121{
    2222    CRMessageReadPixels *rp;
     
    3131    CRASSERT(bytes_per_row > 0);
    3232
    33     rp = (CRMessageReadPixels *) crAlloc( msg_len );
     33#ifdef CR_ARB_pixel_buffer_object
     34    if (crStateIsBufferBound(GL_PIXEL_PACK_BUFFER_ARB))
     35    {
     36        GLvoid *pbo_offset;
    3437
    35     /* Note: the ReadPixels data gets densely packed into the buffer
    36      * (no skip pixels, skip rows, etc.  It's up to the receiver (pack spu,
    37      * tilesort spu, etc) to apply the real PixelStore packing parameters.
    38      */
    39     cr_server.head_spu->dispatch_table.ReadPixels(x, y, width, height,
    40                                                   format, type, rp + 1);
     38        /*pixels are actualy a pointer to location of 8byte network pointer in hgcm buffer
     39          regarless of guest/host bitness we're using only 4lower bytes as there're no
     40          pbo>4gb (yet?)
     41         */
     42        pbo_offset = (GLvoid*) ((uintptr_t) *((GLvoid**)pixels));
    4143
    42     rp->header.type = CR_MESSAGE_READ_PIXELS;
    43     rp->width = width;
    44     rp->height = height;
    45     rp->bytes_per_row = bytes_per_row;
    46     rp->stride = stride;
    47     rp->format = format;
    48     rp->type = type;
    49     rp->alignment = alignment;
    50     rp->skipRows = skipRows;
    51     rp->skipPixels = skipPixels;
    52     rp->rowLength = rowLength;
     44        cr_server.head_spu->dispatch_table.ReadPixels(x, y, width, height,
     45                                                      format, type, pbo_offset);
     46    }
     47    else
     48#endif
     49    {
     50        rp = (CRMessageReadPixels *) crAlloc( msg_len );
    5351
    54     /* <pixels> points to the 8-byte network pointer */
    55     crMemcpy( &rp->pixels, pixels, sizeof(rp->pixels) );
     52        /* Note: the ReadPixels data gets densely packed into the buffer
     53         * (no skip pixels, skip rows, etc.  It's up to the receiver (pack spu,
     54         * tilesort spu, etc) to apply the real PixelStore packing parameters.
     55        */
     56        cr_server.head_spu->dispatch_table.ReadPixels(x, y, width, height,
     57                                                      format, type, rp + 1);
     58
     59        rp->header.type = CR_MESSAGE_READ_PIXELS;
     60        rp->width = width;
     61        rp->height = height;
     62        rp->bytes_per_row = bytes_per_row;
     63        rp->stride = stride;
     64        rp->format = format;
     65        rp->type = type;
     66        rp->alignment = alignment;
     67        rp->skipRows = skipRows;
     68        rp->skipPixels = skipPixels;
     69        rp->rowLength = rowLength;
     70
     71        /* <pixels> points to the 8-byte network pointer */
     72        crMemcpy( &rp->pixels, pixels, sizeof(rp->pixels) );
    5673   
    57     crNetSend( cr_server.curClient->conn, NULL, rp, msg_len );
    58     crFree( rp );
     74        crNetSend( cr_server.curClient->conn, NULL, rp, msg_len );
     75        crFree( rp );
     76    }
    5977}
  • trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_special

    r23399 r27091  
    220220DeleteObjectARB
    221221GetUniformsLocations
     222GetPolygonStipple
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_drawpixels.c

    r27088 r27091  
    1414    GLenum format  = READ_DATA( sizeof( int ) + 8, GLenum );
    1515    GLenum type    = READ_DATA( sizeof( int ) + 12, GLenum );
    16     GLvoid *pixels = DATA_POINTER( sizeof( int ) + 16, GLvoid );
     16    GLint noimagedata = READ_DATA( sizeof( int ) + 16, GLint );
     17    GLvoid *pixels;
     18
     19    if (noimagedata)
     20        pixels = (void*) READ_DATA( sizeof( int ) + 20, uintptr_t);
     21    else
     22        pixels = DATA_POINTER( sizeof( int ) + 24, GLvoid );
    1723
    1824    cr_unpackDispatch.PixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
     
    3440    GLfloat xmove   = READ_DATA( sizeof( int ) + 16, GLfloat );
    3541    GLfloat ymove   = READ_DATA( sizeof( int ) + 20, GLfloat );
    36     GLuint  is_null = READ_DATA( sizeof( int ) + 24, GLuint );
    37     GLubyte *bitmap = NULL;
     42    GLuint noimagedata = READ_DATA( sizeof( int ) + 24, GLuint );
     43    GLubyte *bitmap;
    3844
    39     if ( !is_null )
    40     {
    41         bitmap = DATA_POINTER( sizeof(int) + 28, GLubyte );
    42     }
     45    if (noimagedata)
     46        bitmap = (void*) READ_DATA(sizeof(int) + 28, uintptr_t);
     47    else
     48        bitmap = DATA_POINTER( sizeof(int) + 32, GLubyte );
    4349
    4450    cr_unpackDispatch.PixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_misc.c

    r21845 r27091  
    99void crUnpackExtendChromiumParametervCR( void  )
    1010{
    11         GLenum target = READ_DATA( 8, GLenum );
    12         GLenum type = READ_DATA( 12, GLenum );
    13         GLsizei count = READ_DATA( 16, GLsizei );
    14         GLvoid *values = DATA_POINTER( 20, GLvoid );
     11    GLenum target = READ_DATA( 8, GLenum );
     12    GLenum type = READ_DATA( 12, GLenum );
     13    GLsizei count = READ_DATA( 16, GLsizei );
     14    GLvoid *values = DATA_POINTER( 20, GLvoid );
    1515
    16         cr_unpackDispatch.ChromiumParametervCR(target, type, count, values);
     16    cr_unpackDispatch.ChromiumParametervCR(target, type, count, values);
    1717
    1818
    19         /*
    20         INCR_VAR_PTR();
    21         */
     19    /*
     20    INCR_VAR_PTR();
     21    */
    2222}
    2323
    2424void crUnpackExtendDeleteQueriesARB(void)
    2525{
    26         GLsizei n = READ_DATA( 8, GLsizei );
     26    GLsizei n = READ_DATA( 8, GLsizei );
    2727    const GLuint *ids = DATA_POINTER(12, GLuint);
    28         cr_unpackDispatch.DeleteQueriesARB(n, ids);
     28    cr_unpackDispatch.DeleteQueriesARB(n, ids);
    2929}
     30
     31void crUnpackExtendGetPolygonStipple(void)
     32{
     33    GLubyte *mask;
     34
     35    SET_RETURN_PTR( 8 );
     36    SET_WRITEBACK_PTR( 16 );
     37    mask = DATA_POINTER(8, GLubyte);
     38
     39    cr_unpackDispatch.GetPolygonStipple( mask );
     40}
     41
     42void crUnpackExtendGetPixelMapfv(void)
     43{
     44    GLenum map = READ_DATA( 8, GLenum );
     45    GLfloat *values;
     46
     47    SET_RETURN_PTR( 12 );
     48    SET_WRITEBACK_PTR( 20 );
     49    values = DATA_POINTER(12, GLfloat);
     50
     51    cr_unpackDispatch.GetPixelMapfv( map, values );
     52}
     53
     54void crUnpackExtendGetPixelMapuiv(void)
     55{
     56    GLenum map = READ_DATA( 8, GLenum );
     57    GLuint *values;
     58
     59    SET_RETURN_PTR( 12 );
     60    SET_WRITEBACK_PTR( 20 );
     61    values = DATA_POINTER(12, GLuint);
     62
     63    cr_unpackDispatch.GetPixelMapuiv( map, values );
     64}
     65
     66void crUnpackExtendGetPixelMapusv(void)
     67{
     68    GLenum map = READ_DATA( 8, GLenum );
     69    GLushort *values;
     70
     71    SET_RETURN_PTR( 12 );
     72    SET_WRITEBACK_PTR( 20 );
     73    values = DATA_POINTER(12, GLushort);
     74
     75    cr_unpackDispatch.GetPixelMapusv( map, values );
     76}
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_pixelmap.c

    r27074 r27091  
    1111    GLenum map = READ_DATA( sizeof( int ) + 0, GLenum );
    1212    GLsizei mapsize = READ_DATA( sizeof( int ) + 4, GLsizei );
    13     GLfloat *values = DATA_POINTER( sizeof( int ) + 8, GLfloat );
     13    int nodata = READ_DATA( sizeof(int) + 8, int);
     14    GLfloat *values;
     15
     16    if (nodata)
     17        values = (GLfloat*) READ_DATA(sizeof(int) + 12, uintptr_t);
     18    else
     19        values = DATA_POINTER( sizeof( int ) + 16, GLfloat );
    1420
    1521    cr_unpackDispatch.PixelMapfv( map, mapsize, values );
     
    2127    GLenum map = READ_DATA( sizeof( int ) + 0, GLenum );
    2228    GLsizei mapsize = READ_DATA( sizeof( int ) + 4, GLsizei );
    23     GLuint *values = DATA_POINTER( sizeof( int ) + 8, GLuint );
     29    int nodata = READ_DATA( sizeof(int) + 8, int);
     30    GLuint *values;
     31
     32    if (nodata)
     33        values = (GLuint*) READ_DATA(sizeof(int) + 12, uintptr_t);
     34    else
     35        values = DATA_POINTER( sizeof( int ) + 16, GLuint );
    2436       
    2537    cr_unpackDispatch.PixelMapuiv( map, mapsize, values );
     
    3143    GLenum map = READ_DATA( sizeof( int ) + 0, GLenum );
    3244    GLsizei mapsize = READ_DATA( sizeof( int ) + 4, GLsizei );
    33     GLushort *values = DATA_POINTER( sizeof( int ) + 8, GLushort );
     45    int nodata = READ_DATA( sizeof(int) + 8, int);
     46    GLushort *values;
     47
     48    if (nodata)
     49        values = (GLushort*) READ_DATA(sizeof(int) + 12, uintptr_t);
     50    else
     51        values = DATA_POINTER( sizeof( int ) + 16, GLushort );
    3452
    3553    cr_unpackDispatch.PixelMapusv( map, mapsize, values );
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_readpixels.c

    r15532 r27091  
    4343        cr_unpackDispatch.ReadPixels( x, y, width, height, format, type, pixels);
    4444
    45         INCR_VAR_PTR();
     45        INCR_DATA_PTR(48+sizeof(CRNetworkPointer));
    4646}
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_stipple.c

    r15532 r27091  
    99void crUnpackPolygonStipple( void  )
    1010{
    11         GLubyte *mask = DATA_POINTER( 0, GLubyte );
     11    int nodata = READ_DATA(0, int);
     12    GLubyte *mask;
    1213
    13         cr_unpackDispatch.PolygonStipple( mask );
    14         INCR_DATA_PTR( 32*32/8 );
     14    if (nodata)
     15        mask = (void*) READ_DATA(4, uintptr_t);
     16    else
     17        mask = DATA_POINTER( 4, GLubyte );
     18
     19    cr_unpackDispatch.PolygonStipple(mask);
     20
     21    if (nodata)
     22        INCR_DATA_PTR(8);
     23    else
     24        INCR_DATA_PTR(4 + 32*32/8);
    1525}
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_texture.c

    r27088 r27091  
    2323    GLenum format = READ_DATA( sizeof( int ) + 28, GLenum );
    2424    GLenum type = READ_DATA( sizeof( int ) + 32, GLenum );
    25     int is_null = READ_DATA( sizeof( int ) + 36, int );
    26     GLvoid *pixels;
    27 
    28     if ( is_null )
    29         pixels = NULL;
    30     else
    31         pixels = DATA_POINTER( sizeof( int ) + 40, GLvoid );
     25    int noimagedata = READ_DATA( sizeof( int ) + 36, int );
     26    GLvoid *pixels;
     27
     28    /*If there's no imagedata send, it's either that passed pointer was NULL or
     29      there was GL_PIXEL_UNPACK_BUFFER_ARB bound, in both cases 4bytes of passed
     30      pointer would convert to either NULL or offset in the bound buffer.
     31     */
     32    if ( noimagedata )
     33        pixels = (void*) READ_DATA(sizeof(int)+40, uintptr_t);
     34    else
     35        pixels = DATA_POINTER( sizeof( int ) + 44, GLvoid );
    3236
    3337    cr_unpackDispatch.TexImage3DEXT(target, level, internalformat, width,
     
    5054    GLenum format = READ_DATA( sizeof( int ) + 28, GLenum );
    5155    GLenum type = READ_DATA( sizeof( int ) + 32, GLenum );
    52     int is_null = READ_DATA( sizeof( int ) + 36, int );
     56    int noimagedata = READ_DATA( sizeof( int ) + 36, int );
    5357    GLvoid *pixels;
    5458   
    55     if ( is_null )
    56         pixels = NULL;
    57     else
    58         pixels = DATA_POINTER( sizeof( int ) + 40, GLvoid );
     59    if ( noimagedata )
     60        pixels = (void*) READ_DATA(sizeof(int)+40, uintptr_t);
     61    else
     62        pixels = DATA_POINTER( sizeof( int ) + 44, GLvoid );
    5963   
    6064    cr_unpackDispatch.TexImage3D( target, level, internalformat, width, height,
     
    7478    GLenum format = READ_DATA( sizeof( int ) + 24, GLenum );
    7579    GLenum type = READ_DATA( sizeof( int ) + 28, GLenum );
    76     int is_null = READ_DATA( sizeof( int ) + 32, int );
    77     GLvoid *pixels;
    78 
    79     if ( is_null )
    80         pixels = NULL;
     80    int noimagedata = READ_DATA( sizeof( int ) + 32, int );
     81    GLvoid *pixels;
     82
     83    if ( noimagedata )
     84        pixels = (void*) READ_DATA(sizeof(int)+36, uintptr_t);
    8185    else
    82         pixels = DATA_POINTER( sizeof( int ) + 36, GLvoid );
     86        pixels = DATA_POINTER( sizeof( int ) + 40, GLvoid );
    8387
    8488    cr_unpackDispatch.TexImage2D( target, level, internalformat, width, height,
     
    96100    GLenum format = READ_DATA( sizeof( int ) + 20, GLenum );
    97101    GLenum type = READ_DATA( sizeof( int ) + 24, GLenum );
    98     int is_null = READ_DATA( sizeof( int ) + 28, int );
    99     GLvoid *pixels;
    100 
    101     if ( is_null )
    102         pixels = NULL;
     102    int noimagedata = READ_DATA( sizeof( int ) + 28, int );
     103    GLvoid *pixels;
     104
     105    if ( noimagedata )
     106        pixels = (void*) READ_DATA(sizeof(int)+32, uintptr_t);
    103107    else
    104         pixels = DATA_POINTER( sizeof( int ) + 32, GLvoid );
     108        pixels = DATA_POINTER( sizeof( int ) + 36, GLvoid );
    105109
    106110    cr_unpackDispatch.TexImage1D( target, level, internalformat, width, border,
     
    183187    GLenum format = READ_DATA( sizeof( int ) + 32, GLenum );
    184188    GLenum type = READ_DATA( sizeof( int ) + 36, GLenum );
    185     GLvoid *pixels = DATA_POINTER( sizeof( int ) + 40, GLvoid );
     189    int noimagedata = READ_DATA( sizeof( int ) + 40, int );
     190    GLvoid *pixels;
     191
     192    if ( noimagedata )
     193        pixels = (void*) READ_DATA(sizeof(int)+44, uintptr_t);
     194    else
     195        pixels = DATA_POINTER( sizeof( int ) + 48, GLvoid );
    186196
    187197    cr_unpackDispatch.PixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
     
    206216    GLenum format = READ_DATA( sizeof( int ) + 24, GLenum );
    207217    GLenum type = READ_DATA( sizeof( int ) + 28, GLenum );
    208     GLvoid *pixels = DATA_POINTER( sizeof( int ) + 32, GLvoid );
     218    int noimagedata = READ_DATA( sizeof( int ) + 32, int );
     219    GLvoid *pixels;
     220
     221    if ( noimagedata )
     222        pixels = (void*) READ_DATA(sizeof(int)+36, uintptr_t);
     223    else
     224        pixels = DATA_POINTER( sizeof( int ) + 40, GLvoid );
    209225
    210226    cr_unpackDispatch.PixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
     
    226242    GLenum format = READ_DATA( sizeof( int ) + 16, GLenum );
    227243    GLenum type = READ_DATA( sizeof( int ) + 20, GLenum );
    228     GLvoid *pixels = DATA_POINTER( sizeof( int ) + 24, GLvoid );
     244    int noimagedata = READ_DATA( sizeof( int ) + 24, int );
     245    GLvoid *pixels;
     246
     247    if ( noimagedata )
     248        pixels = (void*) READ_DATA(sizeof(int)+28, uintptr_t);
     249    else
     250        pixels = DATA_POINTER( sizeof( int ) + 32, GLvoid );
    229251
    230252    cr_unpackDispatch.PixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
     
    317339    GLint   border         = READ_DATA( 4 + sizeof(int) + 24, GLint );
    318340    GLsizei imagesize      = READ_DATA( 4 + sizeof(int) + 28, GLsizei );
    319     int     is_null        = READ_DATA( 4 + sizeof(int) + 32, int );
     341    int     noimagedata        = READ_DATA( 4 + sizeof(int) + 32, int );
    320342    GLvoid  *pixels;
    321343
    322     if( is_null )
    323         pixels = NULL;
    324     else
    325         pixels = DATA_POINTER( 4 + sizeof(int) + 36, GLvoid );
     344    if( noimagedata )
     345        pixels = (void*) READ_DATA(4+sizeof(int)+36, uintptr_t);
     346    else
     347        pixels = DATA_POINTER( 4 + sizeof(int) + 40, GLvoid );
    326348
    327349    cr_unpackDispatch.CompressedTexImage3DARB(target, level, internalformat,
     
    340362    GLint border =          READ_DATA( 4 + sizeof( int ) + 20, GLint );
    341363    GLsizei imagesize =     READ_DATA( 4 + sizeof( int ) + 24, GLsizei );
    342     int is_null =           READ_DATA( 4 + sizeof( int ) + 28, int );
    343     GLvoid *pixels;
    344 
    345     if ( is_null )
    346         pixels = NULL;
    347     else
    348         pixels = DATA_POINTER( 4 + sizeof( int ) + 32, GLvoid );
     364    int noimagedata =           READ_DATA( 4 + sizeof( int ) + 28, int );
     365    GLvoid *pixels;
     366
     367    if ( noimagedata )
     368        pixels = (void*) READ_DATA(4+sizeof(int)+32, uintptr_t);
     369    else
     370        pixels = DATA_POINTER( 4 + sizeof( int ) + 36, GLvoid );
    349371
    350372    cr_unpackDispatch.CompressedTexImage2DARB( target, level, internalformat,
     
    362384    GLint   border         = READ_DATA( 4 + sizeof(int) + 16, GLint );
    363385    GLsizei imagesize      = READ_DATA( 4 + sizeof(int) + 20, GLsizei );
    364     int     is_null        = READ_DATA( 4 + sizeof(int) + 24, int );
     386    int     noimagedata        = READ_DATA( 4 + sizeof(int) + 24, int );
    365387    GLvoid  *pixels;
    366388
    367     if( is_null )
    368         pixels = NULL;
    369     else
    370         pixels = DATA_POINTER( 4 + sizeof(int) + 28, GLvoid );
     389    if( noimagedata )
     390        pixels = (void*) READ_DATA(4+sizeof(int)+28, uintptr_t);
     391    else
     392        pixels = DATA_POINTER( 4 + sizeof(int) + 32, GLvoid );
    371393
    372394    cr_unpackDispatch.CompressedTexImage1DARB(target, level, internalformat,
     
    387409    GLenum  format    = READ_DATA( 4 + sizeof(int) + 32, GLenum );
    388410    GLsizei imagesize = READ_DATA( 4 + sizeof(int) + 36, GLsizei );
    389     int     is_null   = READ_DATA( 4 + sizeof(int) + 40, int );
     411    int     noimagedata   = READ_DATA( 4 + sizeof(int) + 40, int );
    390412    GLvoid  *pixels;
    391413
    392     if( is_null )
    393         pixels = NULL;
    394     else
    395         pixels = DATA_POINTER( 4 + sizeof(int) + 44, GLvoid );
     414    if( noimagedata )
     415        pixels = (void*) READ_DATA(4+sizeof(int)+44, uintptr_t);
     416    else
     417        pixels = DATA_POINTER( 4 + sizeof(int) + 48, GLvoid );
    396418
    397419    cr_unpackDispatch.CompressedTexSubImage3DARB(target, level, xoffset,
     
    412434    GLenum  format    = READ_DATA( 4 + sizeof(int) + 24, GLenum );
    413435    GLsizei imagesize = READ_DATA( 4 + sizeof(int) + 28, GLsizei );
    414     int     is_null   = READ_DATA( 4 + sizeof(int) + 32, int );
     436    int     noimagedata   = READ_DATA( 4 + sizeof(int) + 32, int );
    415437    GLvoid  *pixels;
    416438
    417     if( is_null )
    418         pixels = NULL;
    419     else
    420         pixels = DATA_POINTER( 4 + sizeof(int) + 36, GLvoid );
     439    if( noimagedata )
     440        pixels = (void*) READ_DATA(4+sizeof(int)+36, uintptr_t);
     441    else
     442        pixels = DATA_POINTER( 4 + sizeof(int) + 40, GLvoid );
    421443
    422444    cr_unpackDispatch.CompressedTexSubImage2DARB(target, level, xoffset,
     
    434456    GLenum  format    = READ_DATA( 4 + sizeof(int) + 16, GLenum );
    435457    GLsizei imagesize = READ_DATA( 4 + sizeof(int) + 20, GLsizei );
    436     int     is_null   = READ_DATA( 4 + sizeof(int) + 24, int );
     458    int     noimagedata   = READ_DATA( 4 + sizeof(int) + 24, int );
    437459    GLvoid  *pixels;
    438460
    439     if( is_null )
    440         pixels = NULL;
    441     else
    442         pixels = DATA_POINTER( 4 + sizeof(int) + 28, GLvoid );
     461    if( noimagedata )
     462        pixels = (void*) READ_DATA(4+sizeof(int)+28, uintptr_t);
     463    else
     464        pixels = DATA_POINTER( 4 + sizeof(int) + 32, GLvoid );
    443465
    444466    cr_unpackDispatch.CompressedTexSubImage1DARB(target, level, xoffset, width,
    445467                                                 format, imagesize, pixels);
    446468}
     469
     470void crUnpackExtendGetTexImage(void)
     471{
     472    GLenum target = READ_DATA( 8, GLenum );
     473    GLint level   = READ_DATA( 12, GLint );
     474    GLenum format = READ_DATA( 16, GLenum );
     475    GLenum type   = READ_DATA( 20, GLenum );
     476    GLvoid *pixels;
     477
     478    SET_RETURN_PTR(24);
     479    SET_WRITEBACK_PTR(32);
     480    pixels = DATA_POINTER(24, GLvoid);
     481
     482    cr_unpackDispatch.GetTexImage(target, level, format, type, pixels);
     483}
     484
     485void crUnpackExtendGetCompressedTexImageARB(void)
     486{
     487    GLenum target = READ_DATA( 8, GLenum );
     488    GLint level   = READ_DATA( 12, GLint );
     489    GLvoid *img;
     490
     491    SET_RETURN_PTR( 16 );
     492    SET_WRITEBACK_PTR( 24 );
     493    img = DATA_POINTER(16, GLvoid);
     494
     495    cr_unpackDispatch.GetCompressedTexImageARB( target, level, img );
     496}
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpacker_special

    r23399 r27091  
    169169UnlockArraysEXT
    170170GetUniformsLocations
     171GetTexImage
     172GetCompressedTexImageARB
     173GetPolygonStipple
     174GetPixelMapfv
     175GetPixelMapuiv
     176GetPixelMapusv
Note: See TracChangeset for help on using the changeset viewer.

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