[1/?] WineD3D: Use the scissor test when clearing the full surface too

Stefan Dösinger stefan at codeweavers.com
Fri Mar 2 19:54:34 CST 2007


I think it is easier and faster to just set the scissor rectangle then to 
check for the 101 conditions needed to safely deactivate it.

I'm marking this patch as 1/? because I don't know if I am resending cleaned 
up context selection patches this weekend.
-------------- next part --------------
From 0760f98f07048608a488e935cb0b5b1b98b345fa Mon Sep 17 00:00:00 2001
From: Stefan Doesinger <stefan at codeweavers.com>
Date: Fri, 2 Mar 2007 09:25:02 +0100
Subject: [PATCH] WineD3D: Use the scissor test when clearing the full surface too

It was incorrect to disable the scissor test for full surfaces in my clear patch. With back buffer offscreen
rendering the viewport does not seem to restrict clearing, and with different sizes of depth stencil and color
buffer the final fantasy XI demo seems to expect the clear to be restricted.
---
 dlls/wined3d/device.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 0ad2c47..46e0e10 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4138,14 +4138,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Clear(IWineD3DDevice *iface, DWORD Coun
 
     ENTER_GL();
 
-    if(pRects) {
-        glEnable(GL_SCISSOR_TEST);
-        checkGLcall("glEnable GL_SCISSOR_TEST");
-        IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SCISSORRECT);
-    } else {
-        glDisable(GL_SCISSOR_TEST);
-        checkGLcall("glEnable GL_SCISSOR_TEST");
-    }
+    glEnable(GL_SCISSOR_TEST);
+    checkGLcall("glEnable GL_SCISSOR_TEST");
+    IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SCISSORRECT);
     IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(WINED3DRS_SCISSORTESTENABLE));
 
     if (Count > 0 && pRects) {
@@ -4184,6 +4179,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Clear(IWineD3DDevice *iface, DWORD Coun
     }
 
     if (!curRect) {
+        glScissor(This->stateBlock->viewport.X,
+                  (((IWineD3DSurfaceImpl *)This->render_targets[0])->currentDesc.Height -
+                  (This->stateBlock->viewport.Y + This->stateBlock->viewport.Height)),
+                   This->stateBlock->viewport.Width,
+                   This->stateBlock->viewport.Height);
+        checkGLcall("glScissor");
         glClear(glMask);
         checkGLcall("glClear");
     } else {
-- 
1.4.4.3



More information about the wine-patches mailing list