Commit 592361be authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Pass the shader type to shader_record_register_usage().

parent 5b6877ee
...@@ -241,12 +241,12 @@ static inline void set_bitmap_bit(DWORD *bitmap, DWORD bit) ...@@ -241,12 +241,12 @@ static inline void set_bitmap_bit(DWORD *bitmap, DWORD bit)
} }
static void shader_record_register_usage(IWineD3DBaseShaderImpl *This, struct shader_reg_maps *reg_maps, static void shader_record_register_usage(IWineD3DBaseShaderImpl *This, struct shader_reg_maps *reg_maps,
const struct wined3d_shader_register *reg, BOOL pshader) const struct wined3d_shader_register *reg, enum wined3d_shader_type shader_type)
{ {
switch (reg->type) switch (reg->type)
{ {
case WINED3DSPR_TEXTURE: /* WINED3DSPR_ADDR */ case WINED3DSPR_TEXTURE: /* WINED3DSPR_ADDR */
if (pshader) reg_maps->texcoord[reg->idx] = 1; if (shader_type == WINED3D_SHADER_TYPE_PIXEL) reg_maps->texcoord[reg->idx] = 1;
else reg_maps->address[reg->idx] = 1; else reg_maps->address[reg->idx] = 1;
break; break;
...@@ -255,8 +255,7 @@ static void shader_record_register_usage(IWineD3DBaseShaderImpl *This, struct sh ...@@ -255,8 +255,7 @@ static void shader_record_register_usage(IWineD3DBaseShaderImpl *This, struct sh
break; break;
case WINED3DSPR_INPUT: case WINED3DSPR_INPUT:
if (!pshader) reg_maps->input_registers |= 1 << reg->idx; if (shader_type == WINED3D_SHADER_TYPE_PIXEL)
else
{ {
if (reg->rel_addr) if (reg->rel_addr)
{ {
...@@ -274,6 +273,7 @@ static void shader_record_register_usage(IWineD3DBaseShaderImpl *This, struct sh ...@@ -274,6 +273,7 @@ static void shader_record_register_usage(IWineD3DBaseShaderImpl *This, struct sh
((IWineD3DPixelShaderImpl *)This)->input_reg_used[reg->idx] = TRUE; ((IWineD3DPixelShaderImpl *)This)->input_reg_used[reg->idx] = TRUE;
} }
} }
else reg_maps->input_registers |= 1 << reg->idx;
break; break;
case WINED3DSPR_RASTOUT: case WINED3DSPR_RASTOUT:
...@@ -281,14 +281,17 @@ static void shader_record_register_usage(IWineD3DBaseShaderImpl *This, struct sh ...@@ -281,14 +281,17 @@ static void shader_record_register_usage(IWineD3DBaseShaderImpl *This, struct sh
break; break;
case WINED3DSPR_MISCTYPE: case WINED3DSPR_MISCTYPE:
if (pshader && reg->idx == 0) reg_maps->vpos = 1; if (shader_type == WINED3D_SHADER_TYPE_PIXEL)
if (pshader && reg->idx == 1) reg_maps->usesfacing = 1; {
if (reg->idx == 0) reg_maps->vpos = 1;
else if (reg->idx == 1) reg_maps->usesfacing = 1;
}
break; break;
case WINED3DSPR_CONST: case WINED3DSPR_CONST:
if (reg->rel_addr) if (reg->rel_addr)
{ {
if (!pshader) if (shader_type != WINED3D_SHADER_TYPE_PIXEL)
{ {
if (reg->idx <= ((IWineD3DVertexShaderImpl *)This)->min_rel_offset) if (reg->idx <= ((IWineD3DVertexShaderImpl *)This)->min_rel_offset)
((IWineD3DVertexShaderImpl *)This)->min_rel_offset = reg->idx; ((IWineD3DVertexShaderImpl *)This)->min_rel_offset = reg->idx;
...@@ -619,7 +622,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3 ...@@ -619,7 +622,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
IWineD3DPixelShaderImpl *ps = (IWineD3DPixelShaderImpl *) This; IWineD3DPixelShaderImpl *ps = (IWineD3DPixelShaderImpl *) This;
ps->color0_mov = FALSE; ps->color0_mov = FALSE;
} }
shader_record_register_usage(This, reg_maps, &dst_param.reg, pshader); shader_record_register_usage(This, reg_maps, &dst_param.reg, shader_version.type);
} }
/* Declare 1.X samplers implicitly, based on the destination reg. number */ /* Declare 1.X samplers implicitly, based on the destination reg. number */
...@@ -718,11 +721,11 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3 ...@@ -718,11 +721,11 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
fe->shader_read_src_param(fe_data, &pToken, &src_param, &src_rel_addr); fe->shader_read_src_param(fe_data, &pToken, &src_param, &src_rel_addr);
count = get_instr_extra_regcount(ins.handler_idx, i); count = get_instr_extra_regcount(ins.handler_idx, i);
shader_record_register_usage(This, reg_maps, &src_param.reg, pshader); shader_record_register_usage(This, reg_maps, &src_param.reg, shader_version.type);
while (count) while (count)
{ {
++src_param.reg.idx; ++src_param.reg.idx;
shader_record_register_usage(This, reg_maps, &src_param.reg, pshader); shader_record_register_usage(This, reg_maps, &src_param.reg, shader_version.type);
--count; --count;
} }
......
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