From 270f57e755fd9713a22e98247769ef138dfecb1d Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Wed, 12 Aug 2009 09:44:23 +0200 Subject: [PATCH] wined3d: Make the "address" shader_reg_maps member a bitmap. --- dlls/wined3d/arb_program_shader.c | 6 +++--- dlls/wined3d/baseshader.c | 2 +- dlls/wined3d/glsl_shader.c | 6 +++--- dlls/wined3d/wined3d_private.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index ed3ab72c20..22835b1f16 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -664,9 +664,9 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s if (map & 1) shader_addline(buffer, "TEMP R%u;\n", i); } - for (i = 0; i < This->baseShader.limits.address; i++) { - if (reg_maps->address[i]) - shader_addline(buffer, "ADDRESS A%d;\n", i); + for (i = 0, map = reg_maps->address; map; map >>= 1, ++i) + { + if (map & 1) shader_addline(buffer, "ADDRESS A%u;\n", i); } if (pshader && reg_maps->shader_version.major == 1 && reg_maps->shader_version.minor <= 3) diff --git a/dlls/wined3d/baseshader.c b/dlls/wined3d/baseshader.c index 12c5fbacec..1fcc8b8631 100644 --- a/dlls/wined3d/baseshader.c +++ b/dlls/wined3d/baseshader.c @@ -258,7 +258,7 @@ static void shader_record_register_usage(IWineD3DBaseShaderImpl *This, struct sh { case WINED3DSPR_TEXTURE: /* WINED3DSPR_ADDR */ if (shader_type == WINED3D_SHADER_TYPE_PIXEL) reg_maps->texcoord |= 1 << reg->idx; - else reg_maps->address[reg->idx] = 1; + else reg_maps->address |= 1 << reg->idx; break; case WINED3DSPR_TEMP: diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 33b723aeee..69aa320d72 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -1004,9 +1004,9 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont } /* Declare address variables */ - for (i = 0; i < This->baseShader.limits.address; i++) { - if (reg_maps->address[i]) - shader_addline(buffer, "ivec4 A%d;\n", i); + for (i = 0, map = reg_maps->address; map; map >>= 1, ++i) + { + if (map & 1) shader_addline(buffer, "ivec4 A%u;\n", i); } /* Declare texture coordinate temporaries and initialize them */ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index ca792620d5..36c1f17e29 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -629,8 +629,8 @@ typedef struct shader_reg_maps { struct wined3d_shader_version shader_version; BYTE texcoord; /* MAX_REG_TEXCRD, 8 */ + BYTE address; /* MAX_REG_ADDR, 1 */ DWORD temporary; /* MAX_REG_TEMP, 32 */ - char address[MAX_REG_ADDR]; /* vertex */ char labels[MAX_LABELS]; /* pixel, vertex */ DWORD *constf; /* pixel, vertex */ DWORD texcoord_mask[MAX_REG_TEXCRD]; /* vertex < 3.0 */