anv: factor out common code for determining surface usage from a VkDescriptorType
Signed-off-by: Rohan Garg <rohan.garg@intel.com> Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27268>
This commit is contained in:
@@ -2208,10 +2208,7 @@ anv_descriptor_write_surface_state(struct anv_device *device,
|
||||
bview->general.state = surface_state;
|
||||
|
||||
isl_surf_usage_flags_t usage =
|
||||
(desc->type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER ||
|
||||
desc->type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC) ?
|
||||
ISL_SURF_USAGE_CONSTANT_BUFFER_BIT :
|
||||
ISL_SURF_USAGE_STORAGE_BIT;
|
||||
anv_isl_usage_for_descriptor_type(desc->type);
|
||||
|
||||
enum isl_format format =
|
||||
anv_isl_format_for_descriptor_type(device, desc->type);
|
||||
@@ -2282,9 +2279,7 @@ anv_descriptor_set_write_buffer(struct anv_device *device,
|
||||
|
||||
if (data & ANV_DESCRIPTOR_SURFACE) {
|
||||
isl_surf_usage_flags_t usage =
|
||||
desc->type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER ?
|
||||
ISL_SURF_USAGE_CONSTANT_BUFFER_BIT :
|
||||
ISL_SURF_USAGE_STORAGE_BIT;
|
||||
anv_isl_usage_for_descriptor_type(desc->type);
|
||||
|
||||
enum isl_format format =
|
||||
anv_isl_format_for_descriptor_type(device, desc->type);
|
||||
|
||||
@@ -5373,6 +5373,18 @@ enum isl_format
|
||||
anv_isl_format_for_descriptor_type(const struct anv_device *device,
|
||||
VkDescriptorType type);
|
||||
|
||||
static inline isl_surf_usage_flags_t
|
||||
anv_isl_usage_for_descriptor_type(const VkDescriptorType type)
|
||||
{
|
||||
switch(type) {
|
||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
|
||||
return ISL_SURF_USAGE_CONSTANT_BUFFER_BIT;
|
||||
default:
|
||||
return ISL_SURF_USAGE_STORAGE_BIT;
|
||||
}
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
anv_rasterization_aa_mode(VkPolygonMode raster_mode,
|
||||
VkLineRasterizationModeEXT line_mode)
|
||||
|
||||
@@ -1849,9 +1849,7 @@ emit_dynamic_buffer_binding_table_entry(struct anv_cmd_buffer *cmd_buffer,
|
||||
desc->type);
|
||||
|
||||
isl_surf_usage_flags_t usage =
|
||||
desc->type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC ?
|
||||
ISL_SURF_USAGE_CONSTANT_BUFFER_BIT :
|
||||
ISL_SURF_USAGE_STORAGE_BIT;
|
||||
anv_isl_usage_for_descriptor_type(desc->type);
|
||||
|
||||
anv_fill_buffer_surface_state(cmd_buffer->device,
|
||||
surface_state.map,
|
||||
|
||||
Reference in New Issue
Block a user