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 <luigi.santivetti@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41797>
This commit is contained in:
Luigi Santivetti 2026-05-15 16:22:42 +01:00 committed by Marge Bot
parent 2757fd1c44
commit 87e5fb2dcb

View file

@ -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,