Commit 65321dd1 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Introduce shader_sm1_read_semantic().

parent 8d4c9049
...@@ -262,6 +262,17 @@ static void shader_sm1_read_dst_param(const DWORD **ptr, struct wined3d_shader_d ...@@ -262,6 +262,17 @@ static void shader_sm1_read_dst_param(const DWORD **ptr, struct wined3d_shader_d
} }
} }
static void shader_sm1_read_semantic(const DWORD **ptr, struct wined3d_shader_semantic *semantic)
{
DWORD usage_token = *(*ptr)++;
DWORD dst_token = *(*ptr)++;
semantic->usage = (usage_token & WINED3DSP_DCL_USAGE_MASK) >> WINED3DSP_DCL_USAGE_SHIFT;
semantic->usage_idx = (usage_token & WINED3DSP_DCL_USAGEINDEX_MASK) >> WINED3DSP_DCL_USAGEINDEX_SHIFT;
semantic->sampler_type = usage_token & WINED3DSP_TEXTURETYPE_MASK;
shader_parse_dst_param(dst_token, NULL, &semantic->reg);
}
static const char *shader_opcode_names[] = static const char *shader_opcode_names[] =
{ {
/* WINED3DSIH_ABS */ "abs", /* WINED3DSIH_ABS */ "abs",
...@@ -601,39 +612,36 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, struct shader_reg_m ...@@ -601,39 +612,36 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, struct shader_reg_m
/* Handle declarations */ /* Handle declarations */
if (ins.handler_idx == WINED3DSIH_DCL) if (ins.handler_idx == WINED3DSIH_DCL)
{ {
DWORD usage = *pToken++; struct wined3d_shader_semantic semantic;
DWORD param = *pToken++;
DWORD regtype = shader_get_regtype(param);
unsigned int regnum = param & WINED3DSP_REGNUM_MASK;
/* Vshader: mark attributes used shader_sm1_read_semantic(&pToken, &semantic);
Pshader: mark 3.0 input registers used, save token */
if (WINED3DSPR_INPUT == regtype) {
if (!pshader) switch (semantic.reg.register_type)
reg_maps->attributes[regnum] = 1; {
else /* Vshader: mark attributes used
reg_maps->packed_input[regnum] = 1; * Pshader: mark 3.0 input registers used, save token */
case WINED3DSPR_INPUT:
semantics_in[regnum].usage = (usage & WINED3DSP_DCL_USAGE_MASK) >> WINED3DSP_DCL_USAGE_SHIFT; if (!pshader) reg_maps->attributes[semantic.reg.register_idx] = 1;
semantics_in[regnum].usage_idx = else reg_maps->packed_input[semantic.reg.register_idx] = 1;
(usage & WINED3DSP_DCL_USAGEINDEX_MASK) >> WINED3DSP_DCL_USAGEINDEX_SHIFT; semantics_in[semantic.reg.register_idx] = semantic;
shader_parse_dst_param(param, NULL, &semantics_in[regnum].reg); break;
/* Vshader: mark 3.0 output registers used, save token */ /* Vshader: mark 3.0 output registers used, save token */
} else if (WINED3DSPR_OUTPUT == regtype) { case WINED3DSPR_OUTPUT:
reg_maps->packed_output[regnum] = 1; reg_maps->packed_output[semantic.reg.register_idx] = 1;
semantics_out[regnum].usage = (usage & WINED3DSP_DCL_USAGE_MASK) >> WINED3DSP_DCL_USAGE_SHIFT; semantics_out[semantic.reg.register_idx] = semantic;
semantics_out[regnum].usage_idx = if (semantic.usage == WINED3DDECLUSAGE_FOG) reg_maps->fog = 1;
(usage & WINED3DSP_DCL_USAGEINDEX_MASK) >> WINED3DSP_DCL_USAGEINDEX_SHIFT; break;
shader_parse_dst_param(param, NULL, &semantics_out[regnum].reg);
/* Save sampler usage token */
if (usage & (WINED3DDECLUSAGE_FOG << WINED3DSP_DCL_USAGE_SHIFT)) case WINED3DSPR_SAMPLER:
reg_maps->fog = 1; reg_maps->sampler_type[semantic.reg.register_idx] = semantic.sampler_type;
break;
/* Save sampler usage token */
} else if (WINED3DSPR_SAMPLER == regtype) default:
reg_maps->sampler_type[regnum] = usage & WINED3DSP_TEXTURETYPE_MASK; TRACE("Not recording DCL register type %#x.\n", semantic.reg.register_type);
break;
}
} }
else if (ins.handler_idx == WINED3DSIH_DEF) else if (ins.handler_idx == WINED3DSIH_DEF)
{ {
......
...@@ -482,6 +482,7 @@ struct wined3d_shader_semantic ...@@ -482,6 +482,7 @@ struct wined3d_shader_semantic
{ {
WINED3DDECLUSAGE usage; WINED3DDECLUSAGE usage;
UINT usage_idx; UINT usage_idx;
WINED3DSAMPLER_TEXTURE_TYPE sampler_type;
struct wined3d_shader_dst_param reg; struct wined3d_shader_dst_param reg;
}; };
......
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