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; 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),