From 87e5fb2dcba1f442cb667cdab2c4c19a2ee74f1c Mon Sep 17 00:00:00 2001 From: Luigi Santivetti Date: Fri, 15 May 2026 16:22:42 +0100 Subject: [PATCH] pvr: re-use texture state words for each load op When setting texture state words for load op clears simply inherit them from the image view for a given attachment. The only piece of information that needs updating is the offset relative to the view index, because unknown at image creation time. Fix dEQP-GLES: dEQP-GLES3.functional.texture.specification.texsubimage2d* Fixes: e08916677 ("pvr: Add support for VK_ATTACHMENT_LOAD_OP_LOAD.") Signed-off-by: Luigi Santivetti Reviewed-by: Frank Binns Part-of: --- src/imagination/vulkan/pvr_arch_cmd_buffer.c | 38 +++++++++----------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/src/imagination/vulkan/pvr_arch_cmd_buffer.c b/src/imagination/vulkan/pvr_arch_cmd_buffer.c index 49db9169839..174c3fc1e05 100644 --- a/src/imagination/vulkan/pvr_arch_cmd_buffer.c +++ b/src/imagination/vulkan/pvr_arch_cmd_buffer.c @@ -687,29 +687,25 @@ static VkResult pvr_setup_texture_state_words( { const struct pvr_image *image = vk_to_pvr_image(image_view->vk.image); const struct pvr_image_plane *plane = pvr_single_plane_const(image); - struct pvr_texture_state_info info = { - .format = image_view->vk.format, - .mem_layout = image->memlayout, - .type = image_view->vk.view_type, - .is_cube = image_view->vk.view_type == VK_IMAGE_VIEW_TYPE_CUBE || - image_view->vk.view_type == VK_IMAGE_VIEW_TYPE_CUBE_ARRAY, - .tex_state_type = PVR_TEXTURE_STATE_SAMPLE, - .extent = image_view->vk.extent, - .mip_levels = 1, - .sample_count = image_view->vk.image->samples, - .stride = plane->physical_extent.width, - .offset = plane->layer_size * view_index, - .addr = image->dev_addr, - }; - const uint8_t *const swizzle = pvr_get_format_swizzle(info.format); - VkResult result; - memcpy(&info.swizzle, swizzle, sizeof(info.swizzle)); + STATIC_ASSERT(sizeof(descriptor->image) == + sizeof(image_view->image_state[PVR_TEXTURE_STATE_SAMPLE])); + memcpy(&descriptor->image, + &image_view->image_state[PVR_TEXTURE_STATE_SAMPLE], + sizeof(descriptor->image)); - /* TODO: Can we use image_view->texture_state instead of generating here? */ - result = pvr_arch_pack_tex_state(device, &info, &descriptor->image); - if (result != VK_SUCCESS) - return result; + const struct ROGUE_TEXSTATE_IMAGE_WORD1 image_word1 = pvr_csb_unpack( + &descriptor->image.words[1], + TEXSTATE_IMAGE_WORD1); + + pvr_csb_pack (&descriptor->image.words[1], + TEXSTATE_IMAGE_WORD1, + word1) { + word1 = image_word1; + word1.texaddr = + PVR_DEV_ADDR_OFFSET(word1.texaddr, + plane->layer_size * view_index); + } pvr_csb_pack (&descriptor->sampler.words[0], TEXSTATE_SAMPLER_WORD0,