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

This commit is contained in:
Henri Verbeet 2009-08-11 09:42:15 +02:00 committed by Alexandre Julliard
parent a282380f08
commit 50853e295b
4 changed files with 15 additions and 16 deletions

View File

@ -615,6 +615,7 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s
char pshader = shader_is_pshader_version(reg_maps->shader_version.type);
unsigned max_constantsF;
const local_constant *lconst;
DWORD map;
/* In pixel shaders, all private constants are program local, we don't need anything
* from program.env. Thus we can advertise the full set of constants in pixel shaders.
@ -668,10 +669,11 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s
shader_addline(buffer, "ADDRESS A%d;\n", i);
}
if(pshader && reg_maps->shader_version.major == 1 && reg_maps->shader_version.minor <= 3) {
for(i = 0; i < This->baseShader.limits.texcoord; i++) {
if (reg_maps->texcoord[i] && pshader)
shader_addline(buffer,"TEMP T%u;\n", i);
if (pshader && reg_maps->shader_version.major == 1 && reg_maps->shader_version.minor <= 3)
{
for (i = 0, map = reg_maps->texcoord; map; map >>= 1, ++i)
{
if (map & 1) shader_addline(buffer, "TEMP T%u;\n", i);
}
}
@ -3923,7 +3925,7 @@ static void find_clip_texcoord(IWineD3DPixelShaderImpl *ps)
{
for(i = GL_LIMITS(texture_stages); i > 0; i--)
{
if(!ps->baseShader.reg_maps.texcoord[i - 1])
if (!(ps->baseShader.reg_maps.texcoord & (1 << (i - 1))))
{
shader_priv->clipplane_emulation = i;
return;

View File

@ -257,7 +257,7 @@ static void shader_record_register_usage(IWineD3DBaseShaderImpl *This, struct sh
switch (reg->type)
{
case WINED3DSPR_TEXTURE: /* WINED3DSPR_ADDR */
if (shader_type == WINED3D_SHADER_TYPE_PIXEL) reg_maps->texcoord[reg->idx] = 1;
if (shader_type == WINED3D_SHADER_TYPE_PIXEL) reg_maps->texcoord |= 1 << reg->idx;
else reg_maps->address[reg->idx] = 1;
break;

View File

@ -814,6 +814,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
const struct wined3d_gl_info *gl_info = context->gl_info;
unsigned int i, extra_constants_needed = 0;
const local_constant *lconst;
DWORD map;
/* There are some minor differences between pixel and vertex shaders */
char pshader = shader_is_pshader_version(reg_maps->shader_version.type);
@ -1009,9 +1010,9 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
}
/* Declare texture coordinate temporaries and initialize them */
for (i = 0; i < This->baseShader.limits.texcoord; i++) {
if (reg_maps->texcoord[i])
shader_addline(buffer, "vec4 T%u = gl_TexCoord[%u];\n", i, i);
for (i = 0, map = reg_maps->texcoord; map; map >>= 1, ++i)
{
if (map & 1) shader_addline(buffer, "vec4 T%u = gl_TexCoord[%u];\n", i, i);
}
/* Declare input register varyings. Only pixel shader, vertex shaders have that declared in the
@ -1045,13 +1046,9 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
/* Declare attributes */
if (reg_maps->shader_version.type == WINED3D_SHADER_TYPE_VERTEX)
{
WORD map = reg_maps->input_registers;
for (i = 0; map; map >>= 1, ++i)
for (i = 0, map = reg_maps->input_registers; map; map >>= 1, ++i)
{
if (!(map & 1)) continue;
shader_addline(buffer, "attribute vec4 attrib%i;\n", i);
if (map & 1) shader_addline(buffer, "attribute vec4 attrib%i;\n", i);
}
}

View File

@ -628,7 +628,7 @@ struct wined3d_shader_version
typedef struct shader_reg_maps
{
struct wined3d_shader_version shader_version;
char texcoord[MAX_REG_TEXCRD]; /* pixel < 3.0 */
BYTE texcoord; /* MAX_REG_TEXCRD, 8 */
char temporary[MAX_REG_TEMP]; /* pixel, vertex */
char address[MAX_REG_ADDR]; /* vertex */
char labels[MAX_LABELS]; /* pixel, vertex */