[2/3] wined3d: Fix context_apply_draw_buffers() with backbuffer ORM.

Matteo Bruni matteo.mystral at gmail.com
Tue Jun 21 16:49:31 CDT 2011


Here I modified surface_get_gl_buffer() to fix backbuffer ORM, an
alternative approach would be to modify
context_apply_[blit|clear|draw]_state() in a similar fashion instead.
-------------- next part --------------
From 4878bceade47d649f208bfece908c8b2f5782fad Mon Sep 17 00:00:00 2001
From: Matteo Bruni <mbruni at codeweavers.com>
Date: Tue, 21 Jun 2011 18:28:36 +0200
Subject: wined3d: Fix context_apply_draw_buffers() with backbuffer ORM.

---
 dlls/wined3d/context.c |    3 +--
 dlls/wined3d/surface.c |    6 ++++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 872ba03..f7fb6c5 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -2029,8 +2029,7 @@ static void context_apply_draw_buffers(struct wined3d_context *context, DWORD rt
         }
         else
         {
-            glDrawBuffer(draw_buffer_from_rt_mask(rt_mask));
-            checkGLcall("glDrawBuffer()");
+            ERR("Unexpected draw buffers mask with backbuffer ORM.\n");
         }
     }
 }
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index d3b54c0..66583f6 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2420,6 +2420,12 @@ GLenum surface_get_gl_buffer(struct wined3d_surface *surface)
 
     if (surface->container.type != WINED3D_CONTAINER_SWAPCHAIN)
     {
+        if (wined3d_settings.offscreen_rendering_mode != ORM_FBO)
+        {
+            TRACE("Surface %p not on a swapchain, returning offscreen buffer.\n", surface);
+            return surface->resource.device->offscreenBuffer;
+        }
+
         ERR("Surface %p is not on a swapchain.\n", surface);
         return GL_NONE;
     }
-- 
1.7.3.4


More information about the wine-patches mailing list