Henri Verbeet : wined3d: Don't mark shader constants dirty when we' re recording a stateblock.
Alexandre Julliard
julliard at winehq.org
Thu Dec 18 08:08:39 CST 2008
Module: wine
Branch: master
Commit: a14dab49371330255fd18ababfea7830cd122df8
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a14dab49371330255fd18ababfea7830cd122df8
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Wed Dec 17 17:07:25 2008 +0100
wined3d: Don't mark shader constants dirty when we're recording a stateblock.
---
dlls/wined3d/device.c | 96 ++++++++++++++++++++++++++++++------------------
1 files changed, 60 insertions(+), 36 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 9342040..de95c92 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3496,7 +3496,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantB(
This->updateStateBlock->changed.vertexShaderConstantsB |= (1 << i);
}
- IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT);
+ if (!This->isRecordingState) IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT);
return WINED3D_OK;
}
@@ -3544,7 +3544,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantI(
This->updateStateBlock->changed.vertexShaderConstantsI |= (1 << i);
}
- IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT);
+ if (!This->isRecordingState) IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT);
return WINED3D_OK;
}
@@ -3591,19 +3591,28 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantF(
srcData[i*4], srcData[i*4+1], srcData[i*4+2], srcData[i*4+3]);
}
- for (i = start; i < count + start; ++i) {
- if (!This->updateStateBlock->changed.vertexShaderConstantsF[i]) {
- constants_entry *ptr = LIST_ENTRY(list_head(&This->updateStateBlock->set_vconstantsF), constants_entry, entry);
- if (!ptr || ptr->count >= sizeof(ptr->idx) / sizeof(*ptr->idx)) {
- ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(constants_entry));
- list_add_head(&This->updateStateBlock->set_vconstantsF, &ptr->entry);
+ if (!This->isRecordingState)
+ {
+ for (i = start; i < count + start; ++i)
+ {
+ if (!This->stateBlock->changed.vertexShaderConstantsF[i])
+ {
+ constants_entry *ptr = LIST_ENTRY(list_head(&This->stateBlock->set_vconstantsF),
+ constants_entry, entry);
+ if (!ptr || ptr->count >= sizeof(ptr->idx) / sizeof(*ptr->idx))
+ {
+ ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(constants_entry));
+ list_add_head(&This->stateBlock->set_vconstantsF, &ptr->entry);
+ }
+ ptr->idx[ptr->count++] = i;
}
- ptr->idx[ptr->count++] = i;
- This->updateStateBlock->changed.vertexShaderConstantsF[i] = TRUE;
}
+
+ IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT);
}
- IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT);
+ memset(This->updateStateBlock->changed.vertexShaderConstantsF + start, 1,
+ sizeof(*This->updateStateBlock->changed.vertexShaderConstantsF) * count);
return WINED3D_OK;
}
@@ -3631,14 +3640,17 @@ UINT count) {
srcData[i*4], srcData[i*4+1], srcData[i*4+2], srcData[i*4+3]);
}
- /* We don't want shader constant dirtification to be an O(contexts), so just dirtify the active
- * context. On a context switch the old context will be fully dirtified
- */
- 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+1);
+ if (!This->isRecordingState)
+ {
+ /* We don't want shader constant dirtification to be an O(contexts), so just dirtify the active
+ * context. On a context switch the old context will be fully dirtified */
+ 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+1);
+
+ IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT);
+ }
- IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT);
memset(This->updateStateBlock->changed.vertexShaderConstantsF + start, 1,
sizeof(*This->updateStateBlock->changed.vertexShaderConstantsF) * count);
@@ -3931,7 +3943,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantB(
This->updateStateBlock->changed.pixelShaderConstantsB |= (1 << i);
}
- IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT);
+ if (!This->isRecordingState) IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT);
return WINED3D_OK;
}
@@ -3979,7 +3991,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantI(
This->updateStateBlock->changed.pixelShaderConstantsI |= (1 << i);
}
- IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT);
+ if (!This->isRecordingState) IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT);
return WINED3D_OK;
}
@@ -4026,19 +4038,28 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantF(
srcData[i*4], srcData[i*4+1], srcData[i*4+2], srcData[i*4+3]);
}
- for (i = start; i < count + start; ++i) {
- if (!This->updateStateBlock->changed.pixelShaderConstantsF[i]) {
- constants_entry *ptr = LIST_ENTRY(list_head(&This->updateStateBlock->set_pconstantsF), constants_entry, entry);
- if (!ptr || ptr->count >= sizeof(ptr->idx) / sizeof(*ptr->idx)) {
- ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(constants_entry));
- list_add_head(&This->updateStateBlock->set_pconstantsF, &ptr->entry);
+ if (!This->isRecordingState)
+ {
+ for (i = start; i < count + start; ++i)
+ {
+ if (!This->stateBlock->changed.pixelShaderConstantsF[i])
+ {
+ constants_entry *ptr = LIST_ENTRY(list_head(&This->stateBlock->set_pconstantsF),
+ constants_entry, entry);
+ if (!ptr || ptr->count >= sizeof(ptr->idx) / sizeof(*ptr->idx))
+ {
+ ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(constants_entry));
+ list_add_head(&This->stateBlock->set_pconstantsF, &ptr->entry);
+ }
+ ptr->idx[ptr->count++] = i;
}
- ptr->idx[ptr->count++] = i;
- This->updateStateBlock->changed.pixelShaderConstantsF[i] = TRUE;
}
+
+ IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT);
}
- IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT);
+ memset(This->updateStateBlock->changed.pixelShaderConstantsF + start, 1,
+ sizeof(*This->updateStateBlock->changed.pixelShaderConstantsF) * count);
return WINED3D_OK;
}
@@ -4066,14 +4087,17 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantF_DirtyConst(
srcData[i*4], srcData[i*4+1], srcData[i*4+2], srcData[i*4+3]);
}
- /* We don't want shader constant dirtification to be an O(contexts), so just dirtify the active
- * context. On a context switch the old context will be fully dirtified
- */
- 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+1);
+ if (!This->isRecordingState)
+ {
+ /* We don't want shader constant dirtification to be an O(contexts), so just dirtify the active
+ * context. On a context switch the old context will be fully dirtified */
+ 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+1);
+
+ IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT);
+ }
- IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT);
memset(This->updateStateBlock->changed.pixelShaderConstantsF + start, 1,
sizeof(*This->updateStateBlock->changed.pixelShaderConstantsF) * count);
More information about the wine-cvs
mailing list