[PATCH 4/4] wined3d: Retrieve the surface's texture name through a function.

Henri Verbeet hverbeet at codeweavers.com
Wed Mar 2 01:55:49 CST 2011


---
 dlls/wined3d/context.c         |   14 ++++++--------
 dlls/wined3d/wined3d_private.h |    5 +++++
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index cc0ad7e..9ace3b2 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -273,20 +273,18 @@ static void context_attach_surface_fbo(const struct wined3d_context *context,
 
     if (surface && surface->resource.format->id != WINED3DFMT_NULL)
     {
+        BOOL srgb;
+
         switch (location)
         {
             case SFLAG_INTEXTURE:
-                surface_prepare_texture(surface, gl_info, FALSE);
-                context_apply_attachment_filter_states(surface, location);
-                gl_info->fbo_ops.glFramebufferTexture2D(fbo_target, GL_COLOR_ATTACHMENT0 + idx,
-                        surface->texture_target, surface->texture_name, surface->texture_level);
-                break;
-
             case SFLAG_INSRGBTEX:
-                surface_prepare_texture(surface, gl_info, TRUE);
+                srgb = location == SFLAG_INSRGBTEX;
+                surface_prepare_texture(surface, gl_info, srgb);
                 context_apply_attachment_filter_states(surface, location);
                 gl_info->fbo_ops.glFramebufferTexture2D(fbo_target, GL_COLOR_ATTACHMENT0 + idx,
-                        surface->texture_target, surface->texture_name_srgb, surface->texture_level);
+                        surface->texture_target, surface_get_texture_name(surface, srgb),
+                        surface->texture_level);
                 break;
 
             default:
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 3155b04..32a2189 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2155,6 +2155,11 @@ static inline IWineD3DSurfaceImpl *surface_from_resource(struct wined3d_resource
     return CONTAINING_RECORD(resource, IWineD3DSurfaceImpl, resource);
 }
 
+static inline GLuint surface_get_texture_name(IWineD3DSurfaceImpl *surface, BOOL srgb)
+{
+    return srgb ? surface->texture_name_srgb : surface->texture_name;
+}
+
 void surface_add_dirty_rect(IWineD3DSurfaceImpl *surface, const RECT *dirty_rect) DECLSPEC_HIDDEN;
 void surface_bind(IWineD3DSurfaceImpl *surface, BOOL srgb) DECLSPEC_HIDDEN;
 HRESULT surface_color_fill(IWineD3DSurfaceImpl *s, const RECT *rect, const WINED3DCOLORVALUE *color) DECLSPEC_HIDDEN;
-- 
1.7.3.4




More information about the wine-patches mailing list