From 49cf61c6aa562dba298291c10c365bd2623c2c00 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Sat, 24 Nov 2018 12:42:39 -0600 Subject: anv: Clean up descriptor set layouts The descriptor set layout code in our driver has undergone many changes over the years. Some of the fields which were once essential are now useless or nearly so. The has_dynamic_offsets field was completely unused accept for the code to set and hash it. The per-stage indices were only being used to determine if a particular binding had images, samplers, etc. The fact that it's per-stage also doesn't matter because that binding should never be accessed by a shader of the wrong stage. This commit deletes a pile of cruft and replaces it all with a descriptive bitfield which states what a particular descriptor contains. This merely describes the data available and doesn't necessarily dictate how it will be lowered in anv_nir_apply_pipeline_layout. Reviewed-by: Lionel Landwerlin --- src/intel/vulkan/anv_private.h | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'src/intel/vulkan/anv_private.h') diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index f00061c711d..0573b99bab6 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1498,12 +1498,26 @@ struct anv_vue_header { float PointWidth; }; +enum anv_descriptor_data { + /** The descriptor contains a BTI reference to a surface state */ + ANV_DESCRIPTOR_SURFACE_STATE = (1 << 0), + /** The descriptor contains a BTI reference to a sampler state */ + ANV_DESCRIPTOR_SAMPLER_STATE = (1 << 1), + /** The descriptor contains an actual buffer view */ + ANV_DESCRIPTOR_BUFFER_VIEW = (1 << 2), + /** The descriptor contains auxiliary image layout data */ + ANV_DESCRIPTOR_IMAGE_PARAM = (1 << 3), +}; + struct anv_descriptor_set_binding_layout { #ifndef NDEBUG /* The type of the descriptors in this binding */ VkDescriptorType type; #endif + /* Bitfield representing the type of data this descriptor contains */ + enum anv_descriptor_data data; + /* Number of array elements in this binding */ uint16_t array_size; @@ -1516,17 +1530,6 @@ struct anv_descriptor_set_binding_layout { /* Index into the descriptor set buffer views */ int16_t buffer_view_index; - struct { - /* Index into the binding table for the associated surface */ - int16_t surface_index; - - /* Index into the sampler table for the associated sampler */ - int16_t sampler_index; - - /* Index into the image param table for the associated image */ - int16_t image_param_index; - } stage[MESA_SHADER_STAGES]; - /* Immutable samplers (or NULL if no immutable samplers) */ struct anv_sampler **immutable_samplers; }; @@ -1756,10 +1759,6 @@ struct anv_pipeline_layout { uint32_t num_sets; - struct { - bool has_dynamic_offsets; - } stage[MESA_SHADER_STAGES]; - unsigned char sha1[20]; }; -- cgit v1.2.3