wined3d: Add a function to destroy dummy textures.

The next patch uses this.
This commit is contained in:
Henri Verbeet 2009-12-17 19:14:34 +01:00 committed by Alexandre Julliard
parent 7fe3ab5a23
commit 4c66141c99
1 changed files with 12 additions and 11 deletions

View File

@ -1368,6 +1368,17 @@ static void create_dummy_textures(IWineD3DDeviceImpl *This)
LEAVE_GL(); LEAVE_GL();
} }
/* Context activation is done by the caller. */
static void destroy_dummy_textures(IWineD3DDeviceImpl *device, const struct wined3d_gl_info *gl_info)
{
ENTER_GL();
glDeleteTextures(gl_info->limits.textures, device->dummyTextureName);
checkGLcall("glDeleteTextures(gl_info->limits.textures, device->dummyTextureName)");
LEAVE_GL();
memset(device->dummyTextureName, 0, gl_info->limits.textures * sizeof(*device->dummyTextureName));
}
static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface,
WINED3DPRESENT_PARAMETERS *pPresentationParameters) WINED3DPRESENT_PARAMETERS *pPresentationParameters)
{ {
@ -6240,7 +6251,6 @@ void delete_opengl_contexts(IWineD3DDevice *iface, IWineD3DSwapChain *swapchain_
IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *) swapchain_iface; IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *) swapchain_iface;
const struct wined3d_gl_info *gl_info; const struct wined3d_gl_info *gl_info;
struct wined3d_context *context; struct wined3d_context *context;
UINT i;
IWineD3DBaseShaderImpl *shader; IWineD3DBaseShaderImpl *shader;
context = context_acquire(This, NULL, CTXUSAGE_RESOURCELOAD); context = context_acquire(This, NULL, CTXUSAGE_RESOURCELOAD);
@ -6267,16 +6277,7 @@ void delete_opengl_contexts(IWineD3DDevice *iface, IWineD3DSwapChain *swapchain_
This->blitter->free_private(iface); This->blitter->free_private(iface);
This->frag_pipe->free_private(iface); This->frag_pipe->free_private(iface);
This->shader_backend->shader_free_private(iface); This->shader_backend->shader_free_private(iface);
destroy_dummy_textures(This, gl_info);
ENTER_GL();
for (i = 0; i < This->adapter->gl_info.limits.textures; ++i)
{
/* Textures are recreated below */
glDeleteTextures(1, &This->dummyTextureName[i]);
checkGLcall("glDeleteTextures(1, &This->dummyTextureName[i])");
This->dummyTextureName[i] = 0;
}
LEAVE_GL();
context_release(context); context_release(context);