radeonsi: optimize out the loop in si_get_ps_input_cntl
[mesa.git] / src / gallium / drivers / radeonsi / si_shader.h
index c60b47fe1c3abf6ad51c2f1a71a8788cd59f90b0..8694bc58ab71469aecf4980ca196de9412c5684d 100644 (file)
@@ -152,7 +152,7 @@ struct si_context;
 #define SI_MAX_ATTRIBS    16
 #define SI_MAX_VS_OUTPUTS 40
 
-/* Shader IO unique indices are supported for TGSI_SEMANTIC_GENERIC with an
+/* Shader IO unique indices are supported for VARYING_SLOT_VARn with an
  * index smaller than this.
  */
 #define SI_MAX_IO_GENERIC 32
@@ -319,22 +319,22 @@ struct si_compiler_ctx_state {
 };
 
 struct si_shader_info {
+   gl_shader_stage stage;
+
    ubyte num_inputs;
    ubyte num_outputs;
-   ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS]; /**< TGSI_SEMANTIC_x */
-   ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS];
+   ubyte input_semantic[PIPE_MAX_SHADER_INPUTS];
    ubyte input_interpolate[PIPE_MAX_SHADER_INPUTS];
    ubyte input_usage_mask[PIPE_MAX_SHADER_INPUTS];
-   ubyte output_semantic_name[PIPE_MAX_SHADER_OUTPUTS]; /**< TGSI_SEMANTIC_x */
-   ubyte output_semantic_index[PIPE_MAX_SHADER_OUTPUTS];
+   ubyte output_semantic[PIPE_MAX_SHADER_OUTPUTS];
+   char output_semantic_to_slot[VARYING_SLOT_TESS_MAX];
    ubyte output_usagemask[PIPE_MAX_SHADER_OUTPUTS];
+   ubyte output_readmask[PIPE_MAX_SHADER_OUTPUTS];
    ubyte output_streams[PIPE_MAX_SHADER_OUTPUTS];
 
    ubyte color_interpolate[2];
    ubyte color_interpolate_loc[2];
 
-   ubyte processor;
-
    int constbuf0_num_slots;
    unsigned const_buffers_declared; /**< bitmask of declared const buffers */
    unsigned samplers_declared;      /**< bitmask of declared samplers */
@@ -342,13 +342,6 @@ struct si_shader_info {
 
    uint num_memory_instructions; /**< sampler, buffer, and image instructions */
 
-   /**
-    * If a tessellation control shader reads outputs, this describes which ones.
-    */
-   bool reads_pervertex_outputs;
-   bool reads_perpatch_outputs;
-   bool reads_tessfactor_outputs;
-
    ubyte colors_read; /**< which color components are read by the FS */
    ubyte colors_written;
    bool reads_samplemask;   /**< does fragment shader read sample mask? */
@@ -437,8 +430,8 @@ struct si_shader_selector {
    struct pipe_stream_output_info so;
    struct si_shader_info info;
 
-   /* PIPE_SHADER_[VERTEX|FRAGMENT|...] */
-   enum pipe_shader_type type;
+   ubyte const_and_shader_buf_descriptors_index;
+   ubyte sampler_and_images_descriptors_index;
    bool vs_needs_prolog;
    bool prim_discard_cs_allowed;
    bool ngg_culling_allowed;
@@ -848,8 +841,8 @@ bool si_compile_shader(struct si_screen *sscreen, struct ac_llvm_compiler *compi
 bool si_create_shader_variant(struct si_screen *sscreen, struct ac_llvm_compiler *compiler,
                               struct si_shader *shader, struct pipe_debug_callback *debug);
 void si_shader_destroy(struct si_shader *shader);
-unsigned si_shader_io_get_unique_index_patch(unsigned semantic_name, unsigned index);
-unsigned si_shader_io_get_unique_index(unsigned semantic_name, unsigned index, unsigned is_varying);
+unsigned si_shader_io_get_unique_index_patch(unsigned semantic);
+unsigned si_shader_io_get_unique_index(unsigned semantic, bool is_varying);
 bool si_shader_binary_upload(struct si_screen *sscreen, struct si_shader *shader,
                              uint64_t scratch_va);
 void si_shader_dump(struct si_screen *sscreen, struct si_shader *shader,
@@ -895,9 +888,9 @@ static inline bool gfx10_is_ngg_passthrough(struct si_shader *shader)
 {
    struct si_shader_selector *sel = shader->selector;
 
-   return sel->type != PIPE_SHADER_GEOMETRY && !sel->so.num_outputs && !sel->info.writes_edgeflag &&
+   return sel->info.stage != MESA_SHADER_GEOMETRY && !sel->so.num_outputs && !sel->info.writes_edgeflag &&
           !shader->key.opt.ngg_culling &&
-          (sel->type != PIPE_SHADER_VERTEX || !shader->key.mono.u.vs_export_prim_id);
+          (sel->info.stage != MESA_SHADER_VERTEX || !shader->key.mono.u.vs_export_prim_id);
 }
 
 static inline bool si_shader_uses_bindless_samplers(struct si_shader_selector *selector)