X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Famd%2Fvulkan%2Fradv_descriptor_set.h;h=89be6e69068f2a72de64969638eeaadd51c42cf2;hb=2dd8dfd9137ac561aac3c453c1c7ad6683bd17b4;hp=a90eb5c307634348f46be213a1d632f358375b36;hpb=fd420a7417c30e17b55c24d74b0fb399bfe3a2d4;p=mesa.git diff --git a/src/amd/vulkan/radv_descriptor_set.h b/src/amd/vulkan/radv_descriptor_set.h index a90eb5c3076..89be6e69068 100644 --- a/src/amd/vulkan/radv_descriptor_set.h +++ b/src/amd/vulkan/radv_descriptor_set.h @@ -38,10 +38,9 @@ struct radv_descriptor_set_binding_layout { uint32_t buffer_offset; uint16_t dynamic_offset_offset; + uint16_t dynamic_offset_count; /* redundant with the type, each for a single array element */ uint32_t size; - uint32_t buffer_count; - uint16_t dynamic_offset_count; /* Offset in the radv_descriptor_set_layout of the immutable samplers, or 0 * if there are no immutable samplers. */ @@ -59,6 +58,9 @@ struct radv_descriptor_set_layout { /* Total size of the descriptor set with room for all array entries */ uint32_t size; + /* CPU size of this struct + all associated data, for hashing. */ + uint32_t layout_size; + /* Shader stages affected by this descriptor set */ uint16_t shader_stages; uint16_t dynamic_shader_stages; @@ -69,6 +71,11 @@ struct radv_descriptor_set_layout { /* Number of dynamic offsets used by this descriptor set */ uint16_t dynamic_offset_count; + bool has_immutable_samplers; + bool has_variable_descriptors; + + uint32_t ycbcr_sampler_offsets_offset; + /* Bindings in this descriptor set */ struct radv_descriptor_set_binding_layout binding[0]; }; @@ -83,6 +90,7 @@ struct radv_pipeline_layout { uint32_t num_sets; uint32_t push_constant_size; uint32_t dynamic_offset_count; + uint16_t dynamic_shader_stages; unsigned char sha1[20]; }; @@ -92,4 +100,24 @@ radv_immutable_samplers(const struct radv_descriptor_set_layout *set, const struct radv_descriptor_set_binding_layout *binding) { return (const uint32_t*)((const char*)set + binding->immutable_samplers_offset); } + +static inline unsigned +radv_combined_image_descriptor_sampler_offset(const struct radv_descriptor_set_binding_layout *binding) +{ + return binding->size - ((!binding->immutable_samplers_equal) ? 16 : 0); +} + +static inline const struct radv_sampler_ycbcr_conversion * +radv_immutable_ycbcr_samplers(const struct radv_descriptor_set_layout *set, + unsigned binding_index) +{ + if (!set->ycbcr_sampler_offsets_offset) + return NULL; + + const uint32_t *offsets = (const uint32_t*)((const char*)set + set->ycbcr_sampler_offsets_offset); + + if (offsets[binding_index] == 0) + return NULL; + return (const struct radv_sampler_ycbcr_conversion *)((const char*)set + offsets[binding_index]); +} #endif /* RADV_DESCRIPTOR_SET_H */