turnip: add some shader information in pipeline state
authorJonathan Marek <jonathan@marek.ca>
Thu, 26 Sep 2019 04:31:56 +0000 (00:31 -0400)
committerJonathan Marek <jonathan@marek.ca>
Thu, 26 Sep 2019 21:18:13 +0000 (17:18 -0400)
This information is needed by texture/uniform descriptors.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Acked-by: Eric Anholt <eric@anholt.net>
src/freedreno/vulkan/tu_pipeline.c
src/freedreno/vulkan/tu_private.h

index 831bcfbd7e16ed4b0c81231a552c23af131c28d1..b77366d267a46bc976b3b5910c9eeec5e25fc7de 100644 (file)
@@ -1546,6 +1546,22 @@ tu_pipeline_builder_parse_shader_stages(struct tu_pipeline_builder *builder,
    tu6_emit_program(&prog_cs, builder, &pipeline->program.binary_bo, true);
    pipeline->program.binning_state_ib =
       tu_cs_end_sub_stream(&pipeline->cs, &prog_cs);
+
+   for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
+      if (!builder->shaders[i])
+         continue;
+
+      struct tu_program_descriptor_linkage *link = &pipeline->program.link[i];
+      struct ir3_shader *shader = builder->shaders[i]->variants[0].shader;
+
+      link->ubo_state = shader->ubo_state;
+      link->constlen = builder->shaders[i]->variants[0].constlen;
+      link->offset_ubo = shader->const_state.offsets.ubo;
+      link->num_ubo = shader->const_state.num_ubos;
+      link->texture_map = builder->shaders[i]->texture_map;
+      link->sampler_map = builder->shaders[i]->sampler_map;
+      link->ubo_map = builder->shaders[i]->ubo_map;
+   }
 }
 
 static void
index c93d7fa6357707d671b98b4064255f136548d407..63871732f645e7b58fcdc73a66596ba5bdafafea 100644 (file)
@@ -1072,6 +1072,20 @@ tu_shader_compile(struct tu_device *dev,
                   const struct tu_shader_compile_options *options,
                   const VkAllocationCallbacks *alloc);
 
+struct tu_program_descriptor_linkage
+{
+   struct ir3_ubo_analysis_state ubo_state;
+
+   uint32_t constlen;
+
+   uint32_t offset_ubo; /* ubo pointers const offset */
+   uint32_t num_ubo; /* number of ubo pointers */
+
+   struct tu_descriptor_map texture_map;
+   struct tu_descriptor_map sampler_map;
+   struct tu_descriptor_map ubo_map;
+};
+
 struct tu_pipeline
 {
    struct tu_cs cs;
@@ -1088,6 +1102,8 @@ struct tu_pipeline
       struct tu_bo binary_bo;
       struct tu_cs_entry state_ib;
       struct tu_cs_entry binning_state_ib;
+
+      struct tu_program_descriptor_linkage link[MESA_SHADER_STAGES];
    } program;
 
    struct