wined3d: Convert some BOOLs to bitfields in struct IWineD3DDeviceImpl.

Also fills a 3 byte hole.
This commit is contained in:
Henri Verbeet 2008-12-30 14:56:49 +01:00 committed by Alexandre Julliard
parent 3f12f59aa4
commit 29a0d06518
4 changed files with 26 additions and 33 deletions

View File

@ -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) { static void device_update_fixed_function_usage_map(IWineD3DDeviceImpl *This) {
int i; int i;
This->fixed_function_usage_map = 0;
for (i = 0; i < MAX_TEXTURES; ++i) { for (i = 0; i < MAX_TEXTURES; ++i) {
WINED3DTEXTUREOP color_op = This->stateBlock->textureState[i][WINED3DTSS_COLOROP]; WINED3DTEXTUREOP color_op = This->stateBlock->textureState[i][WINED3DTSS_COLOROP];
WINED3DTEXTUREOP alpha_op = This->stateBlock->textureState[i][WINED3DTSS_ALPHAOP]; 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) { if (color_op == WINED3DTOP_DISABLE) {
/* Not used, and disable higher stages */ /* Not used, and disable higher stages */
while (i < MAX_TEXTURES) {
This->fixed_function_usage_map[i] = FALSE;
++i;
}
break; break;
} }
@ -3663,13 +3660,11 @@ static void device_update_fixed_function_usage_map(IWineD3DDeviceImpl *This) {
|| ((alpha_arg1 == WINED3DTA_TEXTURE) && alpha_op != WINED3DTOP_SELECTARG2) || ((alpha_arg1 == WINED3DTA_TEXTURE) && alpha_op != WINED3DTOP_SELECTARG2)
|| ((alpha_arg2 == WINED3DTA_TEXTURE) && alpha_op != WINED3DTOP_SELECTARG1) || ((alpha_arg2 == WINED3DTA_TEXTURE) && alpha_op != WINED3DTOP_SELECTARG1)
|| ((alpha_arg3 == WINED3DTA_TEXTURE) && (alpha_op == WINED3DTOP_MULTIPLYADD || alpha_op == WINED3DTOP_LERP))) { || ((alpha_arg3 == WINED3DTA_TEXTURE) && (alpha_op == WINED3DTOP_MULTIPLYADD || alpha_op == WINED3DTOP_LERP))) {
This->fixed_function_usage_map[i] = TRUE; This->fixed_function_usage_map |= (1 << i);
} else {
This->fixed_function_usage_map[i] = FALSE;
} }
if ((color_op == WINED3DTOP_BUMPENVMAP || color_op == WINED3DTOP_BUMPENVMAPLUMINANCE) && i < MAX_TEXTURES - 1) { 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 || if (This->max_ffp_textures == This->max_ffp_texture_stages ||
This->stateBlock->lowest_disabled_stage <= This->max_ffp_textures) { This->stateBlock->lowest_disabled_stage <= This->max_ffp_textures) {
for (i = 0; i < This->stateBlock->lowest_disabled_stage; ++i) { 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) { if (This->texUnitMap[i] != i) {
device_map_stage(This, 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 */ /* Now work out the mapping */
tex = 0; tex = 0;
for (i = 0; i < This->stateBlock->lowest_disabled_stage; ++i) { 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) { if (This->texUnitMap[i] != tex) {
device_map_stage(This, 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) { if (!pshader_sampler_tokens) {
/* No pixel shader, check fixed function */ /* 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 */ /* Pixel shader, check the shader's sampler map */

View File

@ -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) { static void nvrc_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE; DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[stage]; 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); TRACE("Setting color op for stage %d\n", stage);

View File

@ -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) { static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE; DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[stage]; 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); 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) { void tex_alphaop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE; DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[stage]; 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; DWORD op, arg1, arg2, arg0;
TRACE("Setting alpha op for stage %d\n", stage); TRACE("Setting alpha op for stage %d\n", stage);

View File

@ -1065,19 +1065,30 @@ struct IWineD3DDeviceImpl
unsigned int max_ffp_textures, max_ffp_texture_stages; unsigned int max_ffp_textures, max_ffp_texture_stages;
/* To store */ WORD view_ident : 1; /* true iff view matrix is identity */
BOOL view_ident; /* true iff view matrix is identity */ WORD untransformed : 1;
BOOL untransformed; WORD vertexBlendUsed : 1; /* To avoid needless setting of the blend matrices */
BOOL vertexBlendUsed; /* 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 DDRAW_PITCH_ALIGNMENT 8
#define D3D8_PITCH_ALIGNMENT 4 #define D3D8_PITCH_ALIGNMENT 4
unsigned char surface_alignment; /* Line Alignment of surfaces */ unsigned char surface_alignment; /* Line Alignment of surfaces */
/* State block related */ /* State block related */
BOOL isRecordingState;
IWineD3DStateBlockImpl *stateBlock; IWineD3DStateBlockImpl *stateBlock;
IWineD3DStateBlockImpl *updateStateBlock; IWineD3DStateBlockImpl *updateStateBlock;
BOOL isInDraw;
/* Internal use fields */ /* Internal use fields */
WINED3DDEVICE_CREATION_PARAMETERS createParms; WINED3DDEVICE_CREATION_PARAMETERS createParms;
@ -1107,7 +1118,6 @@ struct IWineD3DDeviceImpl
UINT paletteConversionShader; UINT paletteConversionShader;
/* For rendering to a texture using glCopyTexImage */ /* For rendering to a texture using glCopyTexImage */
BOOL render_offscreen;
GLenum *draw_buffers; GLenum *draw_buffers;
GLuint depth_blt_texture; GLuint depth_blt_texture;
GLuint depth_blt_rb; GLuint depth_blt_rb;
@ -1115,14 +1125,12 @@ struct IWineD3DDeviceImpl
UINT depth_blt_rb_h; UINT depth_blt_rb_h;
/* Cursor management */ /* Cursor management */
BOOL bCursorVisible;
UINT xHotSpot; UINT xHotSpot;
UINT yHotSpot; UINT yHotSpot;
UINT xScreenSpace; UINT xScreenSpace;
UINT yScreenSpace; UINT yScreenSpace;
UINT cursorWidth, cursorHeight; UINT cursorWidth, cursorHeight;
GLuint cursorTexture; GLuint cursorTexture;
BOOL haveHardwareCursor;
HCURSOR hardwareCursor; HCURSOR hardwareCursor;
/* The Wine logo surface */ /* The Wine logo surface */
@ -1133,13 +1141,6 @@ struct IWineD3DDeviceImpl
/* Device state management */ /* Device state management */
HRESULT state; 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 */ /* DirectDraw stuff */
DWORD ddraw_width, ddraw_height; DWORD ddraw_width, ddraw_height;
@ -1151,13 +1152,10 @@ struct IWineD3DDeviceImpl
/* With register combiners we can skip junk texture stages */ /* With register combiners we can skip junk texture stages */
DWORD texUnitMap[MAX_COMBINED_SAMPLERS]; DWORD texUnitMap[MAX_COMBINED_SAMPLERS];
DWORD rev_tex_unit_map[MAX_COMBINED_SAMPLERS]; DWORD rev_tex_unit_map[MAX_COMBINED_SAMPLERS];
BOOL fixed_function_usage_map[MAX_TEXTURES];
/* Stream source management */ /* Stream source management */
WineDirect3DVertexStridedData strided_streams; WineDirect3DVertexStridedData strided_streams;
const WineDirect3DVertexStridedData *up_strided; const WineDirect3DVertexStridedData *up_strided;
BOOL useDrawStridedSlow;
BOOL instancedDraw;
/* Context management */ /* Context management */
WineD3DContext **contexts; /* Dynamic array containing pointers to context structures */ WineD3DContext **contexts; /* Dynamic array containing pointers to context structures */