Henri Verbeet : wined3d: Set the viewport to the texture size in depth_blt( ).

Alexandre Julliard julliard at winehq.org
Fri Sep 5 06:57:48 CDT 2008


Module: wine
Branch: master
Commit: 81effcf30db0a7e5726f04ac4a4cf10d00124277
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=81effcf30db0a7e5726f04ac4a4cf10d00124277

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu Sep  4 15:32:36 2008 +0200

wined3d: Set the viewport to the texture size in depth_blt().

---

 dlls/wined3d/drawprim.c        |    5 +++--
 dlls/wined3d/surface.c         |    4 ++--
 dlls/wined3d/wined3d_private.h |    8 ++++++--
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index 60eb721..068e082 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -708,11 +708,11 @@ static void drawStridedSlowVs(IWineD3DDevice *iface, WineDirect3DVertexStridedDa
     glEnd();
 }
 
-void depth_blt(IWineD3DDevice *iface, GLuint texture) {
+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);
+    glPushAttrib(GL_ENABLE_BIT | GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_VIEWPORT_BIT);
 
     glDisable(GL_CULL_FACE);
     glEnable(GL_BLEND);
@@ -723,6 +723,7 @@ void depth_blt(IWineD3DDevice *iface, GLuint texture) {
     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);
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 8b50cf3..4e7626c 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -3995,7 +3995,7 @@ void surface_load_ds_location(IWineD3DSurface *iface, DWORD location) {
             attach_depth_stencil_fbo(device, GL_FRAMEBUFFER_EXT, iface, FALSE);
 
             /* Do the actual blit */
-            depth_blt((IWineD3DDevice *)device, device->depth_blt_texture);
+            depth_blt((IWineD3DDevice *)device, device->depth_blt_texture, This->currentDesc.Width, This->currentDesc.Height);
             checkGLcall("depth_blt");
 
             if (device->render_offscreen) {
@@ -4017,7 +4017,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);
+            depth_blt((IWineD3DDevice *)device, This->glDescription.textureName, This->currentDesc.Width, This->currentDesc.Height);
             checkGLcall("depth_blt");
 
             if (device->render_offscreen) {
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index ebe0f7f..794293a 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -785,7 +785,11 @@ struct ffp_settings {
         FOG_EXP,
         FOG_EXP2
     } fog;
-    unsigned char sRGB_write;
+    /* Use an int instead of a char to get dword alignment. gcc tends to align the
+     * size of the whole structure, so there are 3 padding bytes. These remain
+     * uninitialized in the construction function and cause confusion in the hashmap
+     */
+    unsigned int sRGB_write;
 };
 
 struct ffp_desc
@@ -2516,6 +2520,6 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, WINED
 void bind_fbo(IWineD3DDevice *iface, GLenum target, GLuint *fbo);
 void attach_depth_stencil_fbo(IWineD3DDeviceImpl *This, GLenum fbo_target, IWineD3DSurface *depth_stencil, BOOL use_render_buffer);
 void attach_surface_fbo(IWineD3DDeviceImpl *This, GLenum fbo_target, DWORD idx, IWineD3DSurface *surface);
-void depth_blt(IWineD3DDevice *iface, GLuint texture);
+void depth_blt(IWineD3DDevice *iface, GLuint texture, GLsizei w, GLsizei h);
 
 #endif




More information about the wine-cvs mailing list