summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2018-01-09 12:12:45 +1100
committerTimothy Arceri <[email protected]>2018-01-18 00:03:33 +1100
commit9622b445c87e6099a3cafe5b868fa5820dfdfd3f (patch)
tree459175bdf4fa8b914d09272354af0bc7920806d8 /src/gallium
parenta20016d8277f9cd68620784417a57ae227783a04 (diff)
ac/radeonsi: add tcs load outputs support
The code to load outputs is essentially the same as load inputs so we make the interface more generic to maximise code sharing. We will make use of the new support in the following patch. Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c42
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_internal.h3
2 files changed, 29 insertions, 16 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 35f82d8d634..8e91a454550 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -1212,16 +1212,17 @@ static LLVMValueRef fetch_input_tcs(
return lds_load(bld_base, tgsi2llvmtype(bld_base, type), swizzle, dw_addr);
}
-static LLVMValueRef si_nir_load_input_tcs(struct ac_shader_abi *abi,
- LLVMValueRef vertex_index,
- LLVMValueRef param_index,
- unsigned const_index,
- unsigned location,
- unsigned driver_location,
- unsigned component,
- unsigned num_components,
- bool is_patch,
- bool is_compact)
+static LLVMValueRef si_nir_load_tcs_varyings(struct ac_shader_abi *abi,
+ LLVMValueRef vertex_index,
+ LLVMValueRef param_index,
+ unsigned const_index,
+ unsigned location,
+ unsigned driver_location,
+ unsigned component,
+ unsigned num_components,
+ bool is_patch,
+ bool is_compact,
+ bool load_input)
{
struct si_shader_context *ctx = si_shader_context_from_abi(abi);
struct tgsi_shader_info *info = &ctx->shader->selector->info;
@@ -1230,8 +1231,18 @@ static LLVMValueRef si_nir_load_input_tcs(struct ac_shader_abi *abi,
driver_location = driver_location / 4;
- stride = get_tcs_in_vertex_dw_stride(ctx);
- dw_addr = get_tcs_in_current_patch_offset(ctx);
+ if (load_input) {
+ stride = get_tcs_in_vertex_dw_stride(ctx);
+ dw_addr = get_tcs_in_current_patch_offset(ctx);
+ } else {
+ if (is_patch) {
+ stride = NULL;
+ dw_addr = get_tcs_out_current_patch_data_offset(ctx);
+ } else {
+ stride = get_tcs_out_vertex_dw_stride(ctx);
+ dw_addr = get_tcs_out_current_patch_offset(ctx);
+ }
+ }
if (param_index) {
/* Add the constant index to the indirect index */
@@ -1302,7 +1313,8 @@ LLVMValueRef si_nir_load_input_tes(struct ac_shader_abi *abi,
unsigned component,
unsigned num_components,
bool is_patch,
- bool is_compact)
+ bool is_compact,
+ bool load_input)
{
struct si_shader_context *ctx = si_shader_context_from_abi(abi);
struct tgsi_shader_info *info = &ctx->shader->selector->info;
@@ -5987,7 +5999,7 @@ static bool si_compile_tgsi_main(struct si_shader_context *ctx,
break;
case PIPE_SHADER_TESS_CTRL:
bld_base->emit_fetch_funcs[TGSI_FILE_INPUT] = fetch_input_tcs;
- ctx->abi.load_tess_inputs = si_nir_load_input_tcs;
+ ctx->abi.load_tess_varyings = si_nir_load_tcs_varyings;
bld_base->emit_fetch_funcs[TGSI_FILE_OUTPUT] = fetch_output_tcs;
bld_base->emit_store = store_output_tcs;
ctx->abi.store_tcs_outputs = si_nir_store_output_tcs;
@@ -5997,7 +6009,7 @@ static bool si_compile_tgsi_main(struct si_shader_context *ctx,
break;
case PIPE_SHADER_TESS_EVAL:
bld_base->emit_fetch_funcs[TGSI_FILE_INPUT] = fetch_input_tes;
- ctx->abi.load_tess_inputs = si_nir_load_input_tes;
+ ctx->abi.load_tess_varyings = si_nir_load_input_tes;
ctx->abi.load_tess_coord = si_load_tess_coord;
ctx->abi.load_tess_level = si_load_tess_level;
ctx->abi.load_patch_vertices_in = si_load_patch_vertices_in;
diff --git a/src/gallium/drivers/radeonsi/si_shader_internal.h b/src/gallium/drivers/radeonsi/si_shader_internal.h
index 6b4acc51f9c..7306481ccd9 100644
--- a/src/gallium/drivers/radeonsi/si_shader_internal.h
+++ b/src/gallium/drivers/radeonsi/si_shader_internal.h
@@ -283,7 +283,8 @@ LLVMValueRef si_nir_load_input_tes(struct ac_shader_abi *abi,
unsigned component,
unsigned num_components,
bool is_patch,
- bool is_compact);
+ bool is_compact,
+ bool load_input);
LLVMValueRef si_llvm_load_input_gs(struct ac_shader_abi *abi,
unsigned input_index,