wined3d: Explicitly pass register type and index to shader_is_scalar().

This commit is contained in:
Henri Verbeet 2009-04-07 11:09:11 +02:00 committed by Alexandre Julliard
parent 6f66c1ddbd
commit f7f61a58f4
2 changed files with 13 additions and 14 deletions

View File

@ -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);

View File

@ -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;
}
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 */