mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-14 06:50:28 +01:00
r5xx: Fragprog shader now handles TEX/TXP correctly.
This commit is contained in:
parent
029cb1fd0f
commit
b15c49e59b
1 changed files with 24 additions and 5 deletions
|
|
@ -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
|
||||
|
|
@ -495,12 +495,31 @@ static GLboolean parse_program(struct r500_fragment_program *fp)
|
|||
| R500_ALU_RGBA_ALPHA_MOD_C_NEG;
|
||||
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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue