From f7f61a58f45e362a63f5a08fc65f9cad093d4584 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Tue, 7 Apr 2009 11:09:11 +0200 Subject: [PATCH] wined3d: Explicitly pass register type and index to shader_is_scalar(). --- dlls/wined3d/glsl_shader.c | 8 +++++--- dlls/wined3d/wined3d_private.h | 19 ++++++++----------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 7c0ea51d999..e24b9518230 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -1184,7 +1184,8 @@ static DWORD shader_glsl_get_write_mask(const DWORD param, char *write_mask) { char *ptr = write_mask; DWORD mask = param & WINED3DSP_WRITEMASK_ALL; - if (shader_is_scalar(param)) { + if (shader_is_scalar(shader_get_regtype(param), param & WINED3DSP_REGNUM_MASK)) + { mask = WINED3DSP_WRITEMASK_0; } else { *ptr++ = '.'; @@ -1218,7 +1219,8 @@ static void shader_glsl_get_swizzle(const DWORD param, BOOL fixup, DWORD mask, c const char *swizzle_chars = fixup ? "zyxw" : "xyzw"; char *ptr = swizzle_str; - if (!shader_is_scalar(param)) { + if (!shader_is_scalar(shader_get_regtype(param), param & WINED3DSP_REGNUM_MASK)) + { *ptr++ = '.'; /* swizzle bits fields: wwzzyyxx */ if (mask & WINED3DSP_WRITEMASK_0) *ptr++ = swizzle_chars[swizzle & 0x03]; @@ -1900,7 +1902,7 @@ static void shader_glsl_cmp(const struct wined3d_shader_instruction *ins) char mask_char[6]; BOOL temp_destination = FALSE; - if (shader_is_scalar(ins->src[0])) + if (shader_is_scalar(shader_get_regtype(ins->src[0]), ins->src[0] & WINED3DSP_REGNUM_MASK)) { write_mask = shader_glsl_append_dst(ins->buffer, ins); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index ccc681f0c7d..070a590ef73 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2386,16 +2386,13 @@ static inline BOOL shader_is_comment(DWORD token) { return WINED3DSIO_COMMENT == (token & WINED3DSI_OPCODE_MASK); } -static inline BOOL shader_is_scalar(DWORD param) { - DWORD reg_type = shader_get_regtype(param); - DWORD reg_num; - - switch (reg_type) { +static inline BOOL shader_is_scalar(WINED3DSHADER_PARAM_REGISTER_TYPE register_type, UINT register_idx) +{ + switch (register_type) + { case WINED3DSPR_RASTOUT: - if ((param & WINED3DSP_REGNUM_MASK) != 0) { - /* oFog & oPts */ - return TRUE; - } + /* oFog & oPts */ + if (register_idx != 0) return TRUE; /* oPos */ return FALSE; @@ -2406,8 +2403,8 @@ static inline BOOL shader_is_scalar(DWORD param) { return TRUE; case WINED3DSPR_MISCTYPE: - reg_num = param & WINED3DSP_REGNUM_MASK; - switch(reg_num) { + switch(register_idx) + { case 0: /* vPos */ return FALSE; case 1: /* vFace */