From: Corbin Simpson Date: Wed, 11 Mar 2009 22:05:52 +0000 (-0700) Subject: r300-gallium: r500-fs: More texture fixes. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cec2170632a664da273c0e80ad1ead5cd43667a3;p=mesa.git r300-gallium: r500-fs: More texture fixes. --- diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c index 4c6d2a24712..10b0cf73532 100644 --- a/src/gallium/drivers/r300/r300_debug.c +++ b/src/gallium/drivers/r300/r300_debug.c @@ -200,15 +200,15 @@ void r500_fs_dump(struct r500_fragment_shader* fs) debug_printf(" 2: TEX_ADDR 0x%08x: " "src: %d%s %s/%s/%s/%s dst: %d%s %s/%s/%s/%s\n", inst, inst & 0x7f, inst & (1 << 7) ? "(rel)" : "", - r500_fs_swiz[(inst >> 8) & 0x7], - r500_fs_swiz[(inst >> 10) & 0x7], - r500_fs_swiz[(inst >> 12) & 0x7], - r500_fs_swiz[(inst >> 14) & 0x7], + r500_fs_swiz[(inst >> 8) & 0x3], + r500_fs_swiz[(inst >> 10) & 0x3], + r500_fs_swiz[(inst >> 12) & 0x3], + r500_fs_swiz[(inst >> 14) & 0x3], (inst >> 16) & 0x7f, inst & (1 << 23) ? "(rel)" : "", - r500_fs_swiz[(inst >> 24) & 0x7], - r500_fs_swiz[(inst >> 26) & 0x7], - r500_fs_swiz[(inst >> 28) & 0x7], - r500_fs_swiz[(inst >> 30) & 0x7]); + r500_fs_swiz[(inst >> 24) & 0x3], + r500_fs_swiz[(inst >> 26) & 0x3], + r500_fs_swiz[(inst >> 28) & 0x3], + r500_fs_swiz[(inst >> 30) & 0x3]); inst = fs->instructions[i].inst3; debug_printf(" 3: TEX_DXDY 0x%08x\n", inst); diff --git a/src/gallium/drivers/r300/r300_state_shader.c b/src/gallium/drivers/r300/r300_state_shader.c index 7629bfb1f43..db84dbdc4ea 100644 --- a/src/gallium/drivers/r300/r300_state_shader.c +++ b/src/gallium/drivers/r300/r300_state_shader.c @@ -133,6 +133,14 @@ static uint32_t r500_rgba_swiz(struct tgsi_full_src_register* reg) } } +static uint32_t r500_strq_swiz(struct tgsi_full_src_register* reg) +{ + return reg->SrcRegister.SwizzleX | + (reg->SrcRegister.SwizzleY << 2) | + (reg->SrcRegister.SwizzleZ << 4) | + (reg->SrcRegister.SwizzleW << 6); +} + static INLINE uint32_t r500_rgb_swiz(struct tgsi_full_src_register* reg) { /* Only the first 9 bits... */ @@ -184,16 +192,19 @@ static INLINE void r500_emit_tex(struct r500_fragment_shader* fs, int i = fs->instruction_count; fs->instructions[i].inst0 = R500_INST_TYPE_TEX | + R500_TEX_WMASK(dst->DstRegister.WriteMask) | R500_INST_TEX_SEM_WAIT; fs->instructions[i].inst1 = R500_TEX_ID(0) | R500_TEX_SEM_ACQUIRE | R500_TEX_IGNORE_UNCOVERED | R500_TEX_INST_PROJ; fs->instructions[i].inst2 = R500_TEX_SRC_ADDR(r300_fs_src(assembler, &src->SrcRegister)) | - R500_SWIZ_TEX_STRQ(r500_rgba_swiz(src)) | + R500_SWIZ_TEX_STRQ(r500_strq_swiz(src)) | R500_TEX_DST_ADDR(r300_fs_dst(assembler, &dst->DstRegister)) | R500_TEX_DST_R_SWIZ_R | R500_TEX_DST_G_SWIZ_G | R500_TEX_DST_B_SWIZ_B | R500_TEX_DST_A_SWIZ_A; + + fs->instruction_count++; } static void r500_fs_instruction(struct r500_fragment_shader* fs, diff --git a/src/gallium/drivers/r300/r300_state_shader.h b/src/gallium/drivers/r300/r300_state_shader.h index a74dce47641..5dd35844591 100644 --- a/src/gallium/drivers/r300/r300_state_shader.h +++ b/src/gallium/drivers/r300/r300_state_shader.h @@ -41,17 +41,19 @@ #define R500_SWIZ_MOD_ABS 2 #define R500_SWIZ_MOD_NEG_ABS 3 /* Swizzles for inst2 */ -#define R500_SWIZ_TEX_STRQ(x) (x << 8) -#define R500_SWIZ_TEX_RGBA(x) (x << 24) +#define R500_SWIZ_TEX_STRQ(x) ((x) << 8) +#define R500_SWIZ_TEX_RGBA(x) ((x) << 24) /* Swizzles for inst3 */ -#define R500_SWIZ_RGB_A(x) (x << 2) -#define R500_SWIZ_RGB_B(x) (x << 15) +#define R500_SWIZ_RGB_A(x) ((x) << 2) +#define R500_SWIZ_RGB_B(x) ((x) << 15) /* Swizzles for inst4 */ -#define R500_SWIZ_ALPHA_A(x) (x << 14) -#define R500_SWIZ_ALPHA_B(x) (x << 21) +#define R500_SWIZ_ALPHA_A(x) ((x) << 14) +#define R500_SWIZ_ALPHA_B(x) ((x) << 21) /* Swizzle for inst5 */ -#define R500_SWIZ_RGBA_C(x) (x << 14) -#define R500_SWIZ_ALPHA_C(x) (x << 27) +#define R500_SWIZ_RGBA_C(x) ((x) << 14) +#define R500_SWIZ_ALPHA_C(x) ((x) << 27) +/* Writemasks */ +#define R500_TEX_WMASK(x) ((x) << 11) /* Temporary struct used to hold assembly state while putting together * fragment programs. */