Henri Verbeet : wined3d: Convert some BOOLs to bitfields in struct WineD3DContext.

Alexandre Julliard julliard at winehq.org
Wed Dec 31 07:45:00 CST 2008


Module: wine
Branch: master
Commit: 3f12f59aa42394778420c3838c928c2bc079b461
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3f12f59aa42394778420c3838c928c2bc079b461

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Dec 30 14:56:49 2008 +0100

wined3d: Convert some BOOLs to bitfields in struct WineD3DContext.

Also happens to fill two 3 byte holes.

---

 dlls/wined3d/state.c           |    9 ++++++---
 dlls/wined3d/wined3d_private.h |   29 ++++++++++++++++-------------
 2 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index c141fbd..746f636 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -3068,7 +3068,8 @@ static void transform_texture(DWORD state, IWineD3DStateBlockImpl *stateblock, W
                         stateblock->wineD3DDevice->frag_pipe->ffp_proj_control);
 
     /* The sampler applying function calls us if this changes */
-    if(context->lastWasPow2Texture[texUnit] && stateblock->textures[texUnit]) {
+    if ((context->lastWasPow2Texture & (1 << texUnit)) && stateblock->textures[texUnit])
+    {
         if(generated) {
             FIXME("Non-power2 texture being used with generated texture coords\n");
         }
@@ -3358,8 +3359,10 @@ static void sampler_texmatrix(DWORD state, IWineD3DStateBlockImpl *stateblock, W
             }
         }
 
-        if(texIsPow2 || context->lastWasPow2Texture[sampler]) {
-            context->lastWasPow2Texture[sampler] = texIsPow2;
+        if (texIsPow2 || (context->lastWasPow2Texture & (1 << sampler)))
+        {
+            if (texIsPow2) context->lastWasPow2Texture |= 1 << sampler;
+            else context->lastWasPow2Texture &= ~(1 << sampler);
             transform_texture(STATE_TEXTURESTAGE(stateblock->wineD3DDevice->texUnitMap[sampler], WINED3DTSS_TEXTURETRANSFORMFLAGS), stateblock, context);
         }
     }
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 7d79867..8759dd9 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -801,21 +801,26 @@ struct WineD3DContext {
     DWORD                   tid;    /* Thread ID which owns this context at the moment */
 
     /* Stores some information about the context state for optimization */
-    BOOL                    draw_buffer_dirty;
-    BOOL                    last_was_rhw;      /* true iff last draw_primitive was in xyzrhw mode */
-    BOOL                    last_was_pshader;
-    BOOL                    last_was_vshader;
-    BOOL                    last_was_foggy_shader;
-    BOOL                    namedArraysLoaded, numberedArraysLoaded;
+    WORD draw_buffer_dirty : 1;
+    WORD last_was_rhw : 1;              /* true iff last draw_primitive was in xyzrhw mode */
+    WORD last_was_pshader : 1;
+    WORD last_was_vshader : 1;
+    WORD last_was_foggy_shader : 1;
+    WORD namedArraysLoaded : 1;
+    WORD numberedArraysLoaded : 1;
+    WORD last_was_blit : 1;
+    WORD last_was_ckey : 1;
+    WORD fog_coord : 1;
+    WORD isPBuffer : 1;
+    WORD fog_enabled : 1;
+    WORD num_untracked_materials : 2;   /* Max value 2 */
+    WORD padding : 2;
+    BYTE texShaderBumpMap;              /* MAX_TEXTURES, 8 */
+    BYTE lastWasPow2Texture;            /* MAX_TEXTURES, 8 */
     DWORD                   numbered_array_mask;
-    BOOL                    lastWasPow2Texture[MAX_TEXTURES];
     GLenum                  tracking_parm;     /* Which source is tracking current colour         */
-    unsigned char           num_untracked_materials;
     GLenum                  untracked_materials[2];
-    BOOL                    last_was_blit, last_was_ckey;
     UINT                    blit_w, blit_h;
-    char                    texShaderBumpMap;
-    BOOL                    fog_coord;
 
     char                    *vshader_const_dirty, *pshader_const_dirty;
 
@@ -824,7 +829,6 @@ struct WineD3DContext {
     HWND                    win_handle;
     HDC                     hdc;
     HPBUFFERARB             pbuffer;
-    BOOL                    isPBuffer;
     GLint                   aux_buffers;
 
     /* FBOs */
@@ -834,7 +838,6 @@ struct WineD3DContext {
     GLuint                  dst_fbo;
 
     /* Extension emulation */
-    BOOL                    fog_enabled;
     GLint                   gl_fog_source;
     GLfloat                 fog_coord_value;
     GLfloat                 color[4], fogstart, fogend, fogcolor[4];




More information about the wine-cvs mailing list