summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorbin Simpson <MostAwesomeDude@gmail.com>2008-05-02 10:15:10 -0700
committerCorbin Simpson <MostAwesomeDude@gmail.com>2008-05-02 12:06:21 -0700
commitb15c49e59bdc149b978d2b35a4efcc99d15f16b2 (patch)
treeaac93d0f0a572ba349e708e59a9aeddd2d55163b
parent029cb1fd0f576dd7587bc306b126318fbfcdde2d (diff)
r5xx: Fragprog shader now handles TEX/TXP correctly.
-rw-r--r--src/mesa/drivers/dri/r300/r500_fragprog.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.c b/src/mesa/drivers/dri/r300/r500_fragprog.c
index b751a2aa83..f94b244232 100644
--- a/src/mesa/drivers/dri/r300/r500_fragprog.c
+++ b/src/mesa/drivers/dri/r300/r500_fragprog.c
@@ -110,7 +110,7 @@ static inline GLuint make_strq_swizzle(struct prog_src_register src) {
GLuint swiz = 0x0;
GLuint temp = src.Swizzle;
for (int i = 0; i < 4; i++) {
- swiz = (temp & 0x3) << i*2;
+ swiz += (temp & 0x3) << i*2;
temp >>= 3;
}
return swiz;
@@ -147,7 +147,7 @@ static GLuint make_src(struct r500_fragment_program *fp, struct prog_src_registe
GLuint reg;
switch (src.File) {
case PROGRAM_TEMPORARY:
- reg = src.Index + 1;
+ reg = (src.Index << 0x1) | 0x1;
break;
case PROGRAM_INPUT:
/* Ugly hack needed to work around Mesa;
@@ -170,7 +170,7 @@ static GLuint make_dest(struct r500_fragment_program *fp, struct prog_dst_regist
GLuint reg;
switch (dest.File) {
case PROGRAM_TEMPORARY:
- reg = dest.Index + 1;
+ reg = (dest.Index << 0x1) | 0x1;
break;
case PROGRAM_OUTPUT:
/* Eventually we may need to handle multiple
@@ -496,11 +496,30 @@ static GLboolean parse_program(struct r500_fragment_program *fp)
break;
case OPCODE_TEX:
src[0] = make_src(fp, fpi->SrcReg[0]);
+ fp->inst[counter].inst0 = R500_INST_TYPE_TEX | mask
+ | R500_INST_TEX_SEM_WAIT;
+ fp->inst[counter].inst1 = fpi->TexSrcUnit
+ | R500_TEX_INST_LD | R500_TEX_SEM_ACQUIRE | R500_TEX_IGNORE_UNCOVERED;
+ fp->inst[counter].inst2 = R500_TEX_SRC_ADDR(src[0])
+ /* | MAKE_SWIZ_TEX_STRQ(make_strq_swizzle(fpi->SrcReg[0])) */
+ | R500_TEX_SRC_S_SWIZ_R | R500_TEX_SRC_T_SWIZ_G
+ | R500_TEX_SRC_R_SWIZ_B | R500_TEX_SRC_Q_SWIZ_A
+ | R500_TEX_DST_ADDR(dest)
+ | R500_TEX_DST_R_SWIZ_R | R500_TEX_DST_G_SWIZ_G
+ | R500_TEX_DST_B_SWIZ_B | R500_TEX_DST_A_SWIZ_A;
+ fp->inst[counter].inst3 = 0x0;
+ fp->inst[counter].inst4 = 0x0;
+ fp->inst[counter].inst5 = 0x0;
+ break;
+ case OPCODE_TXP:
+ src[0] = make_src(fp, fpi->SrcReg[0]);
fp->inst[counter].inst0 = R500_INST_TYPE_TEX | mask;
fp->inst[counter].inst1 = fpi->TexSrcUnit
- | R500_TEX_INST_LD | R500_TEX_SEM_ACQUIRE;
+ | R500_TEX_INST_PROJ | R500_TEX_SEM_ACQUIRE | R500_TEX_IGNORE_UNCOVERED;
fp->inst[counter].inst2 = R500_TEX_SRC_ADDR(src[0])
- | MAKE_SWIZ_TEX_STRQ(make_strq_swizzle(fpi->SrcReg[0]))
+ /* | MAKE_SWIZ_TEX_STRQ(make_strq_swizzle(fpi->SrcReg[0])) */
+ | R500_TEX_SRC_S_SWIZ_R | R500_TEX_SRC_T_SWIZ_G
+ | R500_TEX_SRC_R_SWIZ_B | R500_TEX_SRC_Q_SWIZ_A
| R500_TEX_DST_ADDR(dest)
| R500_TEX_DST_R_SWIZ_R | R500_TEX_DST_G_SWIZ_G
| R500_TEX_DST_B_SWIZ_B | R500_TEX_DST_A_SWIZ_A;