wined3d: Store the register type in struct wined3d_shader_src_param.

This commit is contained in:
Henri Verbeet 2009-04-15 10:06:28 +02:00 committed by Alexandre Julliard
parent ff62cab537
commit 4de1dba2c5
3 changed files with 16 additions and 8 deletions

View File

@ -224,6 +224,14 @@ static void shader_parse_dst_param(DWORD param, DWORD addr_param, struct wined3d
dst->addr_token = addr_param;
}
static void shader_parse_src_param(DWORD param, DWORD addr_param, struct wined3d_shader_src_param *src)
{
src->register_type = ((param & WINED3DSP_REGTYPE_MASK) >> WINED3DSP_REGTYPE_SHIFT)
| ((param & WINED3DSP_REGTYPE_MASK2) >> WINED3DSP_REGTYPE_SHIFT2);
src->token = param;
src->addr_token = addr_param;
}
/* Note that this does not count the loop register
* as an address register. */
@ -885,8 +893,7 @@ void shader_generate_main(IWineD3DBaseShader *iface, SHADER_BUFFER* buffer,
{
DWORD param, addr_token = 0;
pToken += shader_get_param(pToken, shader_version, &param, &addr_token);
src_param[i].token = param;
src_param[i].addr_token = addr_token;
shader_parse_src_param(param, addr_token, &src_param[i]);
}
/* Call appropriate function for output target */

View File

@ -1944,7 +1944,7 @@ static void shader_glsl_cmp(const struct wined3d_shader_instruction *ins)
char mask_char[6];
BOOL temp_destination = FALSE;
if (shader_is_scalar(shader_get_regtype(ins->src[0].token), ins->src[0].token & WINED3DSP_REGNUM_MASK))
if (shader_is_scalar(ins->src[0].register_type, ins->src[0].token & WINED3DSP_REGNUM_MASK))
{
write_mask = shader_glsl_append_dst(ins->ctx->buffer, ins);
@ -1958,9 +1958,9 @@ static void shader_glsl_cmp(const struct wined3d_shader_instruction *ins)
DWORD src0reg = ins->src[0].token & WINED3DSP_REGNUM_MASK;
DWORD src1reg = ins->src[1].token & WINED3DSP_REGNUM_MASK;
DWORD src2reg = ins->src[2].token & WINED3DSP_REGNUM_MASK;
DWORD src0regtype = shader_get_regtype(ins->src[0].token);
DWORD src1regtype = shader_get_regtype(ins->src[1].token);
DWORD src2regtype = shader_get_regtype(ins->src[2].token);
DWORD src0regtype = ins->src[0].register_type;
DWORD src1regtype = ins->src[1].register_type;
DWORD src2regtype = ins->src[2].register_type;
DWORD dstreg = ins->dst[0].register_idx;
DWORD dstregtype = ins->dst[0].register_type;
DWORD dst_mask = ins->dst[0].write_mask;
@ -2283,7 +2283,6 @@ static void shader_glsl_loop(const struct wined3d_shader_instruction *ins)
{
glsl_src_param_t src1_param;
IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)ins->ctx->shader;
DWORD regtype = shader_get_regtype(ins->src[1].token);
DWORD reg = ins->src[1].token & WINED3DSP_REGNUM_MASK;
const DWORD *control_values = NULL;
const local_constant *constant;
@ -2295,7 +2294,8 @@ static void shader_glsl_loop(const struct wined3d_shader_instruction *ins)
* known at compile time, the GLSL compiler can unroll the loop, and replace indirect addressing with direct
* addressing.
*/
if(regtype == WINED3DSPR_CONSTINT) {
if (ins->src[1].register_type == WINED3DSPR_CONSTINT)
{
LIST_FOR_EACH_ENTRY(constant, &shader->baseShader.constantsI, local_constant, entry) {
if(constant->idx == reg) {
control_values = constant->value;

View File

@ -464,6 +464,7 @@ struct wined3d_shader_dst_param
struct wined3d_shader_src_param
{
WINED3DSHADER_PARAM_REGISTER_TYPE register_type;
DWORD token;
DWORD addr_token;
};