third_party/virtualbox/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
/**
 * Destroy backend specific surface bits (part of SVGA_3D_CMD_SURFACE_DESTROY).
 *
 * @param   pState              The VMSVGA3d state.
 * @param   pSurface            The surface being destroyed.
 */
Destroy backend specific surface bits (part of SVGA_3D_CMD_SURFACE_DESTROY).
@param   pState              The VMSVGA3d state.
@param   pSurface            The surface being destroyed.
Destroy backend specific surface bits ( part of SVGA_3D_CMD_SURFACE_DESTROY ) . @param pState The VMSVGA3d state . @param pSurface The surface being destroyed .
void vmsvga3dBackSurfaceDestroy(PVMSVGA3DSTATE pState, PVMSVGA3DSURFACE pSurface)
{
    PVMSVGA3DCONTEXT pContext = &pState->SharedCtx;
    VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext);
    switch (pSurface->surfaceFlags & VMSVGA3D_SURFACE_HINT_SWITCH_MASK)
    {
    case SVGA3D_SURFACE_CUBEMAP:
        AssertFailed(); 
        break;
    case SVGA3D_SURFACE_HINT_INDEXBUFFER | SVGA3D_SURFACE_HINT_VERTEXBUFFER:
    case SVGA3D_SURFACE_HINT_INDEXBUFFER:
    case SVGA3D_SURFACE_HINT_VERTEXBUFFER:
        if (pSurface->oglId.buffer != OPENGL_INVALID_ID)
        {
            pState->ext.glDeleteBuffers(1, &pSurface->oglId.buffer);
            VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext);
        }
        break;
    case SVGA3D_SURFACE_HINT_TEXTURE:
    case SVGA3D_SURFACE_HINT_TEXTURE | SVGA3D_SURFACE_HINT_RENDERTARGET:
        if (pSurface->oglId.texture != OPENGL_INVALID_ID)
        {
            glDeleteTextures(1, &pSurface->oglId.texture);
            VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext);
        }
        break;
    case SVGA3D_SURFACE_HINT_RENDERTARGET:
    case SVGA3D_SURFACE_HINT_DEPTHSTENCIL:
    case SVGA3D_SURFACE_HINT_DEPTHSTENCIL | SVGA3D_SURFACE_HINT_TEXTURE:    
        if (pSurface->oglId.renderbuffer != OPENGL_INVALID_ID)
        {
            pState->ext.glDeleteRenderbuffers(1, &pSurface->oglId.renderbuffer);
            VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext);
        }
        break;
    default:
        AssertMsg(!VMSVGA3DSURFACE_HAS_HW_SURFACE(pSurface), ("type=%x\n", (pSurface->surfaceFlags & VMSVGA3D_SURFACE_HINT_SWITCH_MASK)));
        break;
    }
}
void vmsvga3dBackSurfaceDestroy ( PVMSVGA3DSTATE pState , PVMSVGA3DSURFACE pSurface ) { PVMSVGA3DCONTEXT pContext = & pState -> SharedCtx ; VMSVGA3D_SET_CURRENT_CONTEXT ( pState , pContext ) ; switch ( pSurface -> surfaceFlags & VMSVGA3D_SURFACE_HINT_SWITCH_MASK ) { case SVGA3D_SURFACE_CUBEMAP : AssertFailed ( ) ; break ; case SVGA3D_SURFACE_HINT_INDEXBUFFER | SVGA3D_SURFACE_HINT_VERTEXBUFFER : case SVGA3D_SURFACE_HINT_INDEXBUFFER : case SVGA3D_SURFACE_HINT_VERTEXBUFFER : if ( pSurface -> oglId . buffer != OPENGL_INVALID_ID ) { pState -> ext . glDeleteBuffers ( 1 , & pSurface -> oglId . buffer ) ; VMSVGA3D_CHECK_LAST_ERROR_WARN ( pState , pContext ) ; } break ; case SVGA3D_SURFACE_HINT_TEXTURE : case SVGA3D_SURFACE_HINT_TEXTURE | SVGA3D_SURFACE_HINT_RENDERTARGET : if ( pSurface -> oglId . texture != OPENGL_INVALID_ID ) { glDeleteTextures ( 1 , & pSurface -> oglId . texture ) ; VMSVGA3D_CHECK_LAST_ERROR_WARN ( pState , pContext ) ; } break ; case SVGA3D_SURFACE_HINT_RENDERTARGET : case SVGA3D_SURFACE_HINT_DEPTHSTENCIL : case SVGA3D_SURFACE_HINT_DEPTHSTENCIL | SVGA3D_SURFACE_HINT_TEXTURE : if ( pSurface -> oglId . renderbuffer != OPENGL_INVALID_ID ) { pState -> ext . glDeleteRenderbuffers ( 1 , & pSurface -> oglId . renderbuffer ) ; VMSVGA3D_CHECK_LAST_ERROR_WARN ( pState , pContext ) ; } break ; default : AssertMsg ( ! VMSVGA3DSURFACE_HAS_HW_SURFACE ( pSurface ) , ( " \n " , ( pSurface -> surfaceFlags & VMSVGA3D_SURFACE_HINT_SWITCH_MASK ) ) ) ; break ; } }
Destroy backend specific surface bits (part of SVGA_3D_CMD_SURFACE_DESTROY).
Destroy backend specific surface bits ( part of SVGA_3D_CMD_SURFACE_DESTROY ) .
/** @todo destroy SVGA3D_SURFACE_CUBEMAP */ /** @todo actual texture surface not supported */