VirtualBox

Changeset 27091 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Mar 5, 2010 2:13:31 PM (15 years ago)
Author:
vboxsync
Message:

crOpenGL: add GL_ARB_pixel_buffer_object support

Location:
trunk/src/VBox/Additions/common/crOpenGL/pack
Files:
4 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
Note: See TracChangeset for help on using the changeset viewer.

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