Commit 6fa9fa15 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Make the "temporary" shader_reg_maps member a bitmap.

parent 50853e29
...@@ -659,9 +659,9 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s ...@@ -659,9 +659,9 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s
} }
} }
for(i = 0; i < This->baseShader.limits.temporary; i++) { for (i = 0, map = reg_maps->temporary; map; map >>= 1, ++i)
if (reg_maps->temporary[i]) {
shader_addline(buffer, "TEMP R%u;\n", i); if (map & 1) shader_addline(buffer, "TEMP R%u;\n", i);
} }
for (i = 0; i < This->baseShader.limits.address; i++) { for (i = 0; i < This->baseShader.limits.address; i++) {
...@@ -3215,21 +3215,21 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShaderImpl *This, struct ...@@ -3215,21 +3215,21 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShaderImpl *This, struct
BOOL dcl_tmp = args->super.srgb_correction, dcl_td = FALSE; BOOL dcl_tmp = args->super.srgb_correction, dcl_td = FALSE;
BOOL want_nv_prog = FALSE; BOOL want_nv_prog = FALSE;
struct arb_pshader_private *shader_priv = This->backend_priv; struct arb_pshader_private *shader_priv = This->backend_priv;
DWORD map;
char srgbtmp[4][4]; char srgbtmp[4][4];
unsigned int i, found = 0; unsigned int i, found = 0;
for(i = 0; i < This->baseShader.limits.temporary; i++) { for (i = 0, map = reg_maps->temporary; map; map >>= 1, ++i)
{
/* Don't overwrite the color source */ if (!(map & 1)
if(This->color0_mov && i == This->color0_reg) continue; || (This->color0_mov && i == This->color0_reg)
else if(reg_maps->shader_version.major < 2 && i == 0) continue; || (reg_maps->shader_version.major < 2 && i == 0))
continue;
if(reg_maps->temporary[i]) {
sprintf(srgbtmp[found], "R%u", i); sprintf(srgbtmp[found], "R%u", i);
found++; ++found;
if(found == 4) break; if (found == 4) break;
}
} }
switch(found) { switch(found) {
......
...@@ -262,7 +262,7 @@ static void shader_record_register_usage(IWineD3DBaseShaderImpl *This, struct sh ...@@ -262,7 +262,7 @@ static void shader_record_register_usage(IWineD3DBaseShaderImpl *This, struct sh
break; break;
case WINED3DSPR_TEMP: case WINED3DSPR_TEMP:
reg_maps->temporary[reg->idx] = 1; reg_maps->temporary |= 1 << reg->idx;
break; break;
case WINED3DSPR_INPUT: case WINED3DSPR_INPUT:
......
...@@ -1038,9 +1038,9 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont ...@@ -1038,9 +1038,9 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
} }
/* Declare temporary variables */ /* Declare temporary variables */
for(i = 0; i < This->baseShader.limits.temporary; i++) { for (i = 0, map = reg_maps->temporary; map; map >>= 1, ++i)
if (reg_maps->temporary[i]) {
shader_addline(buffer, "vec4 R%u;\n", i); if (map & 1) shader_addline(buffer, "vec4 R%u;\n", i);
} }
/* Declare attributes */ /* Declare attributes */
......
...@@ -629,7 +629,7 @@ typedef struct shader_reg_maps ...@@ -629,7 +629,7 @@ typedef struct shader_reg_maps
{ {
struct wined3d_shader_version shader_version; struct wined3d_shader_version shader_version;
BYTE texcoord; /* MAX_REG_TEXCRD, 8 */ BYTE texcoord; /* MAX_REG_TEXCRD, 8 */
char temporary[MAX_REG_TEMP]; /* pixel, vertex */ DWORD temporary; /* MAX_REG_TEMP, 32 */
char address[MAX_REG_ADDR]; /* vertex */ char address[MAX_REG_ADDR]; /* vertex */
char labels[MAX_LABELS]; /* pixel, vertex */ char labels[MAX_LABELS]; /* pixel, vertex */
DWORD *constf; /* pixel, vertex */ DWORD *constf; /* pixel, vertex */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment