llvmpipe: Implement saturation.
authorJosé Fonseca <jfonseca@vmware.com>
Wed, 19 Aug 2009 08:34:53 +0000 (09:34 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Sat, 29 Aug 2009 08:21:35 +0000 (09:21 +0100)
src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c

index 6561155bfd7c34b3d2c10cabd87fd36830e1373b..805d9fd4b24a4d82fdcec08e9caef3029b180cbc 100644 (file)
@@ -199,12 +199,17 @@ emit_store(
       break;
 
    case TGSI_SAT_ZERO_ONE:
-      /* assert( 0 ); */
+      value = lp_build_max(&bld->base, value, bld->base.zero);
+      value = lp_build_min(&bld->base, value, bld->base.one);
       break;
 
    case TGSI_SAT_MINUS_PLUS_ONE:
-      assert( 0 );
+      value = lp_build_max(&bld->base, value, lp_build_const_uni(bld->base.type, -1.0));
+      value = lp_build_min(&bld->base, value, bld->base.one);
       break;
+
+   default:
+      assert(0);
    }
 
    switch( reg->DstRegister.File ) {