[PATCH] wined3d: use surface_prepare_texture for surface allocation in read_from_framebuffer_texture

Roderick Colenbrander thunderbird2k at gmail.com
Wed Apr 28 12:54:40 CDT 2010


Right now read_from_framebuffer_texture calls surface_allocate_surface but this call doesn't
set conversion flags which caused bug 22356. The use of surface_prepare_texture fixes this.
---
 dlls/wined3d/surface.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index fcdfec8..32ee197 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1493,7 +1493,6 @@ static void read_from_framebuffer_texture(IWineD3DSurfaceImpl *This, BOOL srgb)
     const struct wined3d_gl_info *gl_info;
     struct wined3d_context *context;
     GLint prevRead;
-    BOOL alloc_flag = srgb ? SFLAG_SRGBALLOCATED : SFLAG_ALLOCATED;
 
     /* Activate the surface to read from. In some situations it isn't the currently active target(e.g. backbuffer
      * locking during offscreen rendering). RESOURCELOAD is ok because glCopyTexSubImage2D isn't affected by any
@@ -1502,6 +1501,7 @@ static void read_from_framebuffer_texture(IWineD3DSurfaceImpl *This, BOOL srgb)
     context = context_acquire(device, This, CTXUSAGE_RESOURCELOAD);
     gl_info = context->gl_info;
 
+    surface_prepare_texture(This, gl_info, srgb);
     surface_bind_and_dirtify(This, srgb);
 
     ENTER_GL();
@@ -1534,12 +1534,6 @@ static void read_from_framebuffer_texture(IWineD3DSurfaceImpl *This, BOOL srgb)
         LEAVE_GL();
     }
 
-    if (!(This->Flags & alloc_flag))
-    {
-        surface_allocate_surface(This, gl_info, This->resource.format_desc, srgb);
-        This->Flags |= alloc_flag;
-    }
-
     ENTER_GL();
     /* If !SrcIsUpsideDown we should flip the surface.
      * This can be done using glCopyTexSubImage2D but this
-- 
1.6.3.3




More information about the wine-patches mailing list