mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-20 05:40:39 +02:00
radv: add a function to create an image view for HiZ surfaces
Only for storage because that's the only use case. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36739>
This commit is contained in:
parent
d89922a6a8
commit
8886a3385b
2 changed files with 38 additions and 0 deletions
|
|
@ -642,6 +642,41 @@ radv_image_view_init(struct radv_image_view *iview, struct radv_device *device,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
radv_hiz_image_view_init(struct radv_image_view *iview, struct radv_device *device,
|
||||
const VkImageViewCreateInfo *pCreateInfo)
|
||||
{
|
||||
VK_FROM_HANDLE(radv_image, image, pCreateInfo->image);
|
||||
|
||||
vk_image_view_init(&device->vk, &iview->vk, true, pCreateInfo);
|
||||
|
||||
assert(vk_format_has_depth(image->vk.format) && vk_format_has_stencil(image->vk.format));
|
||||
assert(iview->vk.aspects == VK_IMAGE_ASPECT_DEPTH_BIT);
|
||||
|
||||
memset(&iview->descriptor, 0, sizeof(iview->descriptor));
|
||||
|
||||
iview->image = image;
|
||||
|
||||
const uint32_t type =
|
||||
radv_tex_dim(image->vk.image_type, iview->vk.view_type, image->vk.array_layers, image->vk.samples, true, false);
|
||||
|
||||
const struct ac_gfx12_hiz_state hiz_state = {
|
||||
.surf = &image->planes[0].surface,
|
||||
.va = image->bindings[0].addr,
|
||||
.type = type,
|
||||
.num_samples = image->vk.samples,
|
||||
.first_level = iview->vk.base_mip_level,
|
||||
.last_level = iview->vk.base_mip_level + iview->vk.level_count - 1,
|
||||
.num_levels = image->vk.mip_levels,
|
||||
.first_layer = iview->vk.base_array_layer,
|
||||
.last_layer = iview->vk.base_array_layer + iview->vk.layer_count - 1,
|
||||
};
|
||||
|
||||
uint32_t *desc = iview->storage_descriptor.plane_descriptors[0];
|
||||
|
||||
ac_build_gfx12_hiz_descriptor(&hiz_state, desc);
|
||||
}
|
||||
|
||||
void
|
||||
radv_image_view_finish(struct radv_image_view *iview)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -64,6 +64,9 @@ void radv_image_view_init(struct radv_image_view *view, struct radv_device *devi
|
|||
const struct radv_image_view_extra_create_info *extra_create_info);
|
||||
void radv_image_view_finish(struct radv_image_view *iview);
|
||||
|
||||
void radv_hiz_image_view_init(struct radv_image_view *iview, struct radv_device *device,
|
||||
const VkImageViewCreateInfo *pCreateInfo);
|
||||
|
||||
void radv_set_mutable_tex_desc_fields(struct radv_device *device, struct radv_image *image,
|
||||
const struct legacy_surf_level *base_level_info, unsigned plane_id,
|
||||
unsigned base_level, unsigned first_level, unsigned block_width, bool is_stencil,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue