r300-gallium: r500-fs: More texture fixes.

This commit is contained in:
Corbin Simpson
2009-03-11 15:05:52 -07:00
parent c4c1774bbb
commit cec2170632
3 changed files with 30 additions and 17 deletions

View File

@@ -200,15 +200,15 @@ void r500_fs_dump(struct r500_fragment_shader* fs)
debug_printf(" 2: TEX_ADDR 0x%08x: " debug_printf(" 2: TEX_ADDR 0x%08x: "
"src: %d%s %s/%s/%s/%s dst: %d%s %s/%s/%s/%s\n", "src: %d%s %s/%s/%s/%s dst: %d%s %s/%s/%s/%s\n",
inst, inst & 0x7f, inst & (1 << 7) ? "(rel)" : "", inst, inst & 0x7f, inst & (1 << 7) ? "(rel)" : "",
r500_fs_swiz[(inst >> 8) & 0x7], r500_fs_swiz[(inst >> 8) & 0x3],
r500_fs_swiz[(inst >> 10) & 0x7], r500_fs_swiz[(inst >> 10) & 0x3],
r500_fs_swiz[(inst >> 12) & 0x7], r500_fs_swiz[(inst >> 12) & 0x3],
r500_fs_swiz[(inst >> 14) & 0x7], r500_fs_swiz[(inst >> 14) & 0x3],
(inst >> 16) & 0x7f, inst & (1 << 23) ? "(rel)" : "", (inst >> 16) & 0x7f, inst & (1 << 23) ? "(rel)" : "",
r500_fs_swiz[(inst >> 24) & 0x7], r500_fs_swiz[(inst >> 24) & 0x3],
r500_fs_swiz[(inst >> 26) & 0x7], r500_fs_swiz[(inst >> 26) & 0x3],
r500_fs_swiz[(inst >> 28) & 0x7], r500_fs_swiz[(inst >> 28) & 0x3],
r500_fs_swiz[(inst >> 30) & 0x7]); r500_fs_swiz[(inst >> 30) & 0x3]);
inst = fs->instructions[i].inst3; inst = fs->instructions[i].inst3;
debug_printf(" 3: TEX_DXDY 0x%08x\n", inst); debug_printf(" 3: TEX_DXDY 0x%08x\n", inst);

View File

@@ -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) static INLINE uint32_t r500_rgb_swiz(struct tgsi_full_src_register* reg)
{ {
/* Only the first 9 bits... */ /* 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; int i = fs->instruction_count;
fs->instructions[i].inst0 = R500_INST_TYPE_TEX | fs->instructions[i].inst0 = R500_INST_TYPE_TEX |
R500_TEX_WMASK(dst->DstRegister.WriteMask) |
R500_INST_TEX_SEM_WAIT; R500_INST_TEX_SEM_WAIT;
fs->instructions[i].inst1 = R500_TEX_ID(0) | fs->instructions[i].inst1 = R500_TEX_ID(0) |
R500_TEX_SEM_ACQUIRE | R500_TEX_IGNORE_UNCOVERED | R500_TEX_SEM_ACQUIRE | R500_TEX_IGNORE_UNCOVERED |
R500_TEX_INST_PROJ; R500_TEX_INST_PROJ;
fs->instructions[i].inst2 = fs->instructions[i].inst2 =
R500_TEX_SRC_ADDR(r300_fs_src(assembler, &src->SrcRegister)) | 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_ADDR(r300_fs_dst(assembler, &dst->DstRegister)) |
R500_TEX_DST_R_SWIZ_R | R500_TEX_DST_G_SWIZ_G | R500_TEX_DST_R_SWIZ_R | R500_TEX_DST_G_SWIZ_G |
R500_TEX_DST_B_SWIZ_B | R500_TEX_DST_A_SWIZ_A; 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, static void r500_fs_instruction(struct r500_fragment_shader* fs,

View File

@@ -41,17 +41,19 @@
#define R500_SWIZ_MOD_ABS 2 #define R500_SWIZ_MOD_ABS 2
#define R500_SWIZ_MOD_NEG_ABS 3 #define R500_SWIZ_MOD_NEG_ABS 3
/* Swizzles for inst2 */ /* Swizzles for inst2 */
#define R500_SWIZ_TEX_STRQ(x) (x << 8) #define R500_SWIZ_TEX_STRQ(x) ((x) << 8)
#define R500_SWIZ_TEX_RGBA(x) (x << 24) #define R500_SWIZ_TEX_RGBA(x) ((x) << 24)
/* Swizzles for inst3 */ /* Swizzles for inst3 */
#define R500_SWIZ_RGB_A(x) (x << 2) #define R500_SWIZ_RGB_A(x) ((x) << 2)
#define R500_SWIZ_RGB_B(x) (x << 15) #define R500_SWIZ_RGB_B(x) ((x) << 15)
/* Swizzles for inst4 */ /* Swizzles for inst4 */
#define R500_SWIZ_ALPHA_A(x) (x << 14) #define R500_SWIZ_ALPHA_A(x) ((x) << 14)
#define R500_SWIZ_ALPHA_B(x) (x << 21) #define R500_SWIZ_ALPHA_B(x) ((x) << 21)
/* Swizzle for inst5 */ /* Swizzle for inst5 */
#define R500_SWIZ_RGBA_C(x) (x << 14) #define R500_SWIZ_RGBA_C(x) ((x) << 14)
#define R500_SWIZ_ALPHA_C(x) (x << 27) #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 /* Temporary struct used to hold assembly state while putting together
* fragment programs. */ * fragment programs. */