radeonsi: move VS_STATE.LS_OUT_PATCH_SIZE a few bits higher to make space there
[mesa.git] / src / gallium / drivers / radeonsi / si_shader_internal.h
index 6f27e81a6b32a345e57d43b2e8b7e61a859d5303..ef2bf2fd7db7f2c739d7d4703786037d431a9bf6 100644 (file)
@@ -35,6 +35,11 @@ struct pipe_debug_callback;
 
 #define RADEON_LLVM_MAX_INPUTS 32 * 4
 
+/* Ideally pass the sample mask input to the PS epilog as v14, which
+ * is its usual location, so that the shader doesn't have to add v_mov.
+ */
+#define PS_EPILOG_SAMPLEMASK_MIN_LOC 14
+
 struct si_shader_output_values {
        LLVMValueRef values[4];
        unsigned semantic_name;
@@ -90,8 +95,11 @@ struct si_shader_context {
        /* VS states and layout of LS outputs / TCS inputs at the end
         *   [0] = clamp vertex color
         *   [1] = indexed
-        *   [8:20] = stride between patches in DW = num_inputs * num_vertices * 4
-        *            max = 32*32*4 + 32*4
+        *   [2:3] = NGG: output primitive type
+        *   [4:5] = NGG: provoking vertex index
+        *   [6]   = NGG: streamout queries enabled
+        *   [11:23] = stride between patches in DW = num_inputs * num_vertices * 4
+        *             max = 32*32*4 + 32*4
         *   [24:31] = stride between vertices in DW = num_inputs * 4
         *             max = 32*4
         */
@@ -211,8 +219,7 @@ LLVMValueRef si_llvm_bound_index(struct si_shader_context *ctx,
 void si_llvm_context_init(struct si_shader_context *ctx,
                          struct si_screen *sscreen,
                          struct ac_llvm_compiler *compiler,
-                         unsigned wave_size,
-                         unsigned ballot_mask_bits);
+                         unsigned wave_size);
 void si_llvm_context_set_ir(struct si_shader_context *ctx,
                            struct si_shader *shader);
 
@@ -236,9 +243,7 @@ LLVMValueRef si_nir_load_input_tes(struct ac_shader_abi *abi,
                                   bool is_patch,
                                   bool is_compact,
                                   bool load_input);
-LLVMValueRef si_nir_lookup_interp_param(struct ac_shader_abi *abi,
-                                       enum glsl_interp_mode interp,
-                                       unsigned location);
+bool si_is_merged_shader(struct si_shader_context *ctx);
 LLVMValueRef si_get_sample_id(struct si_shader_context *ctx);
 LLVMValueRef si_load_sampler_desc(struct si_shader_context *ctx,
                                  LLVMValueRef list, LLVMValueRef index,
@@ -247,7 +252,10 @@ LLVMValueRef si_load_image_desc(struct si_shader_context *ctx,
                                LLVMValueRef list, LLVMValueRef index,
                                enum ac_descriptor_type desc_type,
                                bool uses_store, bool bindless);
-LLVMValueRef si_nir_emit_fbfetch(struct ac_shader_abi *abi);
+LLVMValueRef si_buffer_load_const(struct si_shader_context *ctx,
+                                 LLVMValueRef resource, LLVMValueRef offset);
+void si_llvm_build_ret(struct si_shader_context *ctx, LLVMValueRef ret);
+LLVMValueRef si_prolog_get_rw_buffers(struct si_shader_context *ctx);
 void si_declare_compute_memory(struct si_shader_context *ctx);
 LLVMValueRef si_get_primitive_id(struct si_shader_context *ctx,
                                 unsigned swizzle);
@@ -259,6 +267,11 @@ void si_emit_streamout_output(struct si_shader_context *ctx,
                              LLVMValueRef const *so_write_offsets,
                              struct pipe_stream_output *stream_out,
                              struct si_shader_output_values *shader_out);
+void si_add_arg_checked(struct ac_shader_args *args,
+                       enum ac_arg_regfile file,
+                       unsigned registers, enum ac_arg_type type,
+                       struct ac_arg *arg,
+                       unsigned idx);
 
 void si_llvm_load_input_vs(
        struct si_shader_context *ctx,
@@ -272,6 +285,21 @@ LLVMValueRef si_unpack_param(struct si_shader_context *ctx,
                             unsigned bitwidth);
 LLVMValueRef si_is_es_thread(struct si_shader_context *ctx);
 LLVMValueRef si_is_gs_thread(struct si_shader_context *ctx);
+void si_build_wrapper_function(struct si_shader_context *ctx, LLVMValueRef *parts,
+                              unsigned num_parts, unsigned main_part,
+                              unsigned next_shader_first_part);
+bool si_need_ps_prolog(const union si_shader_part_key *key);
+void si_get_ps_prolog_key(struct si_shader *shader,
+                         union si_shader_part_key *key,
+                         bool separate_prolog);
+void si_get_ps_epilog_key(struct si_shader *shader,
+                         union si_shader_part_key *key);
+LLVMValueRef si_insert_input_ret(struct si_shader_context *ctx, LLVMValueRef ret,
+                                struct ac_arg param, unsigned return_index);
+LLVMValueRef si_insert_input_ret_float(struct si_shader_context *ctx, LLVMValueRef ret,
+                                      struct ac_arg param, unsigned return_index);
+LLVMValueRef si_insert_input_ptr(struct si_shader_context *ctx, LLVMValueRef ret,
+                                struct ac_arg param, unsigned return_index);
 
 void gfx10_emit_ngg_epilogue(struct ac_shader_abi *abi,
                             unsigned max_outputs,
@@ -283,4 +311,13 @@ void gfx10_ngg_gs_emit_prologue(struct si_shader_context *ctx);
 void gfx10_ngg_gs_emit_epilogue(struct si_shader_context *ctx);
 void gfx10_ngg_calculate_subgroup_info(struct si_shader *shader);
 
+/* si_shader_llvm_ps.c */
+void si_llvm_build_ps_prolog(struct si_shader_context *ctx,
+                            union si_shader_part_key *key);
+void si_llvm_build_ps_epilog(struct si_shader_context *ctx,
+                            union si_shader_part_key *key);
+void si_llvm_build_monolithic_ps(struct si_shader_context *ctx,
+                                struct si_shader *shader);
+void si_llvm_init_ps_callbacks(struct si_shader_context *ctx);
+
 #endif