mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-07 17:20:21 +01:00
panvk: Only prepare texture descriptors when the image is sampled
Not that input attachments will be lowered to textures, so we need to create a texture descriptor in that case too. Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13077>
This commit is contained in:
parent
92768ee627
commit
e48d66afcb
3 changed files with 21 additions and 15 deletions
|
|
@ -933,7 +933,9 @@ struct panvk_image_view {
|
|||
|
||||
VkFormat vk_format;
|
||||
struct panfrost_bo *bo;
|
||||
uint32_t desc[TEXTURE_DESC_WORDS];
|
||||
struct {
|
||||
uint32_t tex[TEXTURE_DESC_WORDS];
|
||||
} descs;
|
||||
};
|
||||
|
||||
#define SAMPLER_DESC_WORDS 8
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ panvk_per_arch(set_texture_desc)(struct panvk_descriptor_set *set,
|
|||
|
||||
#if PAN_ARCH > 5
|
||||
memcpy(&((struct mali_bifrost_texture_packed *)set->textures)[idx],
|
||||
view->desc, pan_size(TEXTURE));
|
||||
view->descs.tex, pan_size(TEXTURE));
|
||||
#else
|
||||
((mali_ptr *)set->textures)[idx] = view->bo->ptr.gpu;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -126,23 +126,27 @@ panvk_per_arch(CreateImageView)(VkDevice _device,
|
|||
view->vk_format = pCreateInfo->format;
|
||||
|
||||
struct panfrost_device *pdev = &device->physical_device->pdev;
|
||||
unsigned bo_size =
|
||||
GENX(panfrost_estimate_texture_payload_size)(&view->pview) +
|
||||
pan_size(TEXTURE);
|
||||
|
||||
unsigned surf_descs_offset = PAN_ARCH <= 5 ? pan_size(TEXTURE) : 0;
|
||||
if (image->usage &
|
||||
(VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT)) {
|
||||
unsigned bo_size =
|
||||
GENX(panfrost_estimate_texture_payload_size)(&view->pview) +
|
||||
pan_size(TEXTURE);
|
||||
|
||||
view->bo = panfrost_bo_create(pdev, bo_size, 0, "Texture descriptor");
|
||||
unsigned surf_descs_offset = PAN_ARCH <= 5 ? pan_size(TEXTURE) : 0;
|
||||
|
||||
struct panfrost_ptr surf_descs = {
|
||||
.cpu = view->bo->ptr.cpu + surf_descs_offset,
|
||||
.gpu = view->bo->ptr.gpu + surf_descs_offset,
|
||||
};
|
||||
void *tex_desc = PAN_ARCH >= 6 ?
|
||||
&view->desc : view->bo->ptr.cpu;
|
||||
view->bo = panfrost_bo_create(pdev, bo_size, 0, "Texture descriptor");
|
||||
|
||||
STATIC_ASSERT(sizeof(view->desc) >= pan_size(TEXTURE));
|
||||
GENX(panfrost_new_texture)(pdev, &view->pview, tex_desc, &surf_descs);
|
||||
struct panfrost_ptr surf_descs = {
|
||||
.cpu = view->bo->ptr.cpu + surf_descs_offset,
|
||||
.gpu = view->bo->ptr.gpu + surf_descs_offset,
|
||||
};
|
||||
void *tex_desc = PAN_ARCH >= 6 ?
|
||||
&view->descs.tex : view->bo->ptr.cpu;
|
||||
|
||||
STATIC_ASSERT(sizeof(view->descs.tex) >= pan_size(TEXTURE));
|
||||
GENX(panfrost_new_texture)(pdev, &view->pview, tex_desc, &surf_descs);
|
||||
}
|
||||
|
||||
*pView = panvk_image_view_to_handle(view);
|
||||
return VK_SUCCESS;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue