From 221ef212fb3eba8cda853fa0b9a2057d85afe267 Mon Sep 17 00:00:00 2001 From: Jeroen Trappers Date: Tue, 1 Dec 2026 23:20:25 +0100 Subject: [PATCH 1/4] pvr: one aspect of a combined depth/stencil image takes that aspect's texel size Zink uploads a GL DEPTH24_STENCIL8 texture (D32_SFLOAT_S8_UINT on G5P) one aspect at a time. pvr_setup_transfer_surface() divided the aspect's row pitch by the combined format's 8-byte texel and asserted (the depth plane of a one-texel-wide level has a 4-byte pitch). Take the aspect's texel size for a single-aspect transfer of a combined format; the G5P CPU transfer already copies into the ZLS planes. On an iPhone 6s (S8003): the 44 GLES3 texture.shadow cases of the sample's 1801-2700 slice go from 15 crashes to 44 passes. Generated-by: LLM Signed-off-by: Jeroen Trappers --- src/imagination/vulkan/rogue/pvr_blit.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/imagination/vulkan/rogue/pvr_blit.c b/src/imagination/vulkan/rogue/pvr_blit.c index f026f35da15..7eaefcbb2e2 100644 --- a/src/imagination/vulkan/rogue/pvr_blit.c +++ b/src/imagination/vulkan/rogue/pvr_blit.c @@ -218,8 +218,12 @@ static void pvr_setup_transfer_surface(struct pvr_device *device, surface->height = height; surface->depth = depth; - assert(info.rowPitch % vk_format_get_blocksize(format) == 0); - surface->stride = info.rowPitch / vk_format_get_blocksize(format); + /* One aspect of a combined depth/stencil format: the layout is that aspect's, so is its texel size */ + const uint32_t bpp = vk_format_is_depth_or_stencil(format) && util_bitcount(aspect_mask) == 1 + ? vk_format_get_blocksize(vk_format_get_aspect_format(format, aspect_mask)) + : vk_format_get_blocksize(format); + assert(info.rowPitch % bpp == 0); + surface->stride = info.rowPitch / bpp; surface->vk_format = format; surface->mem_layout = image->memlayout; From a41e2288041faaeebc760aa08462079718d532e9 Mon Sep 17 00:00:00 2001 From: Jeroen Trappers Date: Tue, 1 Dec 2026 23:33:14 +0100 Subject: [PATCH 2/4] pvr/g5p: a 2D view of a 3D image's slices keeps its own slice count pvr_arch_image.c set the layer count of every 2D or 2D-array view of a 3D image to the image's whole depth. G5P renders a one-slice view as a one-layer target and refuses a view of more layers (g5p_job_init()), so every draw into a 3D slice was dropped: Zink blits glCopyImageSubData between formats by drawing into a 2D view of the destination slice, and those copies kept the slice's old contents. On G5P the view keeps its own count; the whole depth stays in Rogue's texture words (info.array_size), unchanged for everything else. Generated-by: LLM Signed-off-by: Jeroen Trappers --- src/imagination/vulkan/pvr_arch_image.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/imagination/vulkan/pvr_arch_image.c b/src/imagination/vulkan/pvr_arch_image.c index 5aea1705e63..c9e6167a919 100644 --- a/src/imagination/vulkan/pvr_arch_image.c +++ b/src/imagination/vulkan/pvr_arch_image.c @@ -102,10 +102,19 @@ VkResult PVR_PER_ARCH(CreateImageView)(VkDevice _device, plane = &image->planes[0]; } + uint32_t array_size = iview->vk.layer_count; if (image->vk.image_type == VK_IMAGE_TYPE_3D && (iview->vk.view_type == VK_IMAGE_VIEW_TYPE_2D_ARRAY || iview->vk.view_type == VK_IMAGE_VIEW_TYPE_2D)) { - iview->vk.layer_count = image->vk.extent.depth; + array_size = image->vk.extent.depth; + /* G5P: a 2D (array) view of a 3D image keeps its own slice count. Its + * render path takes a one-slice view as one layer (pvr_arch_g5p.c, + * g5p_job_init(): a view of more layers is refused, which lost every + * draw into a 3D slice, e.g. Zink's blit for glCopyImageSubData), and + * its array state counts the view's slices from base_array_layer + * (pvr_arch_g5p_tex.c). Rogue's texture words keep the whole depth. */ + if (!PVR_HAS_FEATURE(&device->pdevice->dev_info, apple_g5p)) + iview->vk.layer_count = array_size; } info.type = iview->vk.view_type; @@ -115,7 +124,7 @@ VkResult PVR_PER_ARCH(CreateImageView)(VkDevice _device, info.aspect_mask = iview->vk.aspects; info.is_cube = (info.type == VK_IMAGE_VIEW_TYPE_CUBE || info.type == VK_IMAGE_VIEW_TYPE_CUBE_ARRAY); - info.array_size = iview->vk.layer_count; + info.array_size = array_size; info.offset = iview->vk.base_array_layer * plane->layer_size; info.mipmaps_present = (image->vk.mip_levels > 1) ? true : false; info.stride = plane->physical_extent.width; From 5cdbf16d21842080888d7739d2fae82543ddd977 Mon Sep 17 00:00:00 2001 From: Jeroen Trappers Date: Wed, 2 Dec 2026 01:27:46 +0100 Subject: [PATCH 3/4] pvr/g5p: vertex SSBO stores move a bank-0 offset or value to bank 1 The vertex SSBO store form is witnessed with every register in vertex bank 1, so a store whose byte offset or value lived in bank 0 was refused ("no witnessed mixed-bank form"). Move such an operand to bank 1 first with the move a storage-buffer load already uses for its offset (vs_bank1_index()). On an iPhone 6s (S8003): the 22 Vulkan CTS cases of the sample refused for this pass. Generated-by: LLM Signed-off-by: Jeroen Trappers --- src/imagination/g5p/pco_g5p_general.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/imagination/g5p/pco_g5p_general.c b/src/imagination/g5p/pco_g5p_general.c index 9f3e1f6eda9..a96476c5474 100644 --- a/src/imagination/g5p/pco_g5p_general.c +++ b/src/imagination/g5p/pco_g5p_general.c @@ -4782,6 +4782,9 @@ static void stage_ssbo_store(struct gctx *c,nir_intrinsic_instr *in) for(unsigned i=0;inssbo;i++)if(c->ssbo_set[i]==set && c->ssbo_binding[i]==binding)base=c->ssbo_common[i]; struct ref offset=resolve_value(c,in->src[2].ssa,0),value=resolve_value(c,in->src[0].ssa,0); unsigned index=reg_of(c,offset,"store_ssbo byte offset"),data=reg_of(c,value,"store_ssbo value"); + /* a bank-0 offset or value is moved to bank 1 first (the witnessed move of a load's offset): the store's + * form is witnessed with every register in bank 1 */ + if(c->vs){index=vs_bank1_index(c,index);data=vs_bank1_index(c,data);} if(c->vs)vs_bank1_only(c,"vertex SSBO store",index,data,-1,-1); unsigned pair; for(pair=0;pair+2<=NUM_DWORDS;pair+=2) From 2327b456dd9743675973038390b4af102e059564 Mon Sep 17 00:00:00 2001 From: Jeroen Trappers Date: Wed, 2 Dec 2026 03:22:30 +0100 Subject: [PATCH 4/4] pvr/g5p: 32-bit float colour targets through the raw pass R32_SFLOAT, R32G32_SFLOAT and R32G32B32A32_SFLOAT were not colour targets on the A9. The raw pass already stores 32-bit integer targets' words unconverted; a float target's words are the same bits. Render them as raw targets, stored with the matching UINT format's PBE key, and advertise them as colour attachments without blending. The A8 keeps its own R32F float pass. On an iPhone 6s (S8003): 3 more Vulkan CTS cases (use_after_copy with an RGBA32F pass, an RG32F blit source) and 3 GLES3/3.1 cases (an R32F renderbuffer, float derivative FBOs) pass; no regression in the 269 float-target cases run. Generated-by: LLM Signed-off-by: Jeroen Trappers --- src/imagination/vulkan/pvr_g5p.h | 6 ++++++ src/imagination/vulkan/pvr_g5p_format_table.h | 6 +++--- src/imagination/vulkan/pvr_g5p_formats.c | 11 +++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/imagination/vulkan/pvr_g5p.h b/src/imagination/vulkan/pvr_g5p.h index 214a6f75182..b962a94a185 100644 --- a/src/imagination/vulkan/pvr_g5p.h +++ b/src/imagination/vulkan/pvr_g5p.h @@ -543,6 +543,7 @@ static inline bool pvr_g5p_packed_is_signed(VkFormat format) /* The 32-bit integer colour targets the raw32 output renders (pco_g5p's PCO_G5P_COLOR_UINT32/SINT32: four raw * output words, no f16 conversion): 1 unsigned, 2 signed, 0 any other format. The PBE stores the target's own * channels (one, two or four 32-bit words of a pixel) from the first output words. */ +extern bool g5p_usc_g4p; /* g5p_usc.h */ static inline unsigned pvr_g5p_raw32_kind(VkFormat format) { @@ -551,6 +552,11 @@ pvr_g5p_raw32_kind(VkFormat format) case VK_FORMAT_R32G32_UINT: case VK_FORMAT_R32G32B32A32_UINT: return 1; + /* 32-bit float targets: the same raw words, stored as the UINT format's bits (pvr_g5p_format_pbe()) */ + case VK_FORMAT_R32_SFLOAT: + case VK_FORMAT_R32G32_SFLOAT: + case VK_FORMAT_R32G32B32A32_SFLOAT: + return g5p_usc_g4p ? 0 : 1; /* the A8 renders R32F as a float pass */ case VK_FORMAT_R32_SINT: case VK_FORMAT_R32G32_SINT: case VK_FORMAT_R32G32B32A32_SINT: diff --git a/src/imagination/vulkan/pvr_g5p_format_table.h b/src/imagination/vulkan/pvr_g5p_format_table.h index 68797f3d243..38364732f67 100644 --- a/src/imagination/vulkan/pvr_g5p_format_table.h +++ b/src/imagination/vulkan/pvr_g5p_format_table.h @@ -149,9 +149,9 @@ static const struct pvr_g5p_format pvr_g5p_format_table[] = { G5P_FMT(R16G16_SFLOAT, 4, false, G5P_SF | G5P_RT | PVR_G5P_FMT_STORAGE, G5P1B, 0x223, G5P_SEL_RG01), G5P_FMT(R16G16B16A16_SFLOAT, 8, false, G5P_SF | G5P_RT | PVR_G5P_FMT_STORAGE, G5P1B, 0x232, G5P_SEL_RGBA), /* 32-bit float (fmt-r32f, t12-t13): the A9 does not filter 32-bit float */ - G5P_FMT(R32_SFLOAT, 4, false, G5P_S | PVR_G5P_FMT_STORAGE, G5P1B, 0x221, G5P_SEL_R001), - G5P_FMT(R32G32_SFLOAT, 8, false, G5P_S, G5P1B, 0x231, G5P_SEL_RG01), - G5P_FMT(R32G32B32A32_SFLOAT, 16, false, G5P_S | PVR_G5P_FMT_STORAGE, G5P1B, 0x238, G5P_SEL_RGBA), + G5P_FMT(R32_SFLOAT, 4, false, G5P_S | PVR_G5P_FMT_STORAGE | PVR_G5P_FMT_RENDER, G5P1B, 0x221, G5P_SEL_R001), + G5P_FMT(R32G32_SFLOAT, 8, false, G5P_S | PVR_G5P_FMT_RENDER, G5P1B, 0x231, G5P_SEL_RG01), + G5P_FMT(R32G32B32A32_SFLOAT, 16, false, G5P_S | PVR_G5P_FMT_STORAGE | PVR_G5P_FMT_RENDER, G5P1B, 0x238, G5P_SEL_RGBA), /* packed float (t14-t15). Apple packs RG11B10F in a 66-byte program; the * PBE packs it from the two-word program's f16 too, exactly. */ G5P_FMT(B10G11R11_UFLOAT_PACK32, 4, false, G5P_SF | G5P_RT, G5P1B, 0x225, G5P_SEL_RGB1), diff --git a/src/imagination/vulkan/pvr_g5p_formats.c b/src/imagination/vulkan/pvr_g5p_formats.c index 5f1698add3f..a4179082ff7 100644 --- a/src/imagination/vulkan/pvr_g5p_formats.c +++ b/src/imagination/vulkan/pvr_g5p_formats.c @@ -92,6 +92,17 @@ pvr_g5p_format_pbe(VkFormat format, uint32_t *key, bool *srgb) *srgb = f->srgb; return true; } + /* a 32-bit float target is stored by the raw pass as the UINT format's bits */ + const VkFormat raw = format == VK_FORMAT_R32_SFLOAT ? VK_FORMAT_R32_UINT : + format == VK_FORMAT_R32G32_SFLOAT ? VK_FORMAT_R32G32_UINT : + format == VK_FORMAT_R32G32B32A32_SFLOAT ? VK_FORMAT_R32G32B32A32_UINT : VK_FORMAT_UNDEFINED; + if (raw != VK_FORMAT_UNDEFINED && !g5p_usc_g4p) { + uint32_t k; + bool unused; + if (!pvr_g5p_format_pbe_key(format, row_probe(format), &k, &unused)) + return false; + return pvr_g5p_format_pbe_key(raw, true, key, srgb); + } return pvr_g5p_format_pbe_key(format, row_probe(format), key, srgb); }