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.
This commit is contained in:
Stefan Dösinger 2008-07-06 11:51:26 -05:00 committed by Alexandre Julliard
parent 5bd57c5992
commit 9be8f36c2e
2 changed files with 3 additions and 3 deletions

View File

@ -134,7 +134,7 @@ static unsigned int shader_arb_load_constantsF(IWineD3DBaseShaderImpl* This, Win
ret = 0; ret = 0;
LIST_FOR_EACH_ENTRY(lconst, &This->baseShader.constantsF, local_constant, entry) { 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 */ 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)); GL_EXTCALL(glProgramEnvParameter4fvARB(target_type, lconst->idx, (GLfloat*)lconst->value));
} }
checkGLcall("glProgramEnvParameter4fvARB()"); checkGLcall("glProgramEnvParameter4fvARB()");

View File

@ -3602,7 +3602,7 @@ UINT count) {
*/ */
memset(This->activeContext->vshader_const_dirty + start, 1, memset(This->activeContext->vshader_const_dirty + start, 1,
sizeof(*This->activeContext->vshader_const_dirty) * count); 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); IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT);
@ -4030,7 +4030,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantF_DirtyConst(
*/ */
memset(This->activeContext->pshader_const_dirty + start, 1, memset(This->activeContext->pshader_const_dirty + start, 1,
sizeof(*This->activeContext->pshader_const_dirty) * count); 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); IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT);