[PATCH 1/5] wined3d: Introduce a union for declaration shader instruction arguments.
Henri Verbeet
hverbeet at codeweavers.com
Mon Sep 17 05:22:22 CDT 2012
---
dlls/wined3d/shader.c | 24 +++++++++++++-----------
dlls/wined3d/shader_sm1.c | 2 +-
dlls/wined3d/wined3d_private.h | 5 ++++-
3 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 6bb3b5b..3799e04 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -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)
{
diff --git a/dlls/wined3d/shader_sm1.c b/dlls/wined3d/shader_sm1.c
index 8721d7e..b8b96dd 100644
--- a/dlls/wined3d/shader_sm1.c
+++ b/dlls/wined3d/shader_sm1.c
@@ -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)
{
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index bd5c5e2..8f1b168 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -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
--
1.7.8.6
More information about the wine-patches
mailing list