From f1ae5d4b4471108049080b34c482a083ae74860a Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 14 Jun 2008 19:32:33 -0700 Subject: [PATCH] r5xx: Enable fragment.position, partial ARB_shadow. 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 | 18 +++++------ .../drivers/dri/r300/r500_fragprog_emit.c | 30 +++++++++++-------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.c b/src/mesa/drivers/dri/r300/r500_fragprog.c index 0483c09ba07..5d72ec2784f 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/r500_fragprog.c @@ -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 } diff --git a/src/mesa/drivers/dri/r300/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/r500_fragprog_emit.c index 59c90486531..e1ad342690b 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/r500_fragprog_emit.c @@ -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; } -- 2.30.2