swr: color interpolation is also supposed to get perspective division
authorIlia Mirkin <imirkin@alum.mit.edu>
Mon, 21 Nov 2016 02:20:08 +0000 (21:20 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Wed, 23 Nov 2016 01:27:20 +0000 (20:27 -0500)
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
src/gallium/drivers/swr/swr_shader.cpp

index 428c9b3..294a568 100644 (file)
@@ -457,7 +457,8 @@ BuilderSWR::CompileFS(struct swr_context *ctx, swr_jit_fs_key &key)
 
       // load/compute w
       Value *vw = nullptr, *pAttribs;
-      if (interpMode == TGSI_INTERPOLATE_PERSPECTIVE) {
+      if (interpMode == TGSI_INTERPOLATE_PERSPECTIVE ||
+          interpMode == TGSI_INTERPOLATE_COLOR) {
          pAttribs = pPerspAttribs;
          switch (interpLoc) {
          case TGSI_INTERPOLATE_LOC_CENTER:
@@ -596,7 +597,8 @@ BuilderSWR::CompileFS(struct swr_context *ctx, swr_jit_fs_key &key)
                Value *interp1 = FMUL(vb, vj);
                interp = FADD(interp, interp1);
                interp = FADD(interp, vc);
-               if (interpMode == TGSI_INTERPOLATE_PERSPECTIVE)
+               if (interpMode == TGSI_INTERPOLATE_PERSPECTIVE ||
+                   interpMode == TGSI_INTERPOLATE_COLOR)
                   interp = FMUL(interp, vw);
                inputs[attrib][channel] = wrap(interp);
             }