Module: wine Branch: master Commit: 9be8f36c2ec1dd3a1bb1d9b116ea11313da38e64 URL: http://source.winehq.org/git/wine.git/?a=commit;h=9be8f36c2ec1dd3a1bb1d9b116...
Author: Stefan Dösinger stefan@codeweavers.com Date: Sun Jul 6 11:51:26 2008 -0500
wined3d: Correct an off-by-one error in constant dirtification.
Constant numbers start at 0, and the loading loop has a for(i; i < dirtyconsts; i++). This means that the highest dirty constant isn't loaded correctly. Rather than replacing the < with <=, which would make it impossible to have no dirty constant, add 1 to the dirty constant counter.
---
dlls/wined3d/arb_program_shader.c | 2 +- dlls/wined3d/device.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index 84ec4fc..42b107a 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -134,7 +134,7 @@ static unsigned int shader_arb_load_constantsF(IWineD3DBaseShaderImpl* This, Win ret = 0; LIST_FOR_EACH_ENTRY(lconst, &This->baseShader.constantsF, local_constant, entry) { dirty_consts[lconst->idx] = 1; /* Dirtify so the non-immediate constant overwrites it next time */ - ret = max(ret, lconst->idx); + ret = max(ret, lconst->idx + 1); GL_EXTCALL(glProgramEnvParameter4fvARB(target_type, lconst->idx, (GLfloat*)lconst->value)); } checkGLcall("glProgramEnvParameter4fvARB()"); diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 7a0cce2..26c1c9c 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3602,7 +3602,7 @@ UINT count) { */ memset(This->activeContext->vshader_const_dirty + start, 1, sizeof(*This->activeContext->vshader_const_dirty) * count); - This->highest_dirty_vs_const = max(This->highest_dirty_vs_const, start+count); + This->highest_dirty_vs_const = max(This->highest_dirty_vs_const, start+count+1);
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT);
@@ -4030,7 +4030,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantF_DirtyConst( */ memset(This->activeContext->pshader_const_dirty + start, 1, sizeof(*This->activeContext->pshader_const_dirty) * count); - This->highest_dirty_ps_const = max(This->highest_dirty_ps_const, start+count); + This->highest_dirty_ps_const = max(This->highest_dirty_ps_const, start+count+1);
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT);