VirtualBox

Ignore:
Timestamp:
Dec 7, 2012 10:34:42 AM (12 years ago)
Author:
vboxsync
Message:

crOpenGL: more gl state fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_bufferobject.c

    r44052 r44059  
    3030}
    3131
     32void STATE_APIENTRY crStateGenBuffersARB(GLsizei n, GLuint *buffers)
     33{
     34    CRContext *g = GetCurrentContext();
     35    crStateGenNames(g, g->shared->buffersTable, n, buffers);
     36}
     37
    3238GLboolean crStateIsBufferBound(GLenum target)
    3339{
     
    185191        newObj = (CRBufferObject *) crHashtableSearch(g->shared->buffersTable, buffer);
    186192        if (!newObj) {
     193            CRSTATE_CHECKERR(!crHashtableIsKeyUsed(g->shared->buffersTable, buffer), GL_INVALID_OPERATION, "name is not a buffer object");
    187194            newObj = AllocBufferObject(buffer);
    188             if (!newObj) {
    189                 crStateError(__LINE__, __FILE__, GL_OUT_OF_MEMORY, "glBindBuffer");
     195            CRSTATE_CHECKERR(!newObj, GL_OUT_OF_MEMORY, "glBindBuffer");
     196#ifndef IN_GUEST
     197            diff_api.GenBuffersARB(1, &newObj->hwid);
     198            if (!newObj->hwid)
     199            {
     200                crWarning("GenBuffersARB failed!");
     201                crFree(newObj);
    190202                return;
    191203            }
     204#endif
    192205            crHashtableAdd( g->shared->buffersTable, buffer, newObj );
    193206        }
     
    334347}
    335348
    336 
    337 void STATE_APIENTRY
    338 crStateGenBuffersARB(GLsizei n, GLuint * buffers)
    339 {
    340     CRContext *g = GetCurrentContext();
    341     CRBufferObjectState *b = &(g->bufferobject);
    342     GLint start;
    343 
    344     FLUSH();
    345 
    346     if (g->current.inBeginEnd) {
    347         crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION,
    348                                  "glGenBuffersARB called in Begin/End");
    349         return;
    350     }
    351 
    352     if (n < 0) {
    353         crStateError(__LINE__, __FILE__, GL_INVALID_VALUE,
    354                                  "glGenBuffersARB(n < 0)");
    355         return;
    356     }
    357 
    358     start = crHashtableAllocKeys(g->shared->buffersTable, n);
    359     if (start) {
    360         GLint i;
    361         for (i = 0; i < n; i++)
    362             buffers[i] = (GLuint) (start + i);
    363     }
    364     else {
    365         crStateError(__LINE__, __FILE__, GL_OUT_OF_MEMORY, "glGenBuffersARB");
    366     }
    367 }
    368 
    369 
    370349GLboolean STATE_APIENTRY
    371350crStateIsBufferARB(GLuint buffer)
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