wined3d: Pass NULL to ActivateContext() when we don't need a specific target.

Once we keep track of the wined3d context for each thread,
lastActiveRenderTarget won't do what we want here.
This commit is contained in:
Henri Verbeet 2009-07-21 11:51:07 +02:00 committed by Alexandre Julliard
parent a9c33bbc4a
commit ee4d18cc83
11 changed files with 43 additions and 40 deletions

View File

@ -4368,7 +4368,7 @@ static void shader_arb_destroy(IWineD3DBaseShader *iface) {
if(!shader_data) return; /* This can happen if a shader was never compiled */ if(!shader_data) return; /* This can happen if a shader was never compiled */
ENTER_GL(); ENTER_GL();
if(shader_data->num_gl_shaders) ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); if(shader_data->num_gl_shaders) ActivateContext(device, NULL, CTXUSAGE_RESOURCELOAD);
for(i = 0; i < shader_data->num_gl_shaders; i++) { for(i = 0; i < shader_data->num_gl_shaders; i++) {
GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId)); GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId));
@ -4386,7 +4386,7 @@ static void shader_arb_destroy(IWineD3DBaseShader *iface) {
if(!shader_data) return; /* This can happen if a shader was never compiled */ if(!shader_data) return; /* This can happen if a shader was never compiled */
ENTER_GL(); ENTER_GL();
if(shader_data->num_gl_shaders) ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); if(shader_data->num_gl_shaders) ActivateContext(device, NULL, CTXUSAGE_RESOURCELOAD);
for(i = 0; i < shader_data->num_gl_shaders; i++) { for(i = 0; i < shader_data->num_gl_shaders; i++) {
GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId)); GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId));

View File

@ -63,7 +63,7 @@ void basetexture_unload(IWineD3DBaseTexture *iface)
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice; IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
if(This->baseTexture.textureName) { if(This->baseTexture.textureName) {
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(device, NULL, CTXUSAGE_RESOURCELOAD);
ENTER_GL(); ENTER_GL();
glDeleteTextures(1, &This->baseTexture.textureName); glDeleteTextures(1, &This->baseTexture.textureName);
This->baseTexture.textureName = 0; This->baseTexture.textureName = 0;
@ -71,7 +71,7 @@ void basetexture_unload(IWineD3DBaseTexture *iface)
} }
if(This->baseTexture.srgbTextureName) { if(This->baseTexture.srgbTextureName) {
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(device, NULL, CTXUSAGE_RESOURCELOAD);
ENTER_GL(); ENTER_GL();
glDeleteTextures(1, &This->baseTexture.srgbTextureName); glDeleteTextures(1, &This->baseTexture.srgbTextureName);
This->baseTexture.srgbTextureName = 0; This->baseTexture.srgbTextureName = 0;
@ -135,7 +135,7 @@ HRESULT basetexture_set_autogen_filter_type(IWineD3DBaseTexture *iface, WINED3DT
* Or should we delay the applying until the texture is used for drawing? For now, apply * Or should we delay the applying until the texture is used for drawing? For now, apply
* immediately. * immediately.
*/ */
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(device, NULL, CTXUSAGE_RESOURCELOAD);
ENTER_GL(); ENTER_GL();
glBindTexture(textureDimensions, This->baseTexture.textureName); glBindTexture(textureDimensions, This->baseTexture.textureName);
checkGLcall("glBindTexture"); checkGLcall("glBindTexture");

View File

@ -603,7 +603,7 @@ static void STDMETHODCALLTYPE buffer_UnLoad(IWineD3DBuffer *iface)
{ {
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice; IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(device, NULL, CTXUSAGE_RESOURCELOAD);
/* Download the buffer, but don't permanently enable double buffering */ /* Download the buffer, but don't permanently enable double buffering */
if(!(This->flags & WINED3D_BUFFER_DOUBLEBUFFER)) if(!(This->flags & WINED3D_BUFFER_DOUBLEBUFFER))
@ -690,7 +690,7 @@ static void STDMETHODCALLTYPE buffer_PreLoad(IWineD3DBuffer *iface)
TRACE("iface %p\n", iface); TRACE("iface %p\n", iface);
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(device, NULL, CTXUSAGE_RESOURCELOAD);
if (!This->buffer_object) if (!This->buffer_object)
{ {
@ -800,7 +800,7 @@ static void STDMETHODCALLTYPE buffer_PreLoad(IWineD3DBuffer *iface)
if (!device->isInDraw) if (!device->isInDraw)
{ {
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(device, NULL, CTXUSAGE_RESOURCELOAD);
} }
ENTER_GL(); ENTER_GL();
GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object)); GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object));
@ -950,7 +950,7 @@ static HRESULT STDMETHODCALLTYPE buffer_Map(IWineD3DBuffer *iface, UINT offset,
IWineD3DDeviceImpl_MarkStateDirty(This->resource.wineD3DDevice, STATE_INDEXBUFFER); IWineD3DDeviceImpl_MarkStateDirty(This->resource.wineD3DDevice, STATE_INDEXBUFFER);
} }
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(device, NULL, CTXUSAGE_RESOURCELOAD);
ENTER_GL(); ENTER_GL();
GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object)); GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object));
This->resource.allocatedMemory = GL_EXTCALL(glMapBufferARB(This->buffer_type_hint, GL_READ_WRITE_ARB)); This->resource.allocatedMemory = GL_EXTCALL(glMapBufferARB(This->buffer_type_hint, GL_READ_WRITE_ARB));
@ -1002,7 +1002,7 @@ static HRESULT STDMETHODCALLTYPE buffer_Unmap(IWineD3DBuffer *iface)
IWineD3DDeviceImpl_MarkStateDirty(This->resource.wineD3DDevice, STATE_INDEXBUFFER); IWineD3DDeviceImpl_MarkStateDirty(This->resource.wineD3DDevice, STATE_INDEXBUFFER);
} }
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(device, NULL, CTXUSAGE_RESOURCELOAD);
ENTER_GL(); ENTER_GL();
GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object)); GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object));
GL_EXTCALL(glUnmapBufferARB(This->buffer_type_hint)); GL_EXTCALL(glUnmapBufferARB(This->buffer_type_hint));

View File

@ -518,7 +518,7 @@ void context_resource_released(IWineD3DDevice *iface, IWineD3DResource *resource
} }
else if (This->d3d_initialized) else if (This->d3d_initialized)
{ {
ActivateContext(This, This->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(This, NULL, CTXUSAGE_RESOURCELOAD);
} }
for (i = 0; i < This->numContexts; ++i) for (i = 0; i < This->numContexts; ++i)
@ -1759,6 +1759,9 @@ void ActivateContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, ContextU
const struct wined3d_gl_info *gl_info; const struct wined3d_gl_info *gl_info;
TRACE("(%p): Selecting context for render target %p, thread %d\n", This, target, tid); TRACE("(%p): Selecting context for render target %p, thread %d\n", This, target, tid);
if (!target) target = This->lastActiveRenderTarget;
if(This->lastActiveRenderTarget != target || tid != This->lastThread) { if(This->lastActiveRenderTarget != target || tid != This->lastThread) {
context = FindContext(This, target, tid); context = FindContext(This, target, tid);
context->draw_buffer_dirty = TRUE; context->draw_buffer_dirty = TRUE;

View File

@ -66,7 +66,7 @@ static void cubetexture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3
{ {
/* No danger of recursive calls, ActivateContext sets isInDraw to true /* No danger of recursive calls, ActivateContext sets isInDraw to true
* when loading offscreen render targets into their texture. */ * when loading offscreen render targets into their texture. */
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(device, NULL, CTXUSAGE_RESOURCELOAD);
} }
if (This->resource.format_desc->format == WINED3DFMT_P8 if (This->resource.format_desc->format == WINED3DFMT_P8

View File

@ -1197,7 +1197,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface, WINE
if(GL_SUPPORT(ARB_OCCLUSION_QUERY)) { if(GL_SUPPORT(ARB_OCCLUSION_QUERY)) {
TRACE("(%p) Allocating data for an occlusion query\n", This); TRACE("(%p) Allocating data for an occlusion query\n", This);
ActivateContext(This, This->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(This, NULL, CTXUSAGE_RESOURCELOAD);
ENTER_GL(); ENTER_GL();
GL_EXTCALL(glGenQueriesARB(1, &((WineQueryOcclusionData *)(object->extendedData))->queryId)); GL_EXTCALL(glGenQueriesARB(1, &((WineQueryOcclusionData *)(object->extendedData))->queryId));
LEAVE_GL(); LEAVE_GL();
@ -1207,7 +1207,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface, WINE
object->extendedData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WineQueryEventData)); object->extendedData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WineQueryEventData));
((WineQueryEventData *)(object->extendedData))->ctx = This->activeContext; ((WineQueryEventData *)(object->extendedData))->ctx = This->activeContext;
ActivateContext(This, This->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(This, NULL, CTXUSAGE_RESOURCELOAD);
ENTER_GL(); ENTER_GL();
if(GL_SUPPORT(APPLE_FENCE)) { if(GL_SUPPORT(APPLE_FENCE)) {
GL_EXTCALL(glGenFencesAPPLE(1, &((WineQueryEventData *)(object->extendedData))->fenceId)); GL_EXTCALL(glGenFencesAPPLE(1, &((WineQueryEventData *)(object->extendedData))->fenceId));
@ -2318,7 +2318,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface, D3DCB_D
/* I don't think that the interface guarantees that the device is destroyed from the same thread /* I don't think that the interface guarantees that the device is destroyed from the same thread
* it was created. Thus make sure a context is active for the glDelete* calls * it was created. Thus make sure a context is active for the glDelete* calls
*/ */
ActivateContext(This, This->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(This, NULL, CTXUSAGE_RESOURCELOAD);
if(This->logo_surface) IWineD3DSurface_Release(This->logo_surface); if(This->logo_surface) IWineD3DSurface_Release(This->logo_surface);
@ -4400,7 +4400,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_ProcessVertices(IWineD3DDevice *iface,
} }
/* Need any context to write to the vbo. */ /* Need any context to write to the vbo. */
ActivateContext(This, This->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(This, NULL, CTXUSAGE_RESOURCELOAD);
/* ProcessVertices reads from vertex buffers, which have to be assigned. DrawPrimitive and DrawPrimitiveUP /* ProcessVertices reads from vertex buffers, which have to be assigned. DrawPrimitive and DrawPrimitiveUP
* control the streamIsUP flag, thus restore it afterwards. * control the streamIsUP flag, thus restore it afterwards.
@ -4866,7 +4866,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_EndScene(IWineD3DDevice *iface) {
return WINED3DERR_INVALIDCALL; return WINED3DERR_INVALIDCALL;
} }
ActivateContext(This, This->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(This, NULL, CTXUSAGE_RESOURCELOAD);
/* We only have to do this if we need to read the, swapbuffers performs a flush for us */ /* We only have to do this if we need to read the, swapbuffers performs a flush for us */
glFlush(); glFlush();
/* No checkGLcall here to avoid locking the lock just for checking a call that hardly ever /* No checkGLcall here to avoid locking the lock just for checking a call that hardly ever
@ -5795,7 +5795,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
IWineD3DSurface_GetDesc(pDestinationSurface, &winedesc); IWineD3DSurface_GetDesc(pDestinationSurface, &winedesc);
} }
ActivateContext(This, This->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(This, NULL, CTXUSAGE_RESOURCELOAD);
ENTER_GL(); ENTER_GL();
GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB)); GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB));
@ -6048,7 +6048,7 @@ static void color_fill_fbo(IWineD3DDevice *iface, IWineD3DSurface *surface,
} else { } else {
TRACE("Surface %p is offscreen\n", surface); TRACE("Surface %p is offscreen\n", surface);
ActivateContext(This, This->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(This, NULL, CTXUSAGE_RESOURCELOAD);
ENTER_GL(); ENTER_GL();
context_bind_fbo(This->activeContext, GL_FRAMEBUFFER_EXT, &This->activeContext->dst_fbo); context_bind_fbo(This->activeContext, GL_FRAMEBUFFER_EXT, &This->activeContext->dst_fbo);
context_attach_surface_fbo(This->activeContext, GL_FRAMEBUFFER_EXT, 0, surface); context_attach_surface_fbo(This->activeContext, GL_FRAMEBUFFER_EXT, 0, surface);
@ -6436,7 +6436,7 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, WINED
if (src_swapchain) ActivateContext(This, src_surface, CTXUSAGE_RESOURCELOAD); if (src_swapchain) ActivateContext(This, src_surface, CTXUSAGE_RESOURCELOAD);
else if (dst_swapchain) ActivateContext(This, dst_surface, CTXUSAGE_RESOURCELOAD); else if (dst_swapchain) ActivateContext(This, dst_surface, CTXUSAGE_RESOURCELOAD);
else ActivateContext(This, This->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); else ActivateContext(This, NULL, CTXUSAGE_RESOURCELOAD);
if (src_swapchain) { if (src_swapchain) {
GLenum buffer = surface_get_gl_buffer(src_surface, src_swapchain); GLenum buffer = surface_get_gl_buffer(src_surface, src_swapchain);
@ -6646,7 +6646,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice* i
/* some basic validation checks */ /* some basic validation checks */
if(This->cursorTexture) { if(This->cursorTexture) {
ActivateContext(This, This->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(This, NULL, CTXUSAGE_RESOURCELOAD);
ENTER_GL(); ENTER_GL();
glDeleteTextures(1, &This->cursorTexture); glDeleteTextures(1, &This->cursorTexture);
LEAVE_GL(); LEAVE_GL();
@ -6705,7 +6705,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice* i
memcpy(&mem[width * bpp * i], &bits[rect.Pitch * i], width * bpp); memcpy(&mem[width * bpp * i], &bits[rect.Pitch * i], width * bpp);
IWineD3DSurface_UnlockRect(pCursorBitmap); IWineD3DSurface_UnlockRect(pCursorBitmap);
ActivateContext(This, This->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(This, NULL, CTXUSAGE_RESOURCELOAD);
ENTER_GL(); ENTER_GL();
@ -6906,7 +6906,7 @@ static void updateSurfaceDesc(IWineD3DSurfaceImpl *surface, const WINED3DPRESENT
if (surface->texture_name) if (surface->texture_name)
{ {
ActivateContext(This, This->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(This, NULL, CTXUSAGE_RESOURCELOAD);
ENTER_GL(); ENTER_GL();
glDeleteTextures(1, &surface->texture_name); glDeleteTextures(1, &surface->texture_name);
LEAVE_GL(); LEAVE_GL();
@ -6971,7 +6971,7 @@ void delete_opengl_contexts(IWineD3DDevice *iface, IWineD3DSwapChain *swapchain_
UINT i; UINT i;
IWineD3DBaseShaderImpl *shader; IWineD3DBaseShaderImpl *shader;
ActivateContext(This, This->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(This, NULL, CTXUSAGE_RESOURCELOAD);
IWineD3DDevice_EnumResources(iface, reset_unload_resources, NULL); IWineD3DDevice_EnumResources(iface, reset_unload_resources, NULL);
LIST_FOR_EACH_ENTRY(shader, &This->shaders, IWineD3DBaseShaderImpl, baseShader.shader_list_entry) { LIST_FOR_EACH_ENTRY(shader, &This->shaders, IWineD3DBaseShaderImpl, baseShader.shader_list_entry) {

View File

@ -759,7 +759,7 @@ HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This,
/* Simply activate the context for blitting. This disables all the things we don't want and /* Simply activate the context for blitting. This disables all the things we don't want and
* takes care of dirtifying. Dirtifying is preferred over pushing / popping, since drawing the * takes care of dirtifying. Dirtifying is preferred over pushing / popping, since drawing the
* patch (as opposed to normal draws) will most likely need different changes anyway. */ * patch (as opposed to normal draws) will most likely need different changes anyway. */
ActivateContext(This, This->lastActiveRenderTarget, CTXUSAGE_BLIT); ActivateContext(This, NULL, CTXUSAGE_BLIT);
/* First, locate the position data. This is provided in a vertex buffer in the stateblock. /* First, locate the position data. This is provided in a vertex buffer in the stateblock.
* Beware of vbos * Beware of vbos

View File

@ -4342,7 +4342,7 @@ static void shader_glsl_destroy(IWineD3DBaseShader *iface) {
return; return;
} }
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(device, NULL, CTXUSAGE_RESOURCELOAD);
if (priv->glsl_program && (IWineD3DBaseShader *)priv->glsl_program->pshader == iface) if (priv->glsl_program && (IWineD3DBaseShader *)priv->glsl_program->pshader == iface)
{ {
@ -4361,7 +4361,7 @@ static void shader_glsl_destroy(IWineD3DBaseShader *iface) {
return; return;
} }
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(device, NULL, CTXUSAGE_RESOURCELOAD);
if (priv->glsl_program && (IWineD3DBaseShader *)priv->glsl_program->vshader == iface) if (priv->glsl_program && (IWineD3DBaseShader *)priv->glsl_program->vshader == iface)
{ {

View File

@ -49,7 +49,7 @@ static void surface_cleanup(IWineD3DSurfaceImpl *This)
* target, Uninit3D() will activate a context before doing anything. */ * target, Uninit3D() will activate a context before doing anything. */
if (device->render_targets && device->render_targets[0]) if (device->render_targets && device->render_targets[0])
{ {
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(device, NULL, CTXUSAGE_RESOURCELOAD);
} }
ENTER_GL(); ENTER_GL();
@ -784,7 +784,7 @@ void surface_internal_preload(IWineD3DSurface *iface, enum WINED3DSRGB srgb)
TRACE("(%p) : About to load surface\n", This); TRACE("(%p) : About to load surface\n", This);
if(!device->isInDraw) { if(!device->isInDraw) {
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(device, NULL, CTXUSAGE_RESOURCELOAD);
} }
if (This->resource.format_desc->format == WINED3DFMT_P8 if (This->resource.format_desc->format == WINED3DFMT_P8
@ -870,7 +870,7 @@ static void WINAPI IWineD3DSurfaceImpl_UnLoad(IWineD3DSurface *iface) {
IWineD3DSurface_ModifyLocation(iface, SFLAG_INSRGBTEX, FALSE); IWineD3DSurface_ModifyLocation(iface, SFLAG_INSRGBTEX, FALSE);
This->Flags &= ~(SFLAG_ALLOCATED | SFLAG_SRGBALLOCATED); This->Flags &= ~(SFLAG_ALLOCATED | SFLAG_SRGBALLOCATED);
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(device, NULL, CTXUSAGE_RESOURCELOAD);
/* Destroy PBOs, but load them into real sysmem before */ /* Destroy PBOs, but load them into real sysmem before */
if(This->Flags & SFLAG_PBO) { if(This->Flags & SFLAG_PBO) {
@ -1247,7 +1247,7 @@ static void surface_prepare_system_memory(IWineD3DSurfaceImpl *This) {
GLenum error; GLenum error;
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice; IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(device, NULL, CTXUSAGE_RESOURCELOAD);
ENTER_GL(); ENTER_GL();
GL_EXTCALL(glGenBuffersARB(1, &This->pbo)); GL_EXTCALL(glGenBuffersARB(1, &This->pbo));
@ -1343,7 +1343,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED
lock_end: lock_end:
if(This->Flags & SFLAG_PBO) { if(This->Flags & SFLAG_PBO) {
ActivateContext(myDevice, myDevice->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(myDevice, NULL, CTXUSAGE_RESOURCELOAD);
ENTER_GL(); ENTER_GL();
GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, This->pbo)); GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, This->pbo));
checkGLcall("glBindBufferARB"); checkGLcall("glBindBufferARB");
@ -1503,7 +1503,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_UnlockRect(IWineD3DSurface *iface) {
if (This->Flags & SFLAG_PBO) { if (This->Flags & SFLAG_PBO) {
TRACE("Freeing PBO memory\n"); TRACE("Freeing PBO memory\n");
ActivateContext(myDevice, myDevice->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(myDevice, NULL, CTXUSAGE_RESOURCELOAD);
ENTER_GL(); ENTER_GL();
GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, This->pbo)); GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, This->pbo));
GL_EXTCALL(glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB)); GL_EXTCALL(glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB));
@ -2645,7 +2645,7 @@ static void WINAPI IWineD3DSurfaceImpl_BindTexture(IWineD3DSurface *iface, BOOL
name = srgb ? &This->texture_name_srgb : &This->texture_name; name = srgb ? &This->texture_name_srgb : &This->texture_name;
if(!device->isInDraw) { if(!device->isInDraw) {
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(device, NULL, CTXUSAGE_RESOURCELOAD);
} }
ENTER_GL(); ENTER_GL();
@ -4097,7 +4097,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_RealizePalette(IWineD3DSurface *iface)
IWineD3DSurface_ModifyLocation(iface, SFLAG_INDRAWABLE, FALSE); IWineD3DSurface_ModifyLocation(iface, SFLAG_INDRAWABLE, FALSE);
/* Re-upload the palette */ /* Re-upload the palette */
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(device, NULL, CTXUSAGE_RESOURCELOAD);
d3dfmt_p8_upload_palette(iface, convert); d3dfmt_p8_upload_palette(iface, convert);
} else { } else {
if(!(This->Flags & SFLAG_INSYSMEM)) { if(!(This->Flags & SFLAG_INSYSMEM)) {
@ -4788,7 +4788,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadLocation(IWineD3DSurface *iface, D
/* Download the surface to system memory */ /* Download the surface to system memory */
if(This->Flags & (SFLAG_INTEXTURE | SFLAG_INSRGBTEX)) { if(This->Flags & (SFLAG_INTEXTURE | SFLAG_INSRGBTEX)) {
if(!device->isInDraw) ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); if (!device->isInDraw) ActivateContext(device, NULL, CTXUSAGE_RESOURCELOAD);
surface_bind_and_dirtify(This, !(This->Flags & SFLAG_INTEXTURE)); surface_bind_and_dirtify(This, !(This->Flags & SFLAG_INTEXTURE));
surface_download_data(This); surface_download_data(This);
@ -4820,7 +4820,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadLocation(IWineD3DSurface *iface, D
* but it isn't set (yet) in all cases it is getting called. */ * but it isn't set (yet) in all cases it is getting called. */
if((convert != NO_CONVERSION) && (This->Flags & SFLAG_PBO)) { if((convert != NO_CONVERSION) && (This->Flags & SFLAG_PBO)) {
TRACE("Removing the pbo attached to surface %p\n", This); TRACE("Removing the pbo attached to surface %p\n", This);
if (!device->isInDraw) ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); if (!device->isInDraw) ActivateContext(device, NULL, CTXUSAGE_RESOURCELOAD);
surface_remove_pbo(This); surface_remove_pbo(This);
} }
@ -4872,7 +4872,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadLocation(IWineD3DSurface *iface, D
} }
} }
if(!device->isInDraw) ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); if (!device->isInDraw) ActivateContext(device, NULL, CTXUSAGE_RESOURCELOAD);
surface_bind_and_dirtify(This, srgb); surface_bind_and_dirtify(This, srgb);
if(This->CKeyFlags & WINEDDSD_CKSRCBLT) { if(This->CKeyFlags & WINEDDSD_CKSRCBLT) {

View File

@ -63,7 +63,7 @@ static void texture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3DSRG
{ {
/* ActivateContext sets isInDraw to TRUE when loading a pbuffer into a texture, /* ActivateContext sets isInDraw to TRUE when loading a pbuffer into a texture,
* thus no danger of recursive calls. */ * thus no danger of recursive calls. */
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(device, NULL, CTXUSAGE_RESOURCELOAD);
} }
if (This->resource.format_desc->format == WINED3DFMT_P8 if (This->resource.format_desc->format == WINED3DFMT_P8

View File

@ -41,7 +41,7 @@ static void volumetexture_internal_preload(IWineD3DBaseTexture *iface, enum WINE
if (!device->isInDraw) if (!device->isInDraw)
{ {
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); ActivateContext(device, NULL, CTXUSAGE_RESOURCELOAD);
} }
else if (GL_SUPPORT(EXT_TEXTURE_SRGB) && This->baseTexture.bindCount > 0) else if (GL_SUPPORT(EXT_TEXTURE_SRGB) && This->baseTexture.bindCount > 0)
{ {