radv/shader_info: start gathering tess output info (v2)
[mesa.git] / src / amd / vulkan / radv_shader.h
index e7478fd56fc25c38e5130d9adcaa14f00bdcf20c..99f677c524eb8847b97b5240d6de212f8333b706 100644 (file)
@@ -97,7 +97,9 @@ struct radv_nir_compiler_options {
        bool unsafe_math;
        bool supports_spill;
        bool clamp_shadow_reference;
+       bool dump_shader;
        bool dump_preoptir;
+       bool record_llvm_ir;
        enum radeon_family family;
        enum chip_class chip_class;
 };
@@ -131,6 +133,7 @@ struct radv_shader_info {
        bool uses_invocation_id;
        bool uses_prim_id;
        struct {
+               uint64_t ls_outputs_written;
                uint8_t input_usage_mask[VERT_ATTRIB_MAX];
                uint8_t output_usage_mask[VARYING_SLOT_VAR31 + 1];
                bool has_vertex_buffers; /* needs vertex buffers and base/start */
@@ -158,6 +161,10 @@ struct radv_shader_info {
                bool uses_thread_id[3];
                bool uses_local_invocation_idx;
        } cs;
+       struct {
+               uint64_t outputs_written;
+               uint64_t patch_outputs_written;
+       } tcs;
 };
 
 struct radv_userdata_info {
@@ -260,6 +267,7 @@ struct radv_shader_variant {
        uint32_t spirv_size;
        struct nir_shader *nir;
        char *disasm_string;
+       char *llvm_ir_string;
 
        struct list_head slab_list;
 };
@@ -335,4 +343,25 @@ radv_can_dump_shader_stats(struct radv_device *device,
               module && !module->nir;
 }
 
+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;
+       /* 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");
+}
+
 #endif