[2/3] wined3d: Fix context_apply_clear_state with ORM = backbuffer.

Matteo Bruni matteo.mystral at gmail.com
Mon Aug 16 06:25:03 CDT 2010


-------------- next part --------------
From ddacb9a5c7ec65b2ac7b128b255ef4da4b7e2c1f Mon Sep 17 00:00:00 2001
From: Matteo Bruni <matteo.mystral at gmail.com>
Date: Sat, 7 Aug 2010 15:29:41 +0200
Subject: wined3d: Fix context_apply_clear_state with ORM = backbuffer.

---
 dlls/wined3d/context.c |   31 +++++++++++++++++++------------
 1 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 93b4228..72b84c9 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1972,7 +1972,7 @@ static void context_apply_draw_buffer(struct wined3d_context *context, BOOL blit
     {
         ENTER_GL();
         glDrawBuffer(surface_get_gl_buffer(rt));
-        checkGLcall("glDrawBuffers()");
+        checkGLcall("glDrawBuffer()");
         LEAVE_GL();
     }
     else
@@ -2172,22 +2172,29 @@ void context_apply_clear_state(struct wined3d_context *context, IWineD3DDeviceIm
     }
     else
     {
-        const struct wined3d_gl_info *gl_info = context->gl_info;
+        ENTER_GL();
 
-        for (i = 0; i < gl_info->limits.buffers; ++i)
+        if (wined3d_settings.offscreen_rendering_mode == ORM_FBO)
         {
-            if (i < rt_count && rts[i])
-                context->draw_buffers[i] = GL_COLOR_ATTACHMENT0 + i;
-            else
-                context->draw_buffers[i] = GL_NONE;
+            const struct wined3d_gl_info *gl_info = context->gl_info;
+            for (i = 0; i < gl_info->limits.buffers; ++i)
+            {
+                if (i < rt_count && rts[i])
+                    context->draw_buffers[i] = GL_COLOR_ATTACHMENT0 + i;
+                else
+                    context->draw_buffers[i] = GL_NONE;
+            }
+            GL_EXTCALL(glDrawBuffersARB(gl_info->limits.buffers, context->draw_buffers));
+            checkGLcall("glDrawBuffers()");
+            context->draw_buffer_dirty = TRUE;
+        }
+        else
+        {
+            glDrawBuffer(device->offscreenBuffer);
+            checkGLcall("glDrawBuffer()");
         }
 
-        ENTER_GL();
-        GL_EXTCALL(glDrawBuffersARB(gl_info->limits.buffers, context->draw_buffers));
-        checkGLcall("glDrawBuffers()");
         LEAVE_GL();
-
-        context->draw_buffer_dirty = TRUE;
     }
 
     if (context->last_was_blit)
-- 
1.7.1


More information about the wine-patches mailing list