Commit 3a7df733 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Store used pixel shader input registers as a bitmap (AFL).

parent 7ad37a64
......@@ -1856,11 +1856,11 @@ static BOOL glsl_is_color_reg_read(const struct wined3d_shader *shader, unsigned
{
const struct wined3d_shader_signature *input_signature = &shader->input_signature;
const struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps;
const BOOL *input_reg_used = shader->u.ps.input_reg_used;
DWORD input_reg_used = shader->u.ps.input_reg_used;
unsigned int i;
if (reg_maps->shader_version.major < 3)
return input_reg_used[idx];
return input_reg_used & (1u << idx);
for (i = 0; i < input_signature->element_count; ++i)
{
......@@ -1871,12 +1871,7 @@ static BOOL glsl_is_color_reg_read(const struct wined3d_shader *shader, unsigned
if (shader_match_semantic(input->semantic_name, WINED3D_DECL_USAGE_COLOR)
&& input->semantic_idx == idx)
{
if (input_reg_used[input->register_idx])
return TRUE;
else
return FALSE;
}
return input_reg_used & (1u << input->register_idx);
}
return FALSE;
}
......
......@@ -709,21 +709,14 @@ static BOOL shader_record_register_usage(struct wined3d_shader *shader, struct w
case WINED3DSPR_INPUT:
if (shader_type == WINED3D_SHADER_TYPE_PIXEL)
{
/* If relative addressing is used, we must assume that all
* registers are used. Even if it is a construct like v3[aL],
* we can't assume that v0, v1 and v2 aren't read because aL
* can be negative. */
if (reg->idx[0].rel_addr)
{
/* If relative addressing is used, we must assume that all registers
* are used. Even if it is a construct like v3[aL], we can't assume
* that v0, v1 and v2 aren't read because aL can be negative */
unsigned int i;
for (i = 0; i < MAX_REG_INPUT; ++i)
{
shader->u.ps.input_reg_used[i] = TRUE;
}
}
shader->u.ps.input_reg_used = ~0u;
else
{
shader->u.ps.input_reg_used[reg->idx[0].offset] = TRUE;
}
shader->u.ps.input_reg_used |= 1u << reg->idx[0].offset;
}
else
reg_maps->input_registers |= 1u << reg->idx[0].offset;
......@@ -3493,7 +3486,7 @@ static HRESULT pixel_shader_init(struct wined3d_shader *shader, struct wined3d_d
for (i = 0; i < MAX_REG_INPUT; ++i)
{
if (shader->u.ps.input_reg_used[i])
if (shader->u.ps.input_reg_used & (1u << i))
{
++num_regs_used;
highest_reg_used = i;
......@@ -3526,7 +3519,7 @@ static HRESULT pixel_shader_init(struct wined3d_shader *shader, struct wined3d_d
shader->u.ps.declared_in_count = 0;
for (i = 0; i < MAX_REG_INPUT; ++i)
{
if (shader->u.ps.input_reg_used[i])
if (shader->u.ps.input_reg_used & (1u << i))
shader->u.ps.input_reg_map[i] = shader->u.ps.declared_in_count++;
else shader->u.ps.input_reg_map[i] = ~0U;
}
......
......@@ -3572,7 +3572,7 @@ struct wined3d_pixel_shader
{
/* Pixel shader input semantics */
DWORD input_reg_map[MAX_REG_INPUT];
BOOL input_reg_used[MAX_REG_INPUT];
DWORD input_reg_used; /* MAX_REG_INPUT, 32 */
unsigned int declared_in_count;
/* Some information about the shader behavior */
......
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