From 724755d9df4a6b9aeb90d4d2e55543bf708f09c7 Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Tue, 25 Aug 2026 03:44:36 -0400 Subject: [PATCH] [Test] (DirectVulkan): pin the image-uniform numeric domain the unbound placeholder is chosen from --- MobileGL/MG_Test/SanityTest.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/MobileGL/MG_Test/SanityTest.cpp b/MobileGL/MG_Test/SanityTest.cpp index 1eee1aee..65edd04f 100644 --- a/MobileGL/MG_Test/SanityTest.cpp +++ b/MobileGL/MG_Test/SanityTest.cpp @@ -1550,6 +1550,30 @@ TEST(DirectVulkanSanity, SamplerUniformTypesPreserveTheirNumericDomain) { SamplerNumericDomain::Unknown); } +// The image half of the same question, which the sampler form above deliberately answers +// Unknown. It decides the format of the placeholder descriptor an UNBOUND image unit gets, and a +// `writeonly` declaration carries no format qualifier for it to fall back on - so an Unknown here +// is a lost draw, not a cosmetic gap. +TEST(DirectVulkanSanity, ImageUniformTypesPreserveTheirNumericDomain) { + using namespace MobileGL::MG_Backend::DirectVulkan; + + EXPECT_EQ(ProgramFactory::UniformTypeToImageNumericDomain(GL_IMAGE_2D), SamplerNumericDomain::Float); + EXPECT_EQ(ProgramFactory::UniformTypeToImageNumericDomain(GL_IMAGE_BUFFER), SamplerNumericDomain::Float); + EXPECT_EQ(ProgramFactory::UniformTypeToImageNumericDomain(GL_IMAGE_CUBE_MAP_ARRAY), + SamplerNumericDomain::Float); + EXPECT_EQ(ProgramFactory::UniformTypeToImageNumericDomain(GL_INT_IMAGE_2D_ARRAY), + SamplerNumericDomain::SignedInteger); + EXPECT_EQ(ProgramFactory::UniformTypeToImageNumericDomain(GL_INT_IMAGE_BUFFER), + SamplerNumericDomain::SignedInteger); + EXPECT_EQ(ProgramFactory::UniformTypeToImageNumericDomain(GL_UNSIGNED_INT_IMAGE_3D), + SamplerNumericDomain::UnsignedInteger); + EXPECT_EQ(ProgramFactory::UniformTypeToImageNumericDomain(GL_UNSIGNED_INT_IMAGE_BUFFER), + SamplerNumericDomain::UnsignedInteger); + // Samplers are the other function's business, and answering for them here would let a + // sampler binding silently take an image binding's placeholder rules. + EXPECT_EQ(ProgramFactory::UniformTypeToImageNumericDomain(GL_SAMPLER_2D), SamplerNumericDomain::Unknown); +} + TEST(DirectVulkanSanity, SampledViewFormatMatchesSamplerNumericDomainWithoutChangingComponentLayout) { using namespace MobileGL::MG_Backend::DirectVulkan;