From 4034a29f199531eb4b592765bf381c1254f0da05 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Mon, 27 Oct 2008 18:31:31 +0100 Subject: [PATCH] wined3d: Move depth_blt to surface.c. --- dlls/wined3d/drawprim.c | 37 ------------------------------ dlls/wined3d/surface.c | 42 ++++++++++++++++++++++++++++++++-- dlls/wined3d/wined3d_private.h | 1 - 3 files changed, 40 insertions(+), 40 deletions(-) diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c index 267bdf85209..b3612bd67e7 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c @@ -653,43 +653,6 @@ static void drawStridedSlowVs(IWineD3DDevice *iface, WineDirect3DVertexStridedDa glEnd(); } -void depth_blt(IWineD3DDevice *iface, GLuint texture, GLsizei w, GLsizei h) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - GLint old_binding = 0; - - glPushAttrib(GL_ENABLE_BIT | GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_VIEWPORT_BIT); - - glDisable(GL_CULL_FACE); - glEnable(GL_BLEND); - glDisable(GL_ALPHA_TEST); - glDisable(GL_SCISSOR_TEST); - glDisable(GL_STENCIL_TEST); - glEnable(GL_DEPTH_TEST); - glDepthFunc(GL_ALWAYS); - glDepthMask(GL_TRUE); - glBlendFunc(GL_ZERO, GL_ONE); - glViewport(0, 0, w, h); - - GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB)); - glGetIntegerv(GL_TEXTURE_BINDING_2D, &old_binding); - glBindTexture(GL_TEXTURE_2D, texture); - - This->shader_backend->shader_select_depth_blt(iface); - - glBegin(GL_TRIANGLE_STRIP); - glVertex2f(-1.0f, -1.0f); - glVertex2f(1.0f, -1.0f); - glVertex2f(-1.0f, 1.0f); - glVertex2f(1.0f, 1.0f); - glEnd(); - - glBindTexture(GL_TEXTURE_2D, old_binding); - - glPopAttrib(); - - This->shader_backend->shader_deselect_depth_blt(iface); -} - static inline void drawStridedInstanced(IWineD3DDevice *iface, WineDirect3DVertexStridedData *sd, UINT numberOfVertices, GLenum glPrimitiveType, const void *idxData, short idxSize, ULONG minIndex, ULONG startIdx, ULONG startVertex) { diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 953985b68c7..a44131a2442 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -3954,6 +3954,44 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_PrivateSetup(IWineD3DSurface *iface) { return WINED3D_OK; } +static void surface_depth_blt(IWineD3DSurfaceImpl *This, GLuint texture, GLsizei w, GLsizei h) +{ + IWineD3DDeviceImpl *device = This->resource.wineD3DDevice; + GLint old_binding = 0; + + glPushAttrib(GL_ENABLE_BIT | GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_VIEWPORT_BIT); + + glDisable(GL_CULL_FACE); + glEnable(GL_BLEND); + glDisable(GL_ALPHA_TEST); + glDisable(GL_SCISSOR_TEST); + glDisable(GL_STENCIL_TEST); + glEnable(GL_DEPTH_TEST); + glDepthFunc(GL_ALWAYS); + glDepthMask(GL_TRUE); + glBlendFunc(GL_ZERO, GL_ONE); + glViewport(0, 0, w, h); + + GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB)); + glGetIntegerv(GL_TEXTURE_BINDING_2D, &old_binding); + glBindTexture(GL_TEXTURE_2D, texture); + + device->shader_backend->shader_select_depth_blt((IWineD3DDevice *)device); + + glBegin(GL_TRIANGLE_STRIP); + glVertex2f(-1.0f, -1.0f); + glVertex2f(1.0f, -1.0f); + glVertex2f(-1.0f, 1.0f); + glVertex2f(1.0f, 1.0f); + glEnd(); + + glBindTexture(GL_TEXTURE_2D, old_binding); + + glPopAttrib(); + + device->shader_backend->shader_deselect_depth_blt((IWineD3DDevice *)device); +} + void surface_modify_ds_location(IWineD3DSurface *iface, DWORD location) { IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; @@ -4037,7 +4075,7 @@ void surface_load_ds_location(IWineD3DSurface *iface, DWORD location) { context_attach_depth_stencil_fbo(device, GL_FRAMEBUFFER_EXT, iface, FALSE); /* Do the actual blit */ - depth_blt((IWineD3DDevice *)device, device->depth_blt_texture, This->currentDesc.Width, This->currentDesc.Height); + surface_depth_blt(This, device->depth_blt_texture, This->currentDesc.Width, This->currentDesc.Height); checkGLcall("depth_blt"); if (device->activeContext->current_fbo) { @@ -4059,7 +4097,7 @@ void surface_load_ds_location(IWineD3DSurface *iface, DWORD location) { GL_EXTCALL(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0)); checkGLcall("glBindFramebuffer()"); - depth_blt((IWineD3DDevice *)device, This->glDescription.textureName, This->currentDesc.Width, This->currentDesc.Height); + surface_depth_blt(This, This->glDescription.textureName, This->currentDesc.Width, This->currentDesc.Height); checkGLcall("depth_blt"); if (device->activeContext->current_fbo) { diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index bc6a1cbcf8f..428fedf57e9 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2442,5 +2442,4 @@ static inline BOOL use_ps(IWineD3DDeviceImpl *device) { void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, WINED3DRECT *src_rect, IWineD3DSurface *dst_surface, WINED3DRECT *dst_rect, const WINED3DTEXTUREFILTERTYPE filter, BOOL flip); -void depth_blt(IWineD3DDevice *iface, GLuint texture, GLsizei w, GLsizei h); #endif