summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-05-30 16:47:34 -0600
committerBrian Paul <[email protected]>2012-05-31 12:54:04 -0600
commit8009fca501a021cbaf9b25e01ff3a7793cc2c6cb (patch)
tree237502836c7d648d8a6a39fa58b9547dbf8b8f52 /src/gallium
parentdff36e900c645401b26c9a44106459e96ee7a24d (diff)
svga: fix saturated TEX instructions
TEX instructions can't do saturation. Do the TEX into a temp reg w/out saturation, then do a MOV_SAT. Reviewed-by: Jakob Bornecrantz <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/svga/svga_tgsi_insn.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c b/src/gallium/drivers/svga/svga_tgsi_insn.c
index a68912608bc..64dfa557539 100644
--- a/src/gallium/drivers/svga/svga_tgsi_insn.c
+++ b/src/gallium/drivers/svga/svga_tgsi_insn.c
@@ -1628,10 +1628,12 @@ static boolean emit_tex(struct svga_shader_emitter *emit,
emit->key.fkey.tex[unit].swizzle_b != PIPE_SWIZZLE_BLUE ||
emit->key.fkey.tex[unit].swizzle_a != PIPE_SWIZZLE_ALPHA);
- /* If doing compare processing or tex swizzle, need to put fetched color into
- * a temporary so it can be used as a source later on.
+ boolean saturate = insn->Instruction.Saturate != TGSI_SAT_NONE;
+
+ /* If doing compare processing or tex swizzle or saturation, we need to put
+ * the fetched color into a temporary so it can be used as a source later on.
*/
- if (compare || swizzle) {
+ if (compare || swizzle || saturate) {
tex_result = get_temp( emit );
}
else {
@@ -1658,7 +1660,7 @@ static boolean emit_tex(struct svga_shader_emitter *emit,
if (compare) {
SVGA3dShaderDestToken dst2;
- if (swizzle)
+ if (swizzle || saturate)
dst2 = tex_result;
else
dst2 = dst;
@@ -1710,8 +1712,13 @@ static boolean emit_tex(struct svga_shader_emitter *emit,
}
}
- if (swizzle) {
- /* swizzle from tex_result to dst */
+ if (saturate && !swizzle) {
+ /* MOV_SAT real_dst, dst */
+ if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ), dst, src(tex_result) ))
+ return FALSE;
+ }
+ else if (swizzle) {
+ /* swizzle from tex_result to dst (handles saturation too, if any) */
emit_tex_swizzle(emit,
dst, src(tex_result),
emit->key.fkey.tex[unit].swizzle_r,