[PATCH] WineD3D: Correct an off-by-one error in constant =

Stefan Doesinger stefan at codeweavers.com
Sun Jul 6 11:51:26 CDT 2008


dirtification=0A=
=0A=
Constant numbers start at 0, and the loading loop has a for(i; i=0A=
< dirtyconsts; i++). This means that the highest dirty constant=0A=
isn't loaded correctly. Rather than replacing the < with <=3D,=0A=
which would make it impossible to have no dirty constant, add 1=0A=
to the dirty constant counter.=0A=
---=0A=
 dlls/wined3d/arb_program_shader.c |    2 +-=0A=
 dlls/wined3d/device.c             |    4 ++--=0A=
 2 files changed, 3 insertions(+), 3 deletions(-)=0A=
=0A=
diff --git a/dlls/wined3d/arb_program_shader.c =
b/dlls/wined3d/arb_program_shader.c=0A=
index 2bf9716..5b96309 100644=0A=
--- a/dlls/wined3d/arb_program_shader.c=0A=
+++ b/dlls/wined3d/arb_program_shader.c=0A=
@@ -134,7 +134,7 @@ static unsigned int =
shader_arb_load_constantsF(IWineD3DBaseShaderImpl* This, Win=0A=
         ret =3D 0;=0A=
         LIST_FOR_EACH_ENTRY(lconst, &This->baseShader.constantsF, =
local_constant, entry) {=0A=
             dirty_consts[lconst->idx] =3D 1; /* Dirtify so the =
non-immediate constant overwrites it next time */=0A=
-            ret =3D max(ret, lconst->idx);=0A=
+            ret =3D max(ret, lconst->idx + 1);=0A=
             GL_EXTCALL(glProgramEnvParameter4fvARB(target_type, =
lconst->idx, (GLfloat*)lconst->value));=0A=
         }=0A=
         checkGLcall("glProgramEnvParameter4fvARB()");=0A=
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c=0A=
index 6ab0abb..e45ae9f 100644=0A=
--- a/dlls/wined3d/device.c=0A=
+++ b/dlls/wined3d/device.c=0A=
@@ -3609,7 +3609,7 @@ UINT count) {=0A=
      */=0A=
     memset(This->activeContext->vshader_const_dirty + start, 1,=0A=
            sizeof(*This->activeContext->vshader_const_dirty) * count);=0A=
-    This->highest_dirty_vs_const =3D max(This->highest_dirty_vs_const, =
start+count);=0A=
+    This->highest_dirty_vs_const =3D max(This->highest_dirty_vs_const, =
start+count+1);=0A=
 =0A=
     IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT);=0A=
 =0A=
@@ -4037,7 +4037,7 @@ static HRESULT WINAPI =
IWineD3DDeviceImpl_SetPixelShaderConstantF_DirtyConst(=0A=
      */=0A=
     memset(This->activeContext->pshader_const_dirty + start, 1,=0A=
            sizeof(*This->activeContext->pshader_const_dirty) * count);=0A=
-    This->highest_dirty_ps_const =3D max(This->highest_dirty_ps_const, =
start+count);=0A=
+    This->highest_dirty_ps_const =3D max(This->highest_dirty_ps_const, =
start+count+1);=0A=
 =0A=
     IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT);=0A=
 =0A=
-- =0A=
1.5.4.5=0A=
=0A=

------=_NextPart_000_0007_01C8DF9D.15CEE800--




More information about the wine-patches mailing list