wined3d: Some render target->texture blit context handling.
This commit is contained in:
parent
09aefe2108
commit
ef65b233c0
|
@ -5553,9 +5553,6 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, WINED
|
||||||
TRACE("src_rect [%u, %u]->[%u, %u]\n", src_rect->x1, src_rect->y1, src_rect->x2, src_rect->y2);
|
TRACE("src_rect [%u, %u]->[%u, %u]\n", src_rect->x1, src_rect->y1, src_rect->x2, src_rect->y2);
|
||||||
TRACE("dst_rect [%u, %u]->[%u, %u]\n", dst_rect->x1, dst_rect->y1, dst_rect->x2, dst_rect->y2);
|
TRACE("dst_rect [%u, %u]->[%u, %u]\n", dst_rect->x1, dst_rect->y1, dst_rect->x2, dst_rect->y2);
|
||||||
|
|
||||||
glDisable(GL_SCISSOR_TEST);
|
|
||||||
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(WINED3DRS_SCISSORTESTENABLE));
|
|
||||||
|
|
||||||
switch (filter) {
|
switch (filter) {
|
||||||
case WINED3DTEXF_LINEAR:
|
case WINED3DTEXF_LINEAR:
|
||||||
gl_filter = GL_LINEAR;
|
gl_filter = GL_LINEAR;
|
||||||
|
@ -5571,10 +5568,12 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, WINED
|
||||||
|
|
||||||
/* Attach src surface to src fbo */
|
/* Attach src surface to src fbo */
|
||||||
src_swapchain = get_swapchain(src_surface);
|
src_swapchain = get_swapchain(src_surface);
|
||||||
|
ENTER_GL();
|
||||||
if (src_swapchain) {
|
if (src_swapchain) {
|
||||||
GLenum buffer;
|
GLenum buffer;
|
||||||
|
|
||||||
TRACE("Source surface %p is onscreen\n", src_surface);
|
TRACE("Source surface %p is onscreen\n", src_surface);
|
||||||
|
ActivateContext(This, src_surface, CTXUSAGE_RESOURCELOAD);
|
||||||
|
|
||||||
GL_EXTCALL(glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0));
|
GL_EXTCALL(glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0));
|
||||||
buffer = surface_get_gl_buffer(src_surface, src_swapchain);
|
buffer = surface_get_gl_buffer(src_surface, src_swapchain);
|
||||||
|
@ -5597,6 +5596,7 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, WINED
|
||||||
GLenum buffer;
|
GLenum buffer;
|
||||||
|
|
||||||
TRACE("Destination surface %p is onscreen\n", dst_surface);
|
TRACE("Destination surface %p is onscreen\n", dst_surface);
|
||||||
|
ActivateContext(This, dst_surface, CTXUSAGE_RESOURCELOAD);
|
||||||
|
|
||||||
GL_EXTCALL(glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0));
|
GL_EXTCALL(glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0));
|
||||||
buffer = surface_get_gl_buffer(dst_surface, dst_swapchain);
|
buffer = surface_get_gl_buffer(dst_surface, dst_swapchain);
|
||||||
|
@ -5607,11 +5607,19 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, WINED
|
||||||
dst_rect->y2 = ((IWineD3DSurfaceImpl *)dst_surface)->currentDesc.Height - dst_rect->y2;
|
dst_rect->y2 = ((IWineD3DSurfaceImpl *)dst_surface)->currentDesc.Height - dst_rect->y2;
|
||||||
} else {
|
} else {
|
||||||
TRACE("Destination surface %p is offscreen\n", dst_surface);
|
TRACE("Destination surface %p is offscreen\n", dst_surface);
|
||||||
|
|
||||||
|
/* No src or dst swapchain? Make sure some context is active(multithreading) */
|
||||||
|
if(!src_swapchain) {
|
||||||
|
ActivateContext(This, This->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
|
||||||
|
}
|
||||||
|
|
||||||
bind_fbo(iface, GL_DRAW_FRAMEBUFFER_EXT, &This->dst_fbo);
|
bind_fbo(iface, GL_DRAW_FRAMEBUFFER_EXT, &This->dst_fbo);
|
||||||
attach_surface_fbo(This, GL_DRAW_FRAMEBUFFER_EXT, 0, dst_surface);
|
attach_surface_fbo(This, GL_DRAW_FRAMEBUFFER_EXT, 0, dst_surface);
|
||||||
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
|
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
|
||||||
checkGLcall("glDrawBuffer()");
|
checkGLcall("glDrawBuffer()");
|
||||||
}
|
}
|
||||||
|
glDisable(GL_SCISSOR_TEST);
|
||||||
|
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(WINED3DRS_SCISSORTESTENABLE));
|
||||||
|
|
||||||
if (flip) {
|
if (flip) {
|
||||||
GL_EXTCALL(glBlitFramebufferEXT(src_rect->x1, src_rect->y1, src_rect->x2, src_rect->y2,
|
GL_EXTCALL(glBlitFramebufferEXT(src_rect->x1, src_rect->y1, src_rect->x2, src_rect->y2,
|
||||||
|
@ -5636,6 +5644,7 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, WINED
|
||||||
glDrawBuffer(GL_BACK);
|
glDrawBuffer(GL_BACK);
|
||||||
checkGLcall("glDrawBuffer()");
|
checkGLcall("glDrawBuffer()");
|
||||||
}
|
}
|
||||||
|
LEAVE_GL();
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface, DWORD RenderTargetIndex, IWineD3DSurface *pRenderTarget) {
|
static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface, DWORD RenderTargetIndex, IWineD3DSurface *pRenderTarget) {
|
||||||
|
|
|
@ -2385,6 +2385,7 @@ static inline void fb_copy_to_texture_direct(IWineD3DSurfaceImpl *This, IWineD3D
|
||||||
ENTER_GL();
|
ENTER_GL();
|
||||||
|
|
||||||
ActivateContext(myDevice, SrcSurface, CTXUSAGE_BLIT);
|
ActivateContext(myDevice, SrcSurface, CTXUSAGE_BLIT);
|
||||||
|
IWineD3DSurface_PreLoad((IWineD3DSurface *) This);
|
||||||
|
|
||||||
/* Bind the target texture */
|
/* Bind the target texture */
|
||||||
glBindTexture(GL_TEXTURE_2D, This->glDescription.textureName);
|
glBindTexture(GL_TEXTURE_2D, This->glDescription.textureName);
|
||||||
|
@ -2470,6 +2471,7 @@ static inline void fb_copy_to_texture_hwstretch(IWineD3DSurfaceImpl *This, IWine
|
||||||
/* Activate the Proper context for reading from the source surface, set it up for blitting */
|
/* Activate the Proper context for reading from the source surface, set it up for blitting */
|
||||||
ENTER_GL();
|
ENTER_GL();
|
||||||
ActivateContext(myDevice, SrcSurface, CTXUSAGE_BLIT);
|
ActivateContext(myDevice, SrcSurface, CTXUSAGE_BLIT);
|
||||||
|
IWineD3DSurface_PreLoad((IWineD3DSurface *) This);
|
||||||
|
|
||||||
/* Try to use an aux buffer for drawing the rectangle. This way it doesn't need restoring.
|
/* Try to use an aux buffer for drawing the rectangle. This way it doesn't need restoring.
|
||||||
* This way we don't have to wait for the 2nd readback to finish to leave this function.
|
* This way we don't have to wait for the 2nd readback to finish to leave this function.
|
||||||
|
@ -2802,14 +2804,6 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, RECT *
|
||||||
/* Destination color key is checked above */
|
/* Destination color key is checked above */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Call preload for the surface to make sure it isn't dirty */
|
|
||||||
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
|
||||||
GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB));
|
|
||||||
checkGLcall("glActiveTextureARB");
|
|
||||||
}
|
|
||||||
IWineD3DDeviceImpl_MarkStateDirty(This->resource.wineD3DDevice, STATE_SAMPLER(0));
|
|
||||||
IWineD3DSurface_PreLoad((IWineD3DSurface *) This);
|
|
||||||
|
|
||||||
/* Make sure that the top pixel is always above the bottom pixel, and keep a separate upside down flag
|
/* Make sure that the top pixel is always above the bottom pixel, and keep a separate upside down flag
|
||||||
* glCopyTexSubImage is a bit picky about the parameters we pass to it
|
* glCopyTexSubImage is a bit picky about the parameters we pass to it
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue