[PATCH 1/4] wined3d: Explicitly handle 0 rt_count right at the start of context_apply_draw_buffers().

Henri Verbeet hverbeet at codeweavers.com
Fri Apr 8 13:22:49 CDT 2011


It's trivial, and allows the rest of the code to assume at least 1 render
target is present.
---
 dlls/wined3d/context.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 5b5ae5a..64380c8 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1915,7 +1915,14 @@ static struct wined3d_context *FindContext(IWineD3DDeviceImpl *This, IWineD3DSur
 /* Context activation is done by the caller. */
 static void context_apply_draw_buffers(struct wined3d_context *context, UINT rt_count, IWineD3DSurfaceImpl **rts)
 {
-    if (rt_count && !surface_is_offscreen(rts[0]))
+    if (!rt_count)
+    {
+        ENTER_GL();
+        glDrawBuffer(GL_NONE);
+        checkGLcall("glDrawBuffer()");
+        LEAVE_GL();
+    }
+    else if (!surface_is_offscreen(rts[0]))
     {
         ENTER_GL();
         glDrawBuffer(surface_get_gl_buffer(rts[0]));
@@ -1951,7 +1958,7 @@ static void context_apply_draw_buffers(struct wined3d_context *context, UINT rt_
         }
         else
         {
-            glDrawBuffer(rt_count ? rts[0]->resource.device->offscreenBuffer : GL_NONE);
+            glDrawBuffer(rts[0]->resource.device->offscreenBuffer);
             checkGLcall("glDrawBuffer()");
         }
         LEAVE_GL();
-- 
1.7.3.4




More information about the wine-patches mailing list