r5xx: Enable fragment.position, partial ARB_shadow.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Sun, 15 Jun 2008 02:32:33 +0000 (19:32 -0700)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Sun, 15 Jun 2008 02:32:33 +0000 (19:32 -0700)
I don't like PROGRAM_BUILTIN; could we either patch Mesa or just use a different constant?

src/mesa/drivers/dri/r300/r500_fragprog.c
src/mesa/drivers/dri/r300/r500_fragprog_emit.c

index 0483c09ba072a1a5a63b7c1436bc85701c9f4098..5d72ec2784facd9712975c366174f4ea9616f036 100644 (file)
@@ -65,21 +65,17 @@ static GLboolean transform_TEX(
                        tgt = radeonClauseInsertInstructions(context->compiler, context->dest,
                                context->dest->NumInstructions, 1);
 
-                       tgt->Opcode = OPCODE_MAD;
-                       tgt->DstReg = inst.DstReg;
+                       tgt->Opcode = OPCODE_MOV;
+                       tgt->DstReg.File = inst.DstReg.File;
+                       tgt->DstReg.Index = inst.DstReg.Index;
+                       tgt->DstReg.WriteMask = inst.DstReg.WriteMask;
                        tgt->SrcReg[0].File = PROGRAM_BUILTIN;
-                       tgt->SrcReg[0].Swizzle = SWIZZLE_0000;
-                       tgt->SrcReg[1].File = PROGRAM_BUILTIN;
-                       tgt->SrcReg[1].Swizzle = SWIZZLE_0000;
-                       tgt->SrcReg[2].File = PROGRAM_BUILTIN;
-                       tgt->SrcReg[2].Swizzle = comparefunc == GL_ALWAYS ? SWIZZLE_1111 : SWIZZLE_0000;
+                       tgt->SrcReg[0].Swizzle = comparefunc == GL_ALWAYS ? SWIZZLE_1111 : SWIZZLE_0000;
                        return GL_TRUE;
                }
 
-               int tempreg = radeonCompilerAllocateTemporary(context->compiler);
-
                inst.DstReg.File = PROGRAM_TEMPORARY;
-               inst.DstReg.Index = tempreg;
+               inst.DstReg.Index = radeonCompilerAllocateTemporary(context->compiler);
                inst.DstReg.WriteMask = WRITEMASK_XYZW;
        }
 
@@ -317,7 +313,7 @@ void r500TranslateFragmentShader(r300ContextPtr r300,
 
                radeonCompilerInit(&compiler.compiler, r300->radeon.glCtx, &fp->mesa_program.Base);
 
-               /* insert_WPOS_trailer(&compiler); */
+               insert_WPOS_trailer(&compiler);
 
                struct radeon_program_transformation transformations[1] = {
                        { &transform_TEX, &compiler }
index 59c904865319dc9dc70e800e7c6499671b774cbe..e1ad342690b43889fa3124df05c6b7b018aca755 100644 (file)
@@ -323,6 +323,9 @@ static GLuint make_src(struct r500_pfs_compile_state *cs, struct prog_src_regist
                reg = emit_const4fv(cs,
                        cs->compiler->fp->mesa_program.Base.Parameters->ParameterValues[src.Index]);
                break;
+       case PROGRAM_BUILTIN:
+               reg = 0x0;
+               break;
        default:
                ERROR("Can't handle src.File %x\n", src.File);
                reg = 0x0;
@@ -335,18 +338,21 @@ static GLuint make_dest(struct r500_pfs_compile_state *cs, struct prog_dst_regis
        PROG_CODE;
        GLuint reg;
        switch (dest.File) {
-               case PROGRAM_TEMPORARY:
-                       reg = dest.Index + code->temp_reg_offset;
-                       break;
-               case PROGRAM_OUTPUT:
-                       /* Eventually we may need to handle multiple
-                        * rendering targets... */
-                       reg = dest.Index;
-                       break;
-               default:
-                       ERROR("Can't handle dest.File %x\n", dest.File);
-                       reg = 0x0;
-                       break;
+       case PROGRAM_TEMPORARY:
+               reg = dest.Index + code->temp_reg_offset;
+               break;
+       case PROGRAM_OUTPUT:
+               /* Eventually we may need to handle multiple
+                       * rendering targets... */
+               reg = dest.Index;
+               break;
+       case PROGRAM_BUILTIN:
+               reg = 0x0;
+               break;
+       default:
+               ERROR("Can't handle dest.File %x\n", dest.File);
+               reg = 0x0;
+               break;
        }
        return reg;
 }