ac/nir: add ac_shader_abi::inputs
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 8 Jun 2017 16:23:34 +0000 (18:23 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 31 Jul 2017 12:55:32 +0000 (14:55 +0200)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/amd/common/ac_nir_to_llvm.c
src/amd/common/ac_shader_abi.h

index e21e17de95c487450d2f0f0973ab9d635ebf3c67..1024101e67fa9baecffbb50302837c476eaf91da 100644 (file)
@@ -6156,6 +6156,8 @@ LLVMModuleRef ac_translate_nir_to_llvm(LLVMTargetMachineRef tm,
        if (nir->stage == MESA_SHADER_FRAGMENT)
                handle_fs_inputs_pre(&ctx, nir);
 
+       ctx.abi.inputs = &ctx.inputs[0];
+
        ac_nir_translate(&ctx.ac, &ctx.abi, nir, &ctx);
 
        LLVMBuildRetVoid(ctx.builder);
index e10550b8eb2ad6db232fe9a5c659cf621204ba2d..a872948dd019457362970a470bfef53de5054b25 100644 (file)
@@ -35,6 +35,13 @@ struct ac_shader_abi {
        LLVMValueRef draw_id;
        LLVMValueRef vertex_id;
        LLVMValueRef instance_id;
+
+       /* For VS and PS: pre-loaded shader inputs.
+        *
+        * Currently only used for NIR shaders; indexed by variables'
+        * driver_location.
+        */
+       LLVMValueRef *inputs;
 };
 
 #endif /* AC_SHADER_ABI_H */