nir: lower SYSTEM_VALUE_BARYCENTRIC_* to nir_load_barycentric()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 24 Jan 2020 15:13:01 +0000 (16:13 +0100)
committerMarge Bot <eric+marge@anholt.net>
Wed, 29 Jan 2020 09:49:50 +0000 (09:49 +0000)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3578>

src/compiler/nir/nir_lower_system_values.c

index b99ae406ce4ea722291da24bf171a6e5395b1960..bc9d23cf52d4e7f06864b7764b001cd38dac0a6a 100644 (file)
@@ -270,6 +270,34 @@ lower_system_value_instr(nir_builder *b, nir_instr *instr, void *_state)
       case SYSTEM_VALUE_GLOBAL_GROUP_SIZE:
          return build_global_group_size(b, bit_size);
 
+      case SYSTEM_VALUE_BARYCENTRIC_LINEAR_PIXEL:
+         return nir_load_barycentric(b, nir_intrinsic_load_barycentric_pixel,
+                                     INTERP_MODE_NOPERSPECTIVE);
+
+      case SYSTEM_VALUE_BARYCENTRIC_LINEAR_CENTROID:
+         return nir_load_barycentric(b, nir_intrinsic_load_barycentric_centroid,
+                                     INTERP_MODE_NOPERSPECTIVE);
+
+      case SYSTEM_VALUE_BARYCENTRIC_LINEAR_SAMPLE:
+         return nir_load_barycentric(b, nir_intrinsic_load_barycentric_sample,
+                                     INTERP_MODE_NOPERSPECTIVE);
+
+      case SYSTEM_VALUE_BARYCENTRIC_PERSP_PIXEL:
+         return nir_load_barycentric(b, nir_intrinsic_load_barycentric_pixel,
+                                     INTERP_MODE_SMOOTH);
+
+      case SYSTEM_VALUE_BARYCENTRIC_PERSP_CENTROID:
+         return nir_load_barycentric(b, nir_intrinsic_load_barycentric_centroid,
+                                     INTERP_MODE_SMOOTH);
+
+      case SYSTEM_VALUE_BARYCENTRIC_PERSP_SAMPLE:
+         return nir_load_barycentric(b, nir_intrinsic_load_barycentric_sample,
+                                     INTERP_MODE_SMOOTH);
+
+      case SYSTEM_VALUE_BARYCENTRIC_PULL_MODEL:
+         return nir_load_barycentric(b, nir_intrinsic_load_barycentric_model,
+                                     INTERP_MODE_NONE);
+
       default:
          break;
       }