ac/nir: pass the variable location to store_tcs_outputs
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 5 Oct 2020 08:22:00 +0000 (10:22 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 12 Oct 2020 07:23:25 +0000 (09:23 +0200)
It's actually simpler for the backend to know the variable location.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7022>

src/amd/llvm/ac_nir_to_llvm.c
src/amd/llvm/ac_shader_abi.h
src/amd/vulkan/radv_nir_to_llvm.c
src/gallium/drivers/radeonsi/si_shader_llvm_tess.c

index c125f7a..2ec2ad0 100644 (file)
@@ -2166,9 +2166,10 @@ static void visit_store_output(struct ac_nir_context *ctx, nir_intrinsic_instr *
    if (ctx->stage == MESA_SHADER_TESS_CTRL) {
       nir_src *vertex_index_src = nir_get_io_vertex_index_src(instr);
       LLVMValueRef vertex_index = vertex_index_src ? get_src(ctx, *vertex_index_src) : NULL;
+      unsigned location = nir_intrinsic_io_semantics(instr).location;
 
       ctx->abi->store_tcs_outputs(ctx->abi, vertex_index, indir_index, src,
-                                  writemask, component, base);
+                                  writemask, component, location, base);
       return;
    }
 
index a50ea1b..4723f61 100644 (file)
@@ -91,7 +91,7 @@ struct ac_shader_abi {
    void (*store_tcs_outputs)(struct ac_shader_abi *abi,
                              LLVMValueRef vertex_index, LLVMValueRef param_index,
                              LLVMValueRef src, unsigned writemask,
-                             unsigned component, unsigned driver_location);
+                             unsigned component, unsigned location, unsigned driver_location);
 
    LLVMValueRef (*load_tess_coord)(struct ac_shader_abi *abi);
 
index a0d87eb..7d382c6 100644 (file)
@@ -548,10 +548,10 @@ store_tcs_output(struct ac_shader_abi *abi,
                 LLVMValueRef src,
                 unsigned writemask,
                 unsigned component,
+                unsigned location,
                 unsigned driver_location)
 {
        struct radv_shader_context *ctx = radv_shader_context_from_abi(abi);
-       const unsigned location = driver_location;
        const bool is_patch = vertex_index == NULL;
        LLVMValueRef dw_addr;
        LLVMValueRef stride = NULL;
index 5bb4b3c..97e5db4 100644 (file)
@@ -463,7 +463,7 @@ static LLVMValueRef si_nir_load_input_tes(struct ac_shader_abi *abi, LLVMTypeRef
 static void si_nir_store_output_tcs(struct ac_shader_abi *abi,
                                     LLVMValueRef vertex_index, LLVMValueRef param_index,
                                     LLVMValueRef src, unsigned writemask,
-                                    unsigned component, unsigned driver_location)
+                                    unsigned component, unsigned location, unsigned driver_location)
 {
    struct si_shader_context *ctx = si_shader_context_from_abi(abi);
    struct si_shader_info *info = &ctx->shader->selector->info;