[Mesa-dev] [PATCH v2 01/12] radeonsi/nir: add interpolate at intrinsics to scan_instruction()

Timothy Arceri tarceri at itsqueeze.com
Tue Jan 30 03:55:27 UTC 2018


V2: use the uses_*_opcode_interp_* flags
---
 src/gallium/drivers/radeonsi/si_shader_nir.c | 30 ++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c
index 453d31bd13..6368b71206 100644
--- a/src/gallium/drivers/radeonsi/si_shader_nir.c
+++ b/src/gallium/drivers/radeonsi/si_shader_nir.c
@@ -127,6 +127,36 @@ static void scan_instruction(struct tgsi_shader_info *info,
 		case nir_intrinsic_ssbo_atomic_comp_swap:
 			info->writes_memory = true;
 			break;
+		case nir_intrinsic_interp_var_at_centroid:
+		case nir_intrinsic_interp_var_at_sample:
+		case nir_intrinsic_interp_var_at_offset: {
+			enum glsl_interp_mode interp =
+				intr->variables[0]->var->data.interpolation;
+			switch (interp) {
+			case INTERP_MODE_SMOOTH:
+			case INTERP_MODE_NONE:
+				if (intr->intrinsic == nir_intrinsic_interp_var_at_centroid)
+					info->uses_persp_opcode_interp_centroid = true;
+				else if (intr->intrinsic == nir_intrinsic_interp_var_at_sample)
+					info->uses_persp_opcode_interp_sample = true;
+				else
+					info->uses_persp_opcode_interp_offset = true;
+				break;
+			case INTERP_MODE_NOPERSPECTIVE:
+				if (intr->intrinsic == nir_intrinsic_interp_var_at_centroid)
+					info->uses_linear_opcode_interp_centroid = true;
+				else if (intr->intrinsic == nir_intrinsic_interp_var_at_sample)
+					info->uses_linear_opcode_interp_sample = true;
+				else
+					info->uses_linear_opcode_interp_offset = true;
+				break;
+			case INTERP_MODE_FLAT:
+				break;
+			default:
+				unreachable("Unsupported interpoation type");
+			}
+			break;
+		}
 		default:
 			break;
 		}
-- 
2.14.3



More information about the mesa-dev mailing list