Commit 6eb43e35 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Get rid of the remaining WINED3DSP_REGNUM_MASK usage.

parent c3dce7dc
......@@ -724,21 +724,24 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, struct shader_reg_m
else if (ins.handler_idx == WINED3DSIH_LOOP
|| ins.handler_idx == WINED3DSIH_REP)
{
DWORD reg;
struct wined3d_shader_src_param src, rel_addr;
if(ins.handler_idx == WINED3DSIH_LOOP) {
reg = pToken[1];
} else {
reg = pToken[0];
shader_sm1_read_src_param(&pToken, &src, &rel_addr, shader_version);
/* Rep and Loop always use an integer constant for the control parameters */
if (ins.handler_idx == WINED3DSIH_REP)
{
reg_maps->integer_constants |= 1 << src.register_idx;
}
else
{
shader_sm1_read_src_param(&pToken, &src, &rel_addr, shader_version);
reg_maps->integer_constants |= 1 << src.register_idx;
}
cur_loop_depth++;
if(cur_loop_depth > max_loop_depth)
max_loop_depth = cur_loop_depth;
pToken += param_size;
/* Rep and Loop always use an integer constant for the control parameters */
reg_maps->integer_constants |= (1 << (reg & WINED3DSP_REGNUM_MASK));
}
else if (ins.handler_idx == WINED3DSIH_ENDLOOP
|| ins.handler_idx == WINED3DSIH_ENDREP)
......@@ -748,16 +751,44 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, struct shader_reg_m
/* For subroutine prototypes */
else if (ins.handler_idx == WINED3DSIH_LABEL)
{
struct wined3d_shader_src_param src, rel_addr;
DWORD snum = *pToken & WINED3DSP_REGNUM_MASK;
reg_maps->labels[snum] = 1;
pToken += param_size;
shader_sm1_read_src_param(&pToken, &src, &rel_addr, shader_version);
reg_maps->labels[src.register_idx] = 1;
}
/* Set texture, address, temporary registers */
else
{
int i, limit;
/* This will loop over all the registers and try to
* make a bitmask of the ones we're interested in.
*
* Relative addressing tokens are ignored, but that's
* okay, since we'll catch any address registers when
* they are initialized (required by spec) */
if (ins.dst_count)
{
struct wined3d_shader_dst_param dst_param;
struct wined3d_shader_src_param dst_rel_addr;
shader_sm1_read_dst_param(&pToken, &dst_param, &dst_rel_addr, shader_version);
/* WINED3DSPR_TEXCRDOUT is the same as WINED3DSPR_OUTPUT. _OUTPUT can be > MAX_REG_TEXCRD and
* is used in >= 3.0 shaders. Filter 3.0 shaders to prevent overflows, and also filter pixel
* shaders because TECRDOUT isn't used in them, but future register types might cause issues */
if (!pshader && WINED3DSHADER_VERSION_MAJOR(shader_version) < 3
&& dst_param.register_type == WINED3DSPR_TEXCRDOUT)
{
reg_maps->texcoord_mask[dst_param.register_type] |= dst_param.write_mask;
}
else
{
shader_record_register_usage(This, reg_maps, dst_param.register_type,
dst_param.register_idx, !!dst_param.rel_addr, pshader);
}
/* Declare 1.X samplers implicitly, based on the destination reg. number */
if (WINED3DSHADER_VERSION_MAJOR(shader_version) == 1
&& pshader /* Filter different instructions with the same enum values in VS */
......@@ -774,7 +805,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, struct shader_reg_m
|| ins.handler_idx == WINED3DSIH_TEXREG2RGB))
{
/* Fake sampler usage, only set reserved bit and ttype */
DWORD sampler_code = *pToken & WINED3DSP_REGNUM_MASK;
DWORD sampler_code = dst_param.register_idx;
TRACE("Setting fake 2D sampler for 1.x pixelshader\n");
reg_maps->sampler_type[sampler_code] = WINED3DSTT_2D;
......@@ -790,47 +821,19 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, struct shader_reg_m
}
}
}
if (ins.handler_idx == WINED3DSIH_NRM)
{
reg_maps->usesnrm = 1;
}
else if (pshader && ins.handler_idx == WINED3DSIH_BEM)
{
DWORD regnum = *pToken & WINED3DSP_REGNUM_MASK;
reg_maps->bumpmat[regnum] = TRUE;
reg_maps->bumpmat[dst_param.register_idx] = TRUE;
}
else if (ins.handler_idx == WINED3DSIH_DSY)
{
reg_maps->usesdsy = 1;
}
/* This will loop over all the registers and try to
* make a bitmask of the ones we're interested in.
*
* Relative addressing tokens are ignored, but that's
* okay, since we'll catch any address registers when
* they are initialized (required by spec) */
if (ins.dst_count)
{
struct wined3d_shader_dst_param dst_param;
struct wined3d_shader_src_param dst_rel_addr;
shader_sm1_read_dst_param(&pToken, &dst_param, &dst_rel_addr, shader_version);
/* WINED3DSPR_TEXCRDOUT is the same as WINED3DSPR_OUTPUT. _OUTPUT can be > MAX_REG_TEXCRD and
* is used in >= 3.0 shaders. Filter 3.0 shaders to prevent overflows, and also filter pixel
* shaders because TECRDOUT isn't used in them, but future register types might cause issues */
if (!pshader && WINED3DSHADER_VERSION_MAJOR(shader_version) < 3
&& dst_param.register_type == WINED3DSPR_TEXCRDOUT)
if (ins.handler_idx == WINED3DSIH_NRM)
{
reg_maps->texcoord_mask[dst_param.register_type] |= dst_param.write_mask;
reg_maps->usesnrm = 1;
}
else
else if (ins.handler_idx == WINED3DSIH_DSY)
{
shader_record_register_usage(This, reg_maps, dst_param.register_type,
dst_param.register_idx, !!dst_param.rel_addr, pshader);
}
reg_maps->usesdsy = 1;
}
limit = ins.src_count + (ins.predicate ? 1 : 0);
......
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