Module: wine Branch: master Commit: 2650885cc8727714a0bb9ccc3c8f25e3a188351d URL: http://source.winehq.org/git/wine.git/?a=commit;h=2650885cc8727714a0bb9ccc3c...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Tue Dec 29 17:10:22 2009 +0100
wined3d: Use the element size to create "isStateDirty" bitmap indices.
---
dlls/wined3d/context.c | 8 ++++---- dlls/wined3d/device.c | 4 ++-- dlls/wined3d/wined3d_private.h | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index c3c90ea..2aec7d6 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -898,8 +898,8 @@ static void Context_MarkStateDirty(struct wined3d_context *context, DWORD state, if (isStateDirty(context, rep)) return;
context->dirtyArray[context->numDirtyEntries++] = rep; - idx = rep >> 5; - shift = rep & 0x1f; + idx = rep / (sizeof(*context->isStateDirty) * CHAR_BIT); + shift = rep & ((sizeof(*context->isStateDirty) * CHAR_BIT) - 1); context->isStateDirty[idx] |= (1 << shift); }
@@ -2194,8 +2194,8 @@ static void context_apply_state(struct wined3d_context *context, IWineD3DDeviceI for (i = 0; i < context->numDirtyEntries; ++i) { DWORD rep = context->dirtyArray[i]; - DWORD idx = rep >> 5; - BYTE shift = rep & 0x1f; + DWORD idx = rep / (sizeof(*context->isStateDirty) * CHAR_BIT); + BYTE shift = rep & ((sizeof(*context->isStateDirty) * CHAR_BIT) - 1); context->isStateDirty[idx] &= ~(1 << shift); state_table[rep].apply(rep, device->stateBlock, context); } diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 5b1ca8c..d0660b4 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -7015,8 +7015,8 @@ void IWineD3DDeviceImpl_MarkStateDirty(IWineD3DDeviceImpl *This, DWORD state) { if(isStateDirty(context, rep)) continue;
context->dirtyArray[context->numDirtyEntries++] = rep; - idx = rep >> 5; - shift = rep & 0x1f; + idx = rep / (sizeof(*context->isStateDirty) * CHAR_BIT); + shift = rep & ((sizeof(*context->isStateDirty) * CHAR_BIT) - 1); context->isStateDirty[idx] |= (1 << shift); } } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index b0c2804..b22a7b2 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1028,7 +1028,7 @@ struct wined3d_context */ DWORD dirtyArray[STATE_HIGHEST + 1]; /* Won't get bigger than that, a state is never marked dirty 2 times */ DWORD numDirtyEntries; - DWORD isStateDirty[STATE_HIGHEST/32 + 1]; /* Bitmap to find out quickly if a state is dirty */ + DWORD isStateDirty[STATE_HIGHEST / (sizeof(DWORD) * CHAR_BIT) + 1]; /* Bitmap to find out quickly if a state is dirty */
IWineD3DSurface *surface; IWineD3DSurface *current_rt; @@ -1614,8 +1614,8 @@ void IWineD3DDeviceImpl_MarkStateDirty(IWineD3DDeviceImpl *This, DWORD state) DE
static inline BOOL isStateDirty(struct wined3d_context *context, DWORD state) { - DWORD idx = state >> 5; - BYTE shift = state & 0x1f; + DWORD idx = state / (sizeof(*context->isStateDirty) * CHAR_BIT); + BYTE shift = state & ((sizeof(*context->isStateDirty) * CHAR_BIT) - 1); return context->isStateDirty[idx] & (1 << shift); }