From 1f4f0a9586710ea1a400c764fef4bcc20a645913 Mon Sep 17 00:00:00 2001 From: Jeroen Trappers Date: Tue, 1 Dec 2026 23:17:31 +0100 Subject: [PATCH 1/2] pvr/g5p: sample unsupported border colours instead of failing the sampler GLES3.1 texture.border_clamp aborted 45 times on the A9: - The A9's sampler word clamps to a transparent black border only, and g5p_pack_sampler() refused a custom border colour, or a standard one other than transparent black, so Zink had no sampler. Such a sampler is now encoded with the transparent black border (one warning): a wrong colour where the border is read. The A8 driver's clamp-to-border is the same compromise. YCbCr and reduction modes stay refused. - Zink creates some custom border colours without a format (customBorderColorWithoutFormat is not advertised), and pvr_border_color_table_create_custom_entry() asserted on the undefined format: packed as 32-bit RGBA of the colour's type instead, as our A8 driver does. On an iPhone 6s (S8003), the GLES3.1 sample's 801-1600 slice: 47 crashes -> 2 (both image_load_store.3d), 410 -> 446 passes. Generated-by: LLM Signed-off-by: Jeroen Trappers --- src/imagination/vulkan/pvr_arch_border.c | 8 +++++--- src/imagination/vulkan/pvr_arch_g5p_tex.c | 25 +++++++++++++++++++++-- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/imagination/vulkan/pvr_arch_border.c b/src/imagination/vulkan/pvr_arch_border.c index 1990433e30b..2cef8ea95d3 100644 --- a/src/imagination/vulkan/pvr_arch_border.c +++ b/src/imagination/vulkan/pvr_arch_border.c @@ -507,13 +507,15 @@ static VkResult pvr_border_color_table_create_custom_entry( { const bool is_int = vk_border_color_is_int(sampler->vk.border_color); const VkClearColorValue color = sampler->vk.border_color_value; - const VkFormat vk_format = sampler->vk.format; + /* Zink passes no format for some custom border colours (customBorderColorWithoutFormat; GLES3.1 + * texture.border_clamp asserted here): packed as 32-bit RGBA of the colour's type, as on the A8 */ + const VkFormat vk_format = sampler->vk.format != VK_FORMAT_UNDEFINED ? sampler->vk.format + : is_int ? VK_FORMAT_R32G32B32A32_UINT + : VK_FORMAT_R32G32B32A32_SFLOAT; const bool map_table = !table->table->bo->map; VkResult result; int32_t index; - assert(vk_format != VK_FORMAT_UNDEFINED); - index = pvr_border_color_table_alloc_entry(table); if (index < 0) goto err_out; diff --git a/src/imagination/vulkan/pvr_arch_g5p_tex.c b/src/imagination/vulkan/pvr_arch_g5p_tex.c index 4ef79a3da59..c7ce803c3c2 100644 --- a/src/imagination/vulkan/pvr_arch_g5p_tex.c +++ b/src/imagination/vulkan/pvr_arch_g5p_tex.c @@ -12,6 +12,7 @@ #include #include +#include "vk_sampler.h" #include "vk_enum_to_str.h" #include "vk_format.h" #include "pvr_g5p_shader_dump.h" @@ -236,8 +237,28 @@ const char * PVR_PER_ARCH(g5p_pack_sampler)(const VkSamplerCreateInfo *info, struct pvr_sampler_descriptor *desc) { const bool extension = vk_find_struct_const(info->pNext, SAMPLER_YCBCR_CONVERSION_INFO) || - vk_find_struct_const(info->pNext, SAMPLER_REDUCTION_MODE_CREATE_INFO) || - vk_find_struct_const(info->pNext, SAMPLER_CUSTOM_BORDER_COLOR_CREATE_INFO_EXT); + vk_find_struct_const(info->pNext, SAMPLER_REDUCTION_MODE_CREATE_INFO); + /* The A9's sampler word clamps to a transparent black border only. A custom border colour, or a standard + * one other than transparent black, is sampled with that border instead: a wrong colour where the border + * is read, rather than no sampler (Zink aborts on one, GLES3.1 texture.border_clamp). As the A8's + * clamp-to-border, which samples like clamp-to-edge. */ + VkSamplerCreateInfo approx; + const bool custom = vk_find_struct_const(info->pNext, SAMPLER_CUSTOM_BORDER_COLOR_CREATE_INFO_EXT) || + (info->borderColor != VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK && + info->borderColor != VK_BORDER_COLOR_INT_TRANSPARENT_BLACK); + if (custom && !extension) { + static bool warned; + approx = *info; + approx.pNext = NULL; + approx.borderColor = vk_border_color_is_int(info->borderColor) ? VK_BORDER_COLOR_INT_TRANSPARENT_BLACK + : VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK; + if (!warned) { + warned = true; + mesa_logw("G5P: border colour %u sampled as transparent black (the A9's only border)", + info->borderColor); + } + info = ≈ + } uint64_t general, single; const char *why; From 867abc98040d9642414f5bcd43fe99a8d5aa8233 Mon Sep 17 00:00:00 2001 From: Jeroen Trappers Date: Tue, 1 Dec 2026 22:16:15 +0100 Subject: [PATCH 2/2] pvr/g5p: narrow integer colour targets on by default R8, RG8, R16, RG16, RGBA8 and RGBA16 UINT/SINT and A2B10G10R10_UINT were render probes, not advertised as colour attachments because they had not run on the device. GLES 3.0 requires them renderable, and copy_image renders into them. Run on an iPhone 6s (S8003) with the probe rows on, against the same build without them, the iPhone 6's GLES3 / GLES3.1 sample lists: - GLES3.1: +175 passes (copy_image 640 -> 813), no new crash. - GLES3: 30 Skip -> Pass, 11 Fail -> Pass; 40 Skip -> Fail, spread over every one of these formats alike, in fragment_out.array and fbo.blit conversions (multi-target sets G5P refuses, blits), not in a format. The 21 Pass -> Fail of that run all pass alone: the process had aborted before them (fixed by "zink: end a command buffer once"). - No GPU reset in either run. Generated-by: LLM Signed-off-by: Jeroen Trappers --- src/imagination/vulkan/pvr_g5p_format_table.h | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/imagination/vulkan/pvr_g5p_format_table.h b/src/imagination/vulkan/pvr_g5p_format_table.h index 68797f3d243..a278489e73d 100644 --- a/src/imagination/vulkan/pvr_g5p_format_table.h +++ b/src/imagination/vulkan/pvr_g5p_format_table.h @@ -65,7 +65,7 @@ enum pvr_g5p_fmt_flags { PVR_G5P_FMT_COMPRESSED = 1u << 4, /* blocks (4x4 ETC2/EAC, 4x4..12x12 ASTC), twiddled only */ PVR_G5P_FMT_INTEGER = 1u << 5, /* integer texel: texelFetch/unfiltered */ PVR_G5P_FMT_STORAGE = 1u << 6, /* compute writes with a declared format */ - /* narrow integer render rows remain unadvertised probes */ + /* the narrow integer render rows were probes until run on the 6s (2026-12-02, see their commit) */ PVR_G5P_FMT_PROBE_SAMPLED = 1u << 8, /* the sampled bits are a probe */ PVR_G5P_FMT_PROBE_RENDER = 1u << 9, /* the render (and blend) bits are a probe */ PVR_G5P_FMT_PROBE_BLEND = 1u << 10, /* the blend bit alone is a probe */ @@ -126,7 +126,7 @@ static const struct pvr_g5p_format pvr_g5p_format_table[] = { * it). */ G5P_FMT(A2B10G10R10_UNORM_PACK32, 4, false, G5P_SF | G5P_RT, G5P1B, 0x26, G5P_SEL_RGBA), G5P_FMT(A2R10G10B10_UNORM_PACK32, 4, false, G5P_SF, G5P1B, 0x26, G5P_SEL_BGRA), - G5P_FMT(A2B10G10R10_UINT_PACK32, 4, false, G5P_SI | PVR_G5P_FMT_RENDER | PVR_G5P_FMT_PROBE_RENDER, G5P1B, 0x126, G5P_SEL_RGBA), + G5P_FMT(A2B10G10R10_UINT_PACK32, 4, false, G5P_SI | PVR_G5P_FMT_RENDER, G5P1B, 0x126, G5P_SEL_RGBA), /* R/RG 8 (fmt-r8, fmt-rg8). Apple renders them with narrower programs; * the two-word program with these PBE keys renders them exactly too. */ G5P_FMT(R8_UNORM, 1, false, G5P_SF | G5P_RT, G5P1B, 0x00, G5P_SEL_R001), @@ -184,23 +184,23 @@ static const struct pvr_g5p_format pvr_g5p_format_table[] = { * int-sample on the device). RGBA32 UINT/SINT clear/draw/LOAD/masks * passed the integer-r4 core/compat device cases. Narrow integer render * targets remain absent or probe-only; integer blending is not exposed. */ - G5P_FMT(R8_UINT, 1, false, G5P_SI | PVR_G5P_FMT_RENDER | PVR_G5P_FMT_PROBE_RENDER, G5P1B, 0x100, G5P_SEL_R001), - G5P_FMT(R8G8_UINT, 2, false, G5P_SI | PVR_G5P_FMT_RENDER | PVR_G5P_FMT_PROBE_RENDER, G5P1B, 0x10a, G5P_SEL_RG01), - G5P_FMT(R8G8B8A8_UINT, 4, false, G5P_SI | PVR_G5P_FMT_RENDER | PVR_G5P_FMT_PROBE_RENDER, G5P1B, 0x128, G5P_SEL_RGBA), + G5P_FMT(R8_UINT, 1, false, G5P_SI | PVR_G5P_FMT_RENDER, G5P1B, 0x100, G5P_SEL_R001), + G5P_FMT(R8G8_UINT, 2, false, G5P_SI | PVR_G5P_FMT_RENDER, G5P1B, 0x10a, G5P_SEL_RG01), + G5P_FMT(R8G8B8A8_UINT, 4, false, G5P_SI | PVR_G5P_FMT_RENDER, G5P1B, 0x128, G5P_SEL_RGBA), G5P_FMT(A8B8G8R8_UINT_PACK32, 4, false, G5P_SI, G5P1B, 0x128, G5P_SEL_RGBA), - G5P_FMT(R16_UINT, 2, false, G5P_SI | PVR_G5P_FMT_RENDER | PVR_G5P_FMT_PROBE_RENDER, G5P1B, 0x109, G5P_SEL_R001), - G5P_FMT(R16G16_UINT, 4, false, G5P_SI | PVR_G5P_FMT_RENDER | PVR_G5P_FMT_PROBE_RENDER, G5P1B, 0x123, G5P_SEL_RG01), - G5P_FMT(R16G16B16A16_UINT, 8, false, G5P_SI | PVR_G5P_FMT_RENDER | PVR_G5P_FMT_PROBE_RENDER, G5P1B, 0x132, G5P_SEL_RGBA), + G5P_FMT(R16_UINT, 2, false, G5P_SI | PVR_G5P_FMT_RENDER, G5P1B, 0x109, G5P_SEL_R001), + G5P_FMT(R16G16_UINT, 4, false, G5P_SI | PVR_G5P_FMT_RENDER, G5P1B, 0x123, G5P_SEL_RG01), + G5P_FMT(R16G16B16A16_UINT, 8, false, G5P_SI | PVR_G5P_FMT_RENDER, G5P1B, 0x132, G5P_SEL_RGBA), G5P_FMT(R32_UINT, 4, false, G5P_SI | PVR_G5P_FMT_RENDER | PVR_G5P_FMT_STORAGE, G5P1B, 0x121, G5P_SEL_R001), G5P_FMT(R32G32_UINT, 8, false, G5P_SI | PVR_G5P_FMT_RENDER, G5P1B, 0x131, G5P_SEL_RG01), G5P_FMT(R32G32B32A32_UINT, 16, false, G5P_SI | PVR_G5P_FMT_RENDER | PVR_G5P_FMT_STORAGE, G5P1B, 0x138, G5P_SEL_RGBA), - G5P_FMT(R8_SINT, 1, false, G5P_SI | PVR_G5P_FMT_RENDER | PVR_G5P_FMT_PROBE_RENDER, G5P1B, 0x180, G5P_SEL_R001), - G5P_FMT(R8G8_SINT, 2, false, G5P_SI | PVR_G5P_FMT_RENDER | PVR_G5P_FMT_PROBE_RENDER, G5P1B, 0x18a, G5P_SEL_RG01), - G5P_FMT(R8G8B8A8_SINT, 4, false, G5P_SI | PVR_G5P_FMT_RENDER | PVR_G5P_FMT_PROBE_RENDER, G5P1B, 0x1a8, G5P_SEL_RGBA), + G5P_FMT(R8_SINT, 1, false, G5P_SI | PVR_G5P_FMT_RENDER, G5P1B, 0x180, G5P_SEL_R001), + G5P_FMT(R8G8_SINT, 2, false, G5P_SI | PVR_G5P_FMT_RENDER, G5P1B, 0x18a, G5P_SEL_RG01), + G5P_FMT(R8G8B8A8_SINT, 4, false, G5P_SI | PVR_G5P_FMT_RENDER, G5P1B, 0x1a8, G5P_SEL_RGBA), G5P_FMT(A8B8G8R8_SINT_PACK32, 4, false, G5P_SI, G5P1B, 0x1a8, G5P_SEL_RGBA), - G5P_FMT(R16_SINT, 2, false, G5P_SI | PVR_G5P_FMT_RENDER | PVR_G5P_FMT_PROBE_RENDER, G5P1B, 0x189, G5P_SEL_R001), - G5P_FMT(R16G16_SINT, 4, false, G5P_SI | PVR_G5P_FMT_RENDER | PVR_G5P_FMT_PROBE_RENDER, G5P1B, 0x1a3, G5P_SEL_RG01), - G5P_FMT(R16G16B16A16_SINT, 8, false, G5P_SI | PVR_G5P_FMT_RENDER | PVR_G5P_FMT_PROBE_RENDER, G5P1B, 0x1b2, G5P_SEL_RGBA), + G5P_FMT(R16_SINT, 2, false, G5P_SI | PVR_G5P_FMT_RENDER, G5P1B, 0x189, G5P_SEL_R001), + G5P_FMT(R16G16_SINT, 4, false, G5P_SI | PVR_G5P_FMT_RENDER, G5P1B, 0x1a3, G5P_SEL_RG01), + G5P_FMT(R16G16B16A16_SINT, 8, false, G5P_SI | PVR_G5P_FMT_RENDER, G5P1B, 0x1b2, G5P_SEL_RGBA), G5P_FMT(R32_SINT, 4, false, G5P_SI | PVR_G5P_FMT_RENDER | PVR_G5P_FMT_STORAGE, G5P1B, 0x1a1, G5P_SEL_R001), G5P_FMT(R32G32_SINT, 8, false, G5P_SI | PVR_G5P_FMT_RENDER, G5P1B, 0x1b1, G5P_SEL_RG01), G5P_FMT(R32G32B32A32_SINT, 16, false, G5P_SI | PVR_G5P_FMT_RENDER | PVR_G5P_FMT_STORAGE, G5P1B, 0x1b8, G5P_SEL_RGBA),