diff options
author | Marek Olšák <[email protected]> | 2013-02-02 04:59:27 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2013-02-06 14:45:16 +0100 |
commit | ae8696c7eeae939428a52c0d5113b5b08b049395 (patch) | |
tree | 5b6502bc685284538925751c09c8e8e92ee1ada0 /src/gallium/drivers/r300/compiler | |
parent | 499f7de12e3484f75d30dd314b00c76cb37d8d9f (diff) |
r300/compiler: add support for saturate output modifier in r500 vertex shaders
The GLSL compiler can simplify clamp(v,0,1) to saturate. The state tracker
doesn't use it yet, but it will.
Reviewed-by: Tom Stellard <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r300/compiler')
-rw-r--r-- | src/gallium/drivers/r300/compiler/r3xx_vertprog.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/gallium/drivers/r300/compiler/r3xx_vertprog.c b/src/gallium/drivers/r300/compiler/r3xx_vertprog.c index 94733d7367f..9c481f0d0c5 100644 --- a/src/gallium/drivers/r300/compiler/r3xx_vertprog.c +++ b/src/gallium/drivers/r300/compiler/r3xx_vertprog.c @@ -193,7 +193,8 @@ static void ei_vector1(struct r300_vertex_program_code *vp, 0, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + t_dst_class(vpi->DstReg.File), + vpi->SaturateMode == RC_SATURATE_ZERO_ONE); inst[1] = t_src(vp, &vpi->SrcReg[0]); inst[2] = __CONST(0, RC_SWIZZLE_ZERO); inst[3] = __CONST(0, RC_SWIZZLE_ZERO); @@ -209,7 +210,8 @@ static void ei_vector2(struct r300_vertex_program_code *vp, 0, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + t_dst_class(vpi->DstReg.File), + vpi->SaturateMode == RC_SATURATE_ZERO_ONE); inst[1] = t_src(vp, &vpi->SrcReg[0]); inst[2] = t_src(vp, &vpi->SrcReg[1]); inst[3] = __CONST(1, RC_SWIZZLE_ZERO); @@ -225,7 +227,8 @@ static void ei_math1(struct r300_vertex_program_code *vp, 0, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + t_dst_class(vpi->DstReg.File), + vpi->SaturateMode == RC_SATURATE_ZERO_ONE); inst[1] = t_src_scalar(vp, &vpi->SrcReg[0]); inst[2] = __CONST(0, RC_SWIZZLE_ZERO); inst[3] = __CONST(0, RC_SWIZZLE_ZERO); @@ -242,7 +245,8 @@ static void ei_lit(struct r300_vertex_program_code *vp, 0, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + t_dst_class(vpi->DstReg.File), + vpi->SaturateMode == RC_SATURATE_ZERO_ONE); /* NOTE: Users swizzling might not work. */ inst[1] = PVS_SRC_OPERAND(t_src_index(vp, &vpi->SrcReg[0]), t_swizzle(GET_SWZ(vpi->SrcReg[0].Swizzle, 0)), // X t_swizzle(GET_SWZ(vpi->SrcReg[0].Swizzle, 3)), // W @@ -309,14 +313,16 @@ static void ei_mad(struct r300_vertex_program_code *vp, 1, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + t_dst_class(vpi->DstReg.File), + vpi->SaturateMode == RC_SATURATE_ZERO_ONE); } else { inst[0] = PVS_OP_DST_OPERAND(VE_MULTIPLY_ADD, 0, 0, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + t_dst_class(vpi->DstReg.File), + vpi->SaturateMode == RC_SATURATE_ZERO_ONE); /* Arguments with constant swizzles still count as a unique * temporary, so we should make sure these arguments share a @@ -349,7 +355,8 @@ static void ei_pow(struct r300_vertex_program_code *vp, 0, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), - t_dst_class(vpi->DstReg.File)); + t_dst_class(vpi->DstReg.File), + vpi->SaturateMode == RC_SATURATE_ZERO_ONE); inst[1] = t_src_scalar(vp, &vpi->SrcReg[0]); inst[2] = __CONST(0, RC_SWIZZLE_ZERO); inst[3] = t_src_scalar(vp, &vpi->SrcReg[1]); @@ -380,7 +387,7 @@ static void translate_vertex_program(struct radeon_compiler *c, void *user) if (info->HasDstReg) { /* Neither is Saturate. */ - if (vpi->SaturateMode != RC_SATURATE_NONE) { + if (vpi->SaturateMode != RC_SATURATE_NONE && !c->is_r500) { rc_error(&compiler->Base, "Vertex program does not support the Saturate " "modifier (yet).\n"); } |