[PATCH] WineD3D: Restore the fragment replacement prog after =

Stefan Doesinger stefan at codeweavers.com
Sat Nov 1 20:11:41 CDT 2008


depth_blt=0A=
=0A=
The current code properly enabled/disabled=0A=
GL_ARB_fragment_program after a depth blit, but it did not=0A=
restore the bound fragment program properly. This lead to=0A=
problems if a depth blit was done between two draws without any=0A=
change of the fragment processing settings=0A=
---=0A=
 dlls/wined3d/arb_program_shader.c |   28 ++++++++++++++--------------=0A=
 1 files changed, 14 insertions(+), 14 deletions(-)=0A=
=0A=
diff --git a/dlls/wined3d/arb_program_shader.c =
b/dlls/wined3d/arb_program_shader.c=0A=
index f5db127..6bfd858 100644=0A=
--- a/dlls/wined3d/arb_program_shader.c=0A=
+++ b/dlls/wined3d/arb_program_shader.c=0A=
@@ -1887,21 +1887,20 @@ static void shader_arb_select(IWineD3DDevice =
*iface, BOOL usePS, BOOL useVS) {=0A=
         GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, =
priv->current_fprogram_id));=0A=
         checkGLcall("glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, =
pixelShader->prgId);");=0A=
 =0A=
-        /* Enable OpenGL fragment programs */=0A=
-        glEnable(GL_FRAGMENT_PROGRAM_ARB);=0A=
-        checkGLcall("glEnable(GL_FRAGMENT_PROGRAM_ARB);");=0A=
+        if(!priv->use_arbfp_fixed_func) {=0A=
+            /* Enable OpenGL fragment programs */=0A=
+            glEnable(GL_FRAGMENT_PROGRAM_ARB);=0A=
+            checkGLcall("glEnable(GL_FRAGMENT_PROGRAM_ARB);");=0A=
+        }=0A=
         TRACE("(%p) : Bound fragment program %u and enabled =
GL_FRAGMENT_PROGRAM_ARB\n", This, priv->current_fprogram_id);=0A=
-    } else {=0A=
+    } else if(GL_SUPPORT(ARB_FRAGMENT_PROGRAM) && =
!priv->use_arbfp_fixed_func) {=0A=
+        /* Disable only if we're not using arbfp fixed function =
fragment processing. If this is used,=0A=
+         * keep GL_FRAGMENT_PROGRAM_ARB enabled, and the fixed function =
pipeline will bind the fixed function=0A=
+         * replacement shader=0A=
+         */=0A=
+        glDisable(GL_FRAGMENT_PROGRAM_ARB);=0A=
+        checkGLcall("glDisable(GL_FRAGMENT_PROGRAM_ARB)");=0A=
         priv->current_fprogram_id =3D 0;=0A=
-=0A=
-        if(GL_SUPPORT(ARB_FRAGMENT_PROGRAM) && =
!priv->use_arbfp_fixed_func) {=0A=
-            /* Disable only if we're not using arbfp fixed function =
fragment processing. If this is used,=0A=
-             * keep GL_FRAGMENT_PROGRAM_ARB enabled, and the fixed =
function pipeline will bind the fixed function=0A=
-             * replacement shader=0A=
-             */=0A=
-            glDisable(GL_FRAGMENT_PROGRAM_ARB);=0A=
-            checkGLcall("glDisable(GL_FRAGMENT_PROGRAM_ARB)");=0A=
-        }=0A=
     }=0A=
 }=0A=
 =0A=
@@ -1948,7 +1947,7 @@ static void =
shader_arb_deselect_depth_blt(IWineD3DDevice *iface) {=0A=
         checkGLcall("glEnable(GL_FRAGMENT_PROGRAM_ARB);");=0A=
 =0A=
         TRACE("(%p) : Bound fragment program %u and enabled =
GL_FRAGMENT_PROGRAM_ARB\n", This, priv->current_fprogram_id);=0A=
-    } else if(!priv->use_arbfp_fixed_func) {=0A=
+    } else {=0A=
         glDisable(GL_FRAGMENT_PROGRAM_ARB);=0A=
         checkGLcall("glDisable(GL_FRAGMENT_PROGRAM_ARB)");=0A=
     }=0A=
@@ -3089,6 +3088,7 @@ static void fragment_prog_arbfp(DWORD state, =
IWineD3DStateBlockImpl *stateblock,=0A=
          */=0A=
         GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, =
desc->shader));=0A=
         checkGLcall("glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, =
desc->shader)");=0A=
+        priv->current_fprogram_id =3D desc->shader;=0A=
 =0A=
         if(device->shader_backend =3D=3D &arb_program_shader_backend && =
context->last_was_pshader) {=0A=
             /* Reload fixed function constants since they collide with =
the pixel shader constants */=0A=
-- =0A=
1.5.6.4=0A=
=0A=

------=_NextPart_000_0007_01C93C7C.07D3C4A0--




More information about the wine-patches mailing list