radv: gather which input PS variables use an explicit interpolation mode
[mesa.git] / src / amd / vulkan / radv_shader.h
index aa8a340d2e1b510f727b0e47eeb3fe06ca57541e..131774bd8861944e7fa2747a43edac5d28c6e981 100644 (file)
@@ -55,6 +55,7 @@ struct radv_vs_out_key {
        uint32_t as_es:1;
        uint32_t as_ls:1;
        uint32_t as_ngg:1;
+       uint32_t as_ngg_passthrough:1;
        uint32_t export_prim_id:1;
        uint32_t export_layer_id:1;
        uint32_t export_clip_dists:1;
@@ -104,12 +105,17 @@ struct radv_fs_variant_key {
        uint32_t is_int10;
 };
 
+struct radv_cs_variant_key {
+       uint8_t subgroup_size;
+};
+
 struct radv_shader_variant_key {
        union {
                struct radv_vs_variant_key vs;
                struct radv_fs_variant_key fs;
                struct radv_tes_variant_key tes;
                struct radv_tcs_variant_key tcs;
+               struct radv_cs_variant_key cs;
 
                /* A common prefix of the vs and tes keys. */
                struct radv_vs_out_key vs_common_out;
@@ -120,8 +126,7 @@ struct radv_shader_variant_key {
 struct radv_nir_compiler_options {
        struct radv_pipeline_layout *layout;
        struct radv_shader_variant_key key;
-       bool unsafe_math;
-       bool supports_spill;
+       bool explicit_scratch_args;
        bool clamp_shadow_reference;
        bool robust_buffer_access;
        bool dump_shader;
@@ -134,7 +139,6 @@ struct radv_nir_compiler_options {
        enum chip_class chip_class;
        uint32_t tess_offchip_block_dw_size;
        uint32_t address32_hi;
-       uint8_t wave_size;
 };
 
 enum radv_ud_index {
@@ -238,6 +242,7 @@ struct radv_shader_info {
        unsigned private_mem_vgprs;
        bool need_indirect_descriptor_sets;
        bool is_ngg;
+       bool is_ngg_passthrough;
        struct {
                uint64_t ls_outputs_written;
                uint8_t input_usage_mask[VERT_ATTRIB_MAX];
@@ -289,6 +294,7 @@ struct radv_shader_info {
                uint8_t num_input_clips_culls;
                uint32_t input_mask;
                uint32_t flat_shaded_mask;
+               uint32_t explicit_shaded_mask;
                uint32_t float16_shaded_mask;
                uint32_t num_interp;
                bool can_discard;
@@ -314,6 +320,8 @@ struct radv_shader_info {
 
        struct gfx9_gs_info gs_ring_info;
        struct gfx10_ngg_info ngg_info;
+
+       unsigned float_controls_mode;
 };
 
 enum radv_shader_binary_type {
@@ -364,7 +372,7 @@ struct radv_shader_variant {
 
        /* debug only */
        bool aco_used;
-       uint32_t *spirv;
+       char *spirv;
        uint32_t spirv_size;
        char *nir_string;
        char *disasm_string;
@@ -405,6 +413,16 @@ radv_alloc_shader_memory(struct radv_device *device,
 void
 radv_destroy_shader_slabs(struct radv_device *device);
 
+void
+radv_create_shaders(struct radv_pipeline *pipeline,
+                   struct radv_device *device,
+                   struct radv_pipeline_cache *cache,
+                   const struct radv_pipeline_key *key,
+                   const VkPipelineShaderStageCreateInfo **pStages,
+                   const VkPipelineCreateFlags flags,
+                   VkPipelineCreationFeedbackEXT *pipeline_feedback,
+                   VkPipelineCreationFeedbackEXT **stage_feedbacks);
+
 struct radv_shader_variant *
 radv_shader_variant_create(struct radv_device *device,
                           const struct radv_shader_binary *binary,
@@ -425,7 +443,8 @@ struct radv_shader_variant *
 radv_create_gs_copy_shader(struct radv_device *device, struct nir_shader *nir,
                           struct radv_shader_info *info,
                           struct radv_shader_binary **binary_out,
-                          bool multiview,  bool keep_shader_info);
+                          bool multiview,  bool keep_shader_info,
+                          bool use_aco);
 
 void
 radv_shader_variant_destroy(struct radv_device *device,
@@ -461,8 +480,29 @@ bool
 radv_can_dump_shader_stats(struct radv_device *device,
                           struct radv_shader_module *module);
 
-unsigned
-shader_io_get_unique_index(gl_varying_slot slot);
+static inline unsigned
+shader_io_get_unique_index(gl_varying_slot slot)
+{
+       /* handle patch indices separate */
+       if (slot == VARYING_SLOT_TESS_LEVEL_OUTER)
+               return 0;
+       if (slot == VARYING_SLOT_TESS_LEVEL_INNER)
+               return 1;
+       if (slot >= VARYING_SLOT_PATCH0 && slot <= VARYING_SLOT_TESS_MAX)
+               return 2 + (slot - VARYING_SLOT_PATCH0);
+       if (slot == VARYING_SLOT_POS)
+               return 0;
+       if (slot == VARYING_SLOT_PSIZ)
+               return 1;
+       if (slot == VARYING_SLOT_CLIP_DIST0)
+               return 2;
+       if (slot == VARYING_SLOT_CLIP_DIST1)
+               return 3;
+       /* 3 is reserved for clip dist as well */
+       if (slot >= VARYING_SLOT_VAR0 && slot <= VARYING_SLOT_VAR31)
+               return 4 + (slot - VARYING_SLOT_VAR0);
+       unreachable("illegal slot in get unique index\n");
+}
 
 void
 radv_lower_fs_io(nir_shader *nir);