diff options
author | Corbin Simpson <MostAwesomeDude@gmail.com> | 2008-08-17 14:06:47 -0700 |
---|---|---|
committer | Corbin Simpson <MostAwesomeDude@gmail.com> | 2008-08-17 22:36:17 -0700 |
commit | c5d25c85093f089cc58c520785844fc021a09612 (patch) | |
tree | 24c6fcf35f15820096b7b25b26417bdc93f17435 /src/mesa/drivers/dri/r300/radeon_program_alu.c | |
parent | b7ff70e16a5bd468c76b75c2b557897a827fae73 (diff) |
r5xx: Add DDX and DDY instructions.
Signed-off-by: Corbin Simpson <MostAwesomeDude@gmail.com>
Diffstat (limited to 'src/mesa/drivers/dri/r300/radeon_program_alu.c')
-rw-r--r-- | src/mesa/drivers/dri/r300/radeon_program_alu.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/r300/radeon_program_alu.c b/src/mesa/drivers/dri/r300/radeon_program_alu.c index e0a2bd0e93..1ef71e74dc 100644 --- a/src/mesa/drivers/dri/r300/radeon_program_alu.c +++ b/src/mesa/drivers/dri/r300/radeon_program_alu.c @@ -629,3 +629,30 @@ GLboolean radeonTransformTrigScale(struct radeon_transform_context* t, return GL_TRUE; } + +/** + * Rewrite DDX/DDY instructions to properly work with r5xx shaders. + * The r5xx MDH/MDV instruction provides per-quad partial derivatives. + * It takes the form A*B+C. A and C are set by setting src0. B should be -1. + * + * @warning This explicitly changes the form of DDX and DDY! + */ + +GLboolean radeonTransformDeriv(struct radeon_transform_context* t, + struct prog_instruction* inst, + void* unused) +{ + if (inst->Opcode != OPCODE_DDX && inst->Opcode != OPCODE_DDY) + return GL_FALSE; + + struct prog_src_register B = inst->SrcReg[1]; + + B.Swizzle = MAKE_SWIZZLE4(SWIZZLE_ONE, SWIZZLE_ONE, + SWIZZLE_ONE, SWIZZLE_ONE); + B.NegateBase = NEGATE_XYZW; + + emit2(t->Program, inst->Opcode, inst->SaturateMode, inst->DstReg, + inst->SrcReg[0], B); + + return GL_TRUE; +} |