ac: add si_nir_load_input_gs() to the abi
[mesa.git] / src / gallium / drivers / radeonsi / si_shader_nir.c
index 979361a74ee9f994ed65e92a7df7ae8e68b36efa..1b502b33e91dc06baa6f5e9fee1e70b4101889a1 100644 (file)
@@ -488,6 +488,26 @@ static void declare_nir_input_fs(struct si_shader_context *ctx,
        si_llvm_load_input_fs(ctx, input_index, out);
 }
 
+LLVMValueRef si_nir_load_input_gs(struct ac_shader_abi *abi,
+                                 unsigned location,
+                                 unsigned driver_location,
+                                 unsigned component,
+                                 unsigned num_components,
+                                 unsigned vertex_index,
+                                 unsigned const_index,
+                                 LLVMTypeRef type)
+{
+       struct si_shader_context *ctx = si_shader_context_from_abi(abi);
+
+       LLVMValueRef value[4];
+       for (unsigned i = component; i < num_components + component; i++) {
+               value[i] = si_llvm_load_input_gs(&ctx->abi, driver_location  / 4,
+                                                vertex_index, type, i);
+       }
+
+       return ac_build_varying_gather_values(&ctx->ac, value, num_components, component);
+}
+
 static LLVMValueRef
 si_nir_load_sampler_desc(struct ac_shader_abi *abi,
                         unsigned descriptor_set, unsigned base_index,