VirtualBox

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}
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