wined3d: Introduce a union for declaration shader instruction arguments.

This commit is contained in:
Henri Verbeet 2012-09-17 12:22:22 +02:00 committed by Alexandre Julliard
parent 2760a70aee
commit 0a17173bc2
3 changed files with 18 additions and 13 deletions

View File

@ -501,29 +501,31 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
/* Handle declarations. */
if (ins.handler_idx == WINED3DSIH_DCL)
{
switch (ins.semantic.reg.reg.type)
struct wined3d_shader_semantic *semantic = &ins.declaration.semantic;
switch (semantic->reg.reg.type)
{
/* Mark input registers used. */
case WINED3DSPR_INPUT:
reg_maps->input_registers |= 1 << ins.semantic.reg.reg.idx;
shader_signature_from_semantic(&input_signature[ins.semantic.reg.reg.idx], &ins.semantic);
reg_maps->input_registers |= 1 << semantic->reg.reg.idx;
shader_signature_from_semantic(&input_signature[semantic->reg.reg.idx], semantic);
break;
/* Vertex shader: mark 3.0 output registers used, save token. */
case WINED3DSPR_OUTPUT:
reg_maps->output_registers |= 1 << ins.semantic.reg.reg.idx;
shader_signature_from_semantic(&output_signature[ins.semantic.reg.reg.idx], &ins.semantic);
if (ins.semantic.usage == WINED3D_DECL_USAGE_FOG)
reg_maps->output_registers |= 1 << semantic->reg.reg.idx;
shader_signature_from_semantic(&output_signature[semantic->reg.reg.idx], semantic);
if (semantic->usage == WINED3D_DECL_USAGE_FOG)
reg_maps->fog = 1;
break;
/* Save sampler usage token. */
case WINED3DSPR_SAMPLER:
reg_maps->sampler_type[ins.semantic.reg.reg.idx] = ins.semantic.sampler_type;
reg_maps->sampler_type[semantic->reg.reg.idx] = semantic->sampler_type;
break;
default:
TRACE("Not recording DCL register type %#x.\n", ins.semantic.reg.reg.type);
TRACE("Not recording DCL register type %#x.\n", semantic->reg.reg.type);
break;
}
}
@ -1314,10 +1316,10 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe
if (ins.handler_idx == WINED3DSIH_DCL)
{
shader_dump_decl_usage(&ins.semantic, &shader_version);
shader_dump_ins_modifiers(&ins.semantic.reg);
shader_dump_decl_usage(&ins.declaration.semantic, &shader_version);
shader_dump_ins_modifiers(&ins.declaration.semantic.reg);
TRACE(" ");
shader_dump_dst_param(&ins.semantic.reg, &shader_version);
shader_dump_dst_param(&ins.declaration.semantic.reg, &shader_version);
}
else if (ins.handler_idx == WINED3DSIH_DEF)
{

View File

@ -670,7 +670,7 @@ static void shader_sm1_read_instruction(void *data, const DWORD **ptr, struct wi
if (ins->handler_idx == WINED3DSIH_DCL)
{
shader_sm1_read_semantic(&p, &ins->semantic);
shader_sm1_read_semantic(&p, &ins->declaration.semantic);
}
else if (ins->handler_idx == WINED3DSIH_DEF)
{

View File

@ -663,7 +663,10 @@ struct wined3d_shader_instruction
const struct wined3d_shader_dst_param *dst;
UINT src_count;
const struct wined3d_shader_src_param *src;
struct wined3d_shader_semantic semantic;
union
{
struct wined3d_shader_semantic semantic;
} declaration;
};
struct wined3d_shader_attribute