[PATCH 07/10] wined3d: Simply pass an IWineD3DSurfaceImpl pointer to context_attach_depth_stencil_fbo().

Henri Verbeet hverbeet at codeweavers.com
Thu Apr 15 12:21:26 CDT 2010


---
 dlls/wined3d/context.c         |   25 ++++++++++++-------------
 dlls/wined3d/surface.c         |    2 +-
 dlls/wined3d/wined3d_private.h |    2 +-
 3 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index e98eecb..43a6d8a 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -182,51 +182,50 @@ static void context_apply_attachment_filter_states(IWineD3DSurfaceImpl *surface)
 
 /* GL locking is done by the caller */
 void context_attach_depth_stencil_fbo(struct wined3d_context *context,
-        GLenum fbo_target, IWineD3DSurface *depth_stencil, BOOL use_render_buffer)
+        GLenum fbo_target, IWineD3DSurfaceImpl *depth_stencil, BOOL use_render_buffer)
 {
-    IWineD3DSurfaceImpl *depth_stencil_impl = (IWineD3DSurfaceImpl *)depth_stencil;
     const struct wined3d_gl_info *gl_info = context->gl_info;
 
     TRACE("Attach depth stencil %p\n", depth_stencil);
 
     if (depth_stencil)
     {
-        DWORD format_flags = depth_stencil_impl->resource.format_desc->Flags;
+        DWORD format_flags = depth_stencil->resource.format_desc->Flags;
 
-        if (use_render_buffer && depth_stencil_impl->current_renderbuffer)
+        if (use_render_buffer && depth_stencil->current_renderbuffer)
         {
             if (format_flags & WINED3DFMT_FLAG_DEPTH)
             {
                 gl_info->fbo_ops.glFramebufferRenderbuffer(fbo_target, GL_DEPTH_ATTACHMENT,
-                        GL_RENDERBUFFER, depth_stencil_impl->current_renderbuffer->id);
+                        GL_RENDERBUFFER, depth_stencil->current_renderbuffer->id);
                 checkGLcall("glFramebufferRenderbuffer()");
             }
 
             if (format_flags & WINED3DFMT_FLAG_STENCIL)
             {
                 gl_info->fbo_ops.glFramebufferRenderbuffer(fbo_target, GL_STENCIL_ATTACHMENT,
-                        GL_RENDERBUFFER, depth_stencil_impl->current_renderbuffer->id);
+                        GL_RENDERBUFFER, depth_stencil->current_renderbuffer->id);
                 checkGLcall("glFramebufferRenderbuffer()");
             }
         }
         else
         {
-            surface_prepare_texture(depth_stencil_impl, gl_info, FALSE);
-            context_apply_attachment_filter_states(depth_stencil_impl);
+            surface_prepare_texture(depth_stencil, gl_info, FALSE);
+            context_apply_attachment_filter_states(depth_stencil);
 
             if (format_flags & WINED3DFMT_FLAG_DEPTH)
             {
                 gl_info->fbo_ops.glFramebufferTexture2D(fbo_target, GL_DEPTH_ATTACHMENT,
-                        depth_stencil_impl->texture_target, depth_stencil_impl->texture_name,
-                        depth_stencil_impl->texture_level);
+                        depth_stencil->texture_target, depth_stencil->texture_name,
+                        depth_stencil->texture_level);
                 checkGLcall("glFramebufferTexture2D()");
             }
 
             if (format_flags & WINED3DFMT_FLAG_STENCIL)
             {
                 gl_info->fbo_ops.glFramebufferTexture2D(fbo_target, GL_STENCIL_ATTACHMENT,
-                        depth_stencil_impl->texture_target, depth_stencil_impl->texture_name,
-                        depth_stencil_impl->texture_level);
+                        depth_stencil->texture_target, depth_stencil->texture_name,
+                        depth_stencil->texture_level);
                 checkGLcall("glFramebufferTexture2D()");
             }
         }
@@ -426,7 +425,7 @@ static void context_apply_fbo_entry(struct wined3d_context *context, struct fbo_
 
             surface_set_compatible_renderbuffer(device->stencilBufferTarget, w, h);
         }
-        context_attach_depth_stencil_fbo(context, GL_FRAMEBUFFER, device->stencilBufferTarget, TRUE);
+        context_attach_depth_stencil_fbo(context, GL_FRAMEBUFFER, (IWineD3DSurfaceImpl *)device->stencilBufferTarget, TRUE);
 
         entry->attached = TRUE;
     }
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 0ac29c8..c3f09d4 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -4140,7 +4140,7 @@ void surface_load_ds_location(IWineD3DSurface *iface, struct wined3d_context *co
             gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER,
                     GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, device->depth_blt_rb);
             checkGLcall("glFramebufferRenderbufferEXT");
-            context_attach_depth_stencil_fbo(context, GL_FRAMEBUFFER, iface, FALSE);
+            context_attach_depth_stencil_fbo(context, GL_FRAMEBUFFER, This, FALSE);
 
             /* Do the actual blit */
             surface_depth_blt(This, gl_info, device->depth_blt_texture,
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 7a86d4c..95445a1 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1214,7 +1214,7 @@ void context_resource_released(IWineD3DDevice *iface,
         IWineD3DResource *resource, WINED3DRESOURCETYPE type) DECLSPEC_HIDDEN;
 void context_bind_fbo(struct wined3d_context *context, GLenum target, GLuint *fbo) DECLSPEC_HIDDEN;
 void context_attach_depth_stencil_fbo(struct wined3d_context *context,
-        GLenum fbo_target, IWineD3DSurface *depth_stencil, BOOL use_render_buffer) DECLSPEC_HIDDEN;
+        GLenum fbo_target, IWineD3DSurfaceImpl *depth_stencil, BOOL use_render_buffer) DECLSPEC_HIDDEN;
 void context_attach_surface_fbo(const struct wined3d_context *context,
         GLenum fbo_target, DWORD idx, IWineD3DSurfaceImpl *surface) DECLSPEC_HIDDEN;
 struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, IWineD3DSurfaceImpl *target,
-- 
1.6.4.4




More information about the wine-patches mailing list