ac/llvm: prepare for passing VS->TCS IO via VGPRs

- bump AC_MAX_ARGS
- add vertex_index_is_invoc_id parameter into load_tess_varyings

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7623>
This commit is contained in:
Marek Olšák
2020-11-14 17:20:36 -05:00
committed by Marge Bot
parent 98b2aacfbf
commit 6f13034265
5 changed files with 17 additions and 7 deletions

View File

@@ -51,7 +51,7 @@ struct ac_arg {
bool used;
};
#define AC_MAX_ARGS 128
#define AC_MAX_ARGS 384 /* including all VS->TCS IO */
struct ac_shader_args {
/* Info on how to declare arguments */

View File

@@ -3212,10 +3212,17 @@ static LLVMValueRef visit_load(struct ac_nir_context *ctx, nir_intrinsic_instr *
if (ctx->stage == MESA_SHADER_TESS_CTRL ||
(ctx->stage == MESA_SHADER_TESS_EVAL && !is_output)) {
bool vertex_index_is_invoc_id =
vertex_index_src &&
vertex_index_src->ssa->parent_instr->type == nir_instr_type_intrinsic &&
nir_instr_as_intrinsic(vertex_index_src->ssa->parent_instr)->intrinsic ==
nir_intrinsic_load_invocation_id;
LLVMValueRef result = ctx->abi->load_tess_varyings(ctx->abi, component_type,
vertex_index, indir_index,
base, component,
count, !is_output);
count, !is_output,
vertex_index_is_invoc_id);
if (instr->dest.ssa.bit_size == 16) {
result = ac_to_integer(&ctx->ac, result);
result = LLVMBuildTrunc(ctx->ac.builder, result, dest_type, "");

View File

@@ -86,7 +86,7 @@ struct ac_shader_abi {
LLVMValueRef vertex_index, LLVMValueRef param_index,
unsigned driver_location, unsigned component,
unsigned num_components,
bool load_inputs);
bool load_inputs, bool vertex_index_is_invoc_id);
void (*store_tcs_outputs)(struct ac_shader_abi *abi,
LLVMValueRef vertex_index, LLVMValueRef param_index,

View File

@@ -509,7 +509,8 @@ load_tcs_varyings(struct ac_shader_abi *abi,
unsigned driver_location,
unsigned component,
unsigned num_components,
bool load_input)
bool load_input,
bool vertex_index_is_invoc_id)
{
struct radv_shader_context *ctx = radv_shader_context_from_abi(abi);
LLVMValueRef dw_addr, stride;
@@ -619,7 +620,8 @@ load_tes_input(struct ac_shader_abi *abi,
unsigned driver_location,
unsigned component,
unsigned num_components,
bool load_input)
bool load_input,
bool vertex_index_is_invoc_id)
{
struct radv_shader_context *ctx = radv_shader_context_from_abi(abi);
LLVMValueRef buf_addr;

View File

@@ -381,7 +381,8 @@ void si_llvm_preload_tes_rings(struct si_shader_context *ctx)
static LLVMValueRef si_nir_load_tcs_varyings(struct ac_shader_abi *abi, LLVMTypeRef type,
LLVMValueRef vertex_index, LLVMValueRef param_index,
unsigned driver_location, unsigned component,
unsigned num_components, bool load_input)
unsigned num_components, bool load_input,
bool vertex_index_is_invoc_id)
{
struct si_shader_context *ctx = si_shader_context_from_abi(abi);
struct si_shader_info *info = &ctx->shader->selector->info;
@@ -426,7 +427,7 @@ static LLVMValueRef si_nir_load_input_tes(struct ac_shader_abi *abi, LLVMTypeRef
LLVMValueRef vertex_index, LLVMValueRef param_index,
unsigned driver_location, unsigned component,
unsigned num_components,
bool load_input)
bool load_input, bool vertex_index_is_invoc_id)
{
struct si_shader_context *ctx = si_shader_context_from_abi(abi);
struct si_shader_info *info = &ctx->shader->selector->info;