anv: prepare image/buffer views for non indirect descriptors

When in direct descriptor mode, the descriptor pool buffers will hold
surface states directly. We won't allocate surface states in image &
buffer views.

Instead views will hold a packed RENDER_SURFACE_STATE ready to copied
into the descriptor buffers.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21645>
This commit is contained in:
Lionel Landwerlin
2023-02-23 15:19:11 +02:00
committed by Marge Bot
parent 1c45cd217e
commit 64f20cec28
5 changed files with 187 additions and 95 deletions

View File

@@ -1605,10 +1605,6 @@ struct anv_vue_header {
float PointWidth;
};
struct anv_surface_state_data {
uint8_t data[ANV_SURFACE_STATE_SIZE];
};
/** Struct representing a sampled image descriptor
*
* This descriptor layout is used for sampled images, bare sampler, and
@@ -1851,6 +1847,24 @@ anv_descriptor_set_is_push(struct anv_descriptor_set *set)
return set->pool == NULL;
}
struct anv_surface_state_data {
uint8_t data[ANV_SURFACE_STATE_SIZE];
};
struct anv_buffer_state {
/** Surface state allocated from the bindless heap
*
* Only valid if anv_physical_device::indirect_descriptors is true
*/
struct anv_state state;
/** Surface state after genxml packing
*
* Only valid if anv_physical_device::indirect_descriptors is false
*/
struct anv_surface_state_data state_data;
};
struct anv_buffer_view {
struct vk_object_base base;
@@ -1858,8 +1872,8 @@ struct anv_buffer_view {
struct anv_address address;
struct anv_state surface_state;
struct anv_state storage_surface_state;
struct anv_buffer_state general;
struct anv_buffer_state storage;
};
struct anv_push_descriptor_set {
@@ -2493,7 +2507,18 @@ struct anv_push_constants {
};
struct anv_surface_state {
/** Surface state allocated from the bindless heap
*
* Can be NULL if unused.
*/
struct anv_state state;
/** Surface state after genxml packing
*
* Same data as in state.
*/
struct anv_surface_state_data state_data;
/** Address of the surface referred to by this state
*
* This address is relative to the start of the BO.
@@ -4211,18 +4236,18 @@ struct anv_image_view {
* image layout of SHADER_READ_ONLY_OPTIMAL or
* DEPTH_STENCIL_READ_ONLY_OPTIMAL.
*/
struct anv_surface_state optimal_sampler_surface_state;
struct anv_surface_state optimal_sampler;
/**
* RENDER_SURFACE_STATE when using image as a sampler surface with an
* image layout of GENERAL.
*/
struct anv_surface_state general_sampler_surface_state;
struct anv_surface_state general_sampler;
/**
* RENDER_SURFACE_STATE when using image as a storage image.
*/
struct anv_surface_state storage_surface_state;
struct anv_surface_state storage;
} planes[3];
};
@@ -4334,7 +4359,7 @@ anv_get_image_format_features2(const struct intel_device_info *devinfo,
const struct isl_drm_modifier_info *isl_mod_info);
void anv_fill_buffer_surface_state(struct anv_device *device,
struct anv_state state,
void *surface_state_ptr,
enum isl_format format,
struct isl_swizzle swizzle,
isl_surf_usage_flags_t usage,