Henri Verbeet : wined3d: Convert clipplane to a bitmap in struct SAVEDSTATES.
Alexandre Julliard
julliard at winehq.org
Fri Jan 2 08:25:38 CST 2009
Module: wine
Branch: master
Commit: 3b5c75d99175976b341336a028d75b5febf25869
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3b5c75d99175976b341336a028d75b5febf25869
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Wed Dec 31 16:57:11 2008 +0100
wined3d: Convert clipplane to a bitmap in struct SAVEDSTATES.
---
dlls/wined3d/device.c | 2 +-
dlls/wined3d/stateblock.c | 38 +++++++++++++++++++++-----------------
dlls/wined3d/wined3d_private.h | 2 +-
3 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index c0f0ff6..a0b6d1f 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3038,7 +3038,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetClipPlane(IWineD3DDevice *iface, DWO
return WINED3DERR_INVALIDCALL;
}
- This->updateStateBlock->changed.clipplane[Index] = TRUE;
+ This->updateStateBlock->changed.clipplane |= 1 << Index;
if(This->updateStateBlock->clipplane[Index][0] == pPlane[0] &&
This->updateStateBlock->clipplane[Index][1] == pPlane[1] &&
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index c07da78..2923d50 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -93,7 +93,7 @@ static void stateblock_savedstates_copy(IWineD3DStateBlock* iface, SAVEDSTATES *
memcpy(dest->renderState, source->renderState, bsize * (WINEHIGHEST_RENDER_STATE + 1));
memcpy(dest->textureState, source->textureState, bsize * MAX_TEXTURES * (WINED3D_HIGHEST_TEXTURE_STATE + 1));
memcpy(dest->samplerState, source->samplerState, bsize * MAX_COMBINED_SAMPLERS * (WINED3D_HIGHEST_SAMPLER_STATE + 1));
- memcpy(dest->clipplane, source->clipplane, bsize * MAX_CLIPPLANES);
+ dest->clipplane = source->clipplane;
dest->pixelShaderConstantsB = source->pixelShaderConstantsB;
dest->pixelShaderConstantsI = source->pixelShaderConstantsI;
dest->vertexShaderConstantsB = source->vertexShaderConstantsB;
@@ -130,7 +130,7 @@ void stateblock_savedstates_set(
memset(states->renderState, value, bsize * (WINEHIGHEST_RENDER_STATE + 1));
memset(states->textureState, value, bsize * MAX_TEXTURES * (WINED3D_HIGHEST_TEXTURE_STATE + 1));
memset(states->samplerState, value, bsize * MAX_COMBINED_SAMPLERS * (WINED3D_HIGHEST_SAMPLER_STATE + 1));
- memset(states->clipplane, value, bsize * MAX_CLIPPLANES);
+ states->clipplane = value ? 0xffffffff : 0;
states->pixelShaderConstantsB = value ? 0xffff : 0;
states->pixelShaderConstantsI = value ? 0xffff : 0;
states->vertexShaderConstantsB = value ? 0xffff : 0;
@@ -372,7 +372,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface;
IWineD3DStateBlockImpl *targetStateBlock = This->wineD3DDevice->stateBlock;
unsigned int i, j;
- WORD map;
+ DWORD map;
TRACE("(%p) : Updating state block %p ------------------v\n", targetStateBlock, This);
@@ -543,9 +543,12 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
}
}
- for (i = 0; i < GL_LIMITS(clipplanes); i++) {
- if (This->changed.clipplane[i]
- && memcmp(targetStateBlock->clipplane[i], This->clipplane[i], sizeof(*This->clipplane)))
+ map = This->changed.clipplane;
+ for (i = 0; map; map >>= 1, ++i)
+ {
+ if (!(map & 1)) continue;
+
+ if (memcmp(targetStateBlock->clipplane[i], This->clipplane[i], sizeof(*This->clipplane)))
{
TRACE("Updating clipplane %u\n", i);
memcpy(This->clipplane[i], targetStateBlock->clipplane[i], sizeof(*This->clipplane));
@@ -725,7 +728,7 @@ should really perform a delta so that only the changes get updated*/
UINT i;
UINT j;
- WORD map;
+ DWORD map;
TRACE("(%p) : Applying state block %p ------------------v\n", This, pDevice);
@@ -839,18 +842,19 @@ should really perform a delta so that only the changes get updated*/
}
}
- for (i = 0; i < GL_LIMITS(clipplanes); i++) {
- if (This->changed.clipplane[i]) {
- float clip[4];
-
- clip[0] = This->clipplane[i][0];
- clip[1] = This->clipplane[i][1];
- clip[2] = This->clipplane[i][2];
- clip[3] = This->clipplane[i][3];
- IWineD3DDevice_SetClipPlane(pDevice, i, clip);
- }
- }
+ map = This->changed.clipplane;
+ for (i = 0; map; map >>= 1, ++i)
+ {
+ float clip[4];
+
+ if (!(map & 1)) continue;
+ clip[0] = This->clipplane[i][0];
+ clip[1] = This->clipplane[i][1];
+ clip[2] = This->clipplane[i][2];
+ clip[3] = This->clipplane[i][3];
+ IWineD3DDevice_SetClipPlane(pDevice, i, clip);
+ }
} else if(This->blockType == WINED3DSBT_VERTEXSTATE) {
IWineD3DDevice_SetVertexShader(pDevice, This->vertexShader);
for (i = 0; i < GL_LIMITS(vshader_constantsF); i++) {
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 19ff8f8..010f097 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1765,7 +1765,7 @@ typedef struct SAVEDSTATES {
BOOL renderState[WINEHIGHEST_RENDER_STATE + 1];
BOOL textureState[MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1];
BOOL samplerState[MAX_COMBINED_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1];
- BOOL clipplane[MAX_CLIPPLANES];
+ DWORD clipplane; /* WINED3DMAXUSERCLIPPLANES, 32 */
WORD pixelShaderConstantsB; /* MAX_CONST_B, 16 */
WORD pixelShaderConstantsI; /* MAX_CONST_I, 16 */
BOOL *pixelShaderConstantsF;
More information about the wine-cvs
mailing list