From 4de1dba2c5ef8e6fd03d1e8f80e23852c01cac30 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Wed, 15 Apr 2009 10:06:28 +0200 Subject: [PATCH] wined3d: Store the register type in struct wined3d_shader_src_param. --- dlls/wined3d/baseshader.c | 11 +++++++++-- dlls/wined3d/glsl_shader.c | 12 ++++++------ dlls/wined3d/wined3d_private.h | 1 + 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/dlls/wined3d/baseshader.c b/dlls/wined3d/baseshader.c index 5d3fdcc0075..03403af9d02 100644 --- a/dlls/wined3d/baseshader.c +++ b/dlls/wined3d/baseshader.c @@ -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, ¶m, &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 */ diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 51349b2c532..ada70a8a3f8 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -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; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 85b1c926366..0ad9116c975 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -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; };