diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index b9059360948..06698f59d62 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3638,6 +3638,7 @@ static void device_map_stage(IWineD3DDeviceImpl *This, int stage, int unit) { static void device_update_fixed_function_usage_map(IWineD3DDeviceImpl *This) { int i; + This->fixed_function_usage_map = 0; for (i = 0; i < MAX_TEXTURES; ++i) { WINED3DTEXTUREOP color_op = This->stateBlock->textureState[i][WINED3DTSS_COLOROP]; WINED3DTEXTUREOP alpha_op = This->stateBlock->textureState[i][WINED3DTSS_ALPHAOP]; @@ -3650,10 +3651,6 @@ static void device_update_fixed_function_usage_map(IWineD3DDeviceImpl *This) { if (color_op == WINED3DTOP_DISABLE) { /* Not used, and disable higher stages */ - while (i < MAX_TEXTURES) { - This->fixed_function_usage_map[i] = FALSE; - ++i; - } break; } @@ -3663,13 +3660,11 @@ static void device_update_fixed_function_usage_map(IWineD3DDeviceImpl *This) { || ((alpha_arg1 == WINED3DTA_TEXTURE) && alpha_op != WINED3DTOP_SELECTARG2) || ((alpha_arg2 == WINED3DTA_TEXTURE) && alpha_op != WINED3DTOP_SELECTARG1) || ((alpha_arg3 == WINED3DTA_TEXTURE) && (alpha_op == WINED3DTOP_MULTIPLYADD || alpha_op == WINED3DTOP_LERP))) { - This->fixed_function_usage_map[i] = TRUE; - } else { - This->fixed_function_usage_map[i] = FALSE; + This->fixed_function_usage_map |= (1 << i); } if ((color_op == WINED3DTOP_BUMPENVMAP || color_op == WINED3DTOP_BUMPENVMAPLUMINANCE) && i < MAX_TEXTURES - 1) { - This->fixed_function_usage_map[i+1] = TRUE; + This->fixed_function_usage_map |= (1 << (i + 1)); } } } @@ -3682,7 +3677,7 @@ static void device_map_fixed_function_samplers(IWineD3DDeviceImpl *This) { if (This->max_ffp_textures == This->max_ffp_texture_stages || This->stateBlock->lowest_disabled_stage <= This->max_ffp_textures) { for (i = 0; i < This->stateBlock->lowest_disabled_stage; ++i) { - if (!This->fixed_function_usage_map[i]) continue; + if (!(This->fixed_function_usage_map & (1 << i))) continue; if (This->texUnitMap[i] != i) { device_map_stage(This, i, i); @@ -3696,7 +3691,7 @@ static void device_map_fixed_function_samplers(IWineD3DDeviceImpl *This) { /* Now work out the mapping */ tex = 0; for (i = 0; i < This->stateBlock->lowest_disabled_stage; ++i) { - if (!This->fixed_function_usage_map[i]) continue; + if (!(This->fixed_function_usage_map & (1 << i))) continue; if (This->texUnitMap[i] != tex) { device_map_stage(This, i, tex); @@ -3739,7 +3734,7 @@ static BOOL device_unit_free_for_vs(IWineD3DDeviceImpl *This, const DWORD *pshad if (!pshader_sampler_tokens) { /* No pixel shader, check fixed function */ - return current_mapping >= MAX_TEXTURES || !This->fixed_function_usage_map[current_mapping]; + return current_mapping >= MAX_TEXTURES || !(This->fixed_function_usage_map & (1 << current_mapping)); } /* Pixel shader, check the shader's sampler map */ diff --git a/dlls/wined3d/nvidia_texture_shader.c b/dlls/wined3d/nvidia_texture_shader.c index 2c58459d50c..a4677dcbcb9 100644 --- a/dlls/wined3d/nvidia_texture_shader.c +++ b/dlls/wined3d/nvidia_texture_shader.c @@ -453,7 +453,7 @@ void set_tex_op_nvrc(IWineD3DDevice *iface, BOOL is_alpha, int stage, WINED3DTEX static void nvrc_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) { DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE; DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[stage]; - BOOL tex_used = stateblock->wineD3DDevice->fixed_function_usage_map[stage]; + BOOL tex_used = stateblock->wineD3DDevice->fixed_function_usage_map & (1 << stage); TRACE("Setting color op for stage %d\n", stage); diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 746f6364e6a..928a4bbbaaa 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -2883,7 +2883,7 @@ static void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, WINED3DTE static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) { DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE; DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[stage]; - BOOL tex_used = stateblock->wineD3DDevice->fixed_function_usage_map[stage]; + BOOL tex_used = stateblock->wineD3DDevice->fixed_function_usage_map & (1 << stage); TRACE("Setting color op for stage %d\n", stage); @@ -2939,7 +2939,7 @@ static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D void tex_alphaop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) { DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE; DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[stage]; - BOOL tex_used = stateblock->wineD3DDevice->fixed_function_usage_map[stage]; + BOOL tex_used = stateblock->wineD3DDevice->fixed_function_usage_map & (1 << stage); DWORD op, arg1, arg2, arg0; TRACE("Setting alpha op for stage %d\n", stage); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 8759dd9caf6..ab2c68f93be 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1065,19 +1065,30 @@ struct IWineD3DDeviceImpl unsigned int max_ffp_textures, max_ffp_texture_stages; - /* To store */ - BOOL view_ident; /* true iff view matrix is identity */ - BOOL untransformed; - BOOL vertexBlendUsed; /* To avoid needless setting of the blend matrices */ + WORD view_ident : 1; /* true iff view matrix is identity */ + WORD untransformed : 1; + WORD vertexBlendUsed : 1; /* To avoid needless setting of the blend matrices */ + WORD isRecordingState : 1; + WORD isInDraw : 1; + WORD render_offscreen : 1; + WORD bCursorVisible : 1; + WORD haveHardwareCursor : 1; + WORD d3d_initialized : 1; + WORD inScene : 1; /* A flag to check for proper BeginScene / EndScene call pairs */ + WORD softwareVertexProcessing : 1; /* process vertex shaders using software or hardware */ + WORD useDrawStridedSlow : 1; + WORD instancedDraw : 1; + WORD padding : 3; + + BYTE fixed_function_usage_map; /* MAX_TEXTURES, 8 */ + #define DDRAW_PITCH_ALIGNMENT 8 #define D3D8_PITCH_ALIGNMENT 4 unsigned char surface_alignment; /* Line Alignment of surfaces */ /* State block related */ - BOOL isRecordingState; IWineD3DStateBlockImpl *stateBlock; IWineD3DStateBlockImpl *updateStateBlock; - BOOL isInDraw; /* Internal use fields */ WINED3DDEVICE_CREATION_PARAMETERS createParms; @@ -1107,7 +1118,6 @@ struct IWineD3DDeviceImpl UINT paletteConversionShader; /* For rendering to a texture using glCopyTexImage */ - BOOL render_offscreen; GLenum *draw_buffers; GLuint depth_blt_texture; GLuint depth_blt_rb; @@ -1115,14 +1125,12 @@ struct IWineD3DDeviceImpl UINT depth_blt_rb_h; /* Cursor management */ - BOOL bCursorVisible; UINT xHotSpot; UINT yHotSpot; UINT xScreenSpace; UINT yScreenSpace; UINT cursorWidth, cursorHeight; GLuint cursorTexture; - BOOL haveHardwareCursor; HCURSOR hardwareCursor; /* The Wine logo surface */ @@ -1133,13 +1141,6 @@ struct IWineD3DDeviceImpl /* Device state management */ HRESULT state; - BOOL d3d_initialized; - - /* A flag to check for proper BeginScene / EndScene call pairs */ - BOOL inScene; - - /* process vertex shaders using software or hardware */ - BOOL softwareVertexProcessing; /* DirectDraw stuff */ DWORD ddraw_width, ddraw_height; @@ -1151,13 +1152,10 @@ struct IWineD3DDeviceImpl /* With register combiners we can skip junk texture stages */ DWORD texUnitMap[MAX_COMBINED_SAMPLERS]; DWORD rev_tex_unit_map[MAX_COMBINED_SAMPLERS]; - BOOL fixed_function_usage_map[MAX_TEXTURES]; /* Stream source management */ WineDirect3DVertexStridedData strided_streams; const WineDirect3DVertexStridedData *up_strided; - BOOL useDrawStridedSlow; - BOOL instancedDraw; /* Context management */ WineD3DContext **contexts; /* Dynamic array containing pointers to context structures */