summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-11-08 14:20:23 +1100
committerTimothy Arceri <[email protected]>2017-12-04 12:52:19 +1100
commitccd1810bbaf38ee31bd973f903bc9871cc8b1171 (patch)
treec4c5d5511aefccdd6790386983c7fb82cad560ab /src/gallium
parentcaf15ce67001f09e4258ac545b7ed655eb63211c (diff)
ac: add si_nir_load_input_gs() to the abi
V2: make use of driver_location and don't expose NIR to the ABI. Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c1
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_internal.h9
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_nir.c20
3 files changed, 30 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 950207b3034..a94c2af8709 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -5800,6 +5800,7 @@ static bool si_compile_tgsi_main(struct si_shader_context *ctx,
break;
case PIPE_SHADER_GEOMETRY:
bld_base->emit_fetch_funcs[TGSI_FILE_INPUT] = fetch_input_gs;
+ ctx->abi.load_inputs = si_nir_load_input_gs;
ctx->abi.emit_vertex = si_llvm_emit_vertex;
ctx->abi.emit_outputs = si_llvm_emit_gs_epilogue;
bld_base->emit_epilogue = si_tgsi_emit_gs_epilogue;
diff --git a/src/gallium/drivers/radeonsi/si_shader_internal.h b/src/gallium/drivers/radeonsi/si_shader_internal.h
index a548cf11f0b..f50a022db85 100644
--- a/src/gallium/drivers/radeonsi/si_shader_internal.h
+++ b/src/gallium/drivers/radeonsi/si_shader_internal.h
@@ -332,4 +332,13 @@ void si_llvm_load_input_fs(
bool si_nir_build_llvm(struct si_shader_context *ctx, struct nir_shader *nir);
+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);
+
#endif
diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c
index 979361a74ee..1b502b33e91 100644
--- a/src/gallium/drivers/radeonsi/si_shader_nir.c
+++ b/src/gallium/drivers/radeonsi/si_shader_nir.c
@@ -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,