diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index ed3ab72c20e..22835b1f165 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 12c5fbacec9..1fcc8b8631a 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 33b723aeee3..69aa320d727 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 ca792620d5c..36c1f17e291 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 */