VirtualBox

Changeset 22831 in vbox for trunk


Ignore:
Timestamp:
Sep 8, 2009 11:13:06 AM (15 years ago)
Author:
vboxsync
Message:

crOpenGL: fix GPU memory leak for apps not clearing VBOs/FBOs and incorrect FBO tracking

Location:
trunk/src/VBox/GuestHost/OpenGL/state_tracker
Files:
2 edited

Legend:

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

    r21308 r22831  
    5555    CRBufferObject *pObj = (CRBufferObject *)data;
    5656    if (pObj->data) crFree(pObj->data);
     57
     58    if (diff_api.AlphaFunc)
     59    {
     60        diff_api.DeleteBuffersARB(1, &pObj->name);
     61    }
     62
    5763    crFree(pObj);
    5864}
  • trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_framebuffer.c

    r22363 r22831  
    4444}
    4545
     46static void crStateFreeFBO(void *data)
     47{
     48    CRFramebufferObject *pObj = (CRFramebufferObject *)data;
     49
     50    if (diff_api.AlphaFunc)
     51    {
     52        diff_api.DeleteFramebuffersEXT(1, &pObj->id);
     53    }
     54
     55    crFree(pObj);
     56}
     57
     58static void crStateFreeRBO(void *data)
     59{
     60    CRRenderbufferObject *pObj = (CRRenderbufferObject *)data;
     61
     62    if (diff_api.AlphaFunc)
     63    {
     64        diff_api.DeleteRenderbuffersEXT(1, &pObj->id);
     65    }
     66
     67    crFree(pObj);
     68}
     69
    4670DECLEXPORT(void) STATE_APIENTRY
    4771crStateFramebufferObjectDestroy(CRContext *ctx)
     
    5276    fbo->renderbuffer = NULL;
    5377
    54     crFreeHashtable(fbo->framebuffers, crFree);
    55     crFreeHashtable(fbo->renderbuffers, crFree);
     78    crFreeHashtable(fbo->framebuffers, crStateFreeFBO);
     79    crFreeHashtable(fbo->renderbuffers, crStateFreeRBO);
    5680}
    5781
     
    246270        {
    247271            fbo->framebuffer = (CRFramebufferObject*) crCalloc(sizeof(CRFramebufferObject));
    248             CRSTATE_FBO_CHECKERR(!fbo->renderbuffer, GL_OUT_OF_MEMORY, "glBindFramebufferEXT");
     272            CRSTATE_FBO_CHECKERR(!fbo->framebuffer, GL_OUT_OF_MEMORY, "glBindFramebufferEXT");
    249273            fbo->framebuffer->id = framebuffer;
    250274            crStateInitFrameBuffer(fbo->framebuffer);
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