Repository navigation
scripts: Never chain VkFormatProperties3 and VkFormatProperties3KHR together - #1046
cgopinathc wants to merge 1 commit into
Conversation
…ogether
'vkprofiles transform --pull aliases' expanded every VkFormatProperties
entry into both VkFormatProperties3 and VkFormatProperties3KHR. The two
names are aliases sharing a single sType, and gen_profiles_solution.py
only special-cased the KHR spelling, so the generated library chained two
structs with identical sType into one vkGetPhysicalDeviceFormatProperties2
pNext chain. That violates VUID-VkFormatProperties2-sType-unique and makes
the result driver dependent:
- PowerVR fills every struct in the chain, so both copies pass.
- Mali fills only the first struct of a given sType; the duplicate stays
zeroed and the comparator reports the format as unsupported.
On Mali devices (Pixel 7 Pro / Mali-G710, Pixel 9 Pro Fold / Mali-G715)
this caused VP_ANDROID_15_requirements, and every profile that inherits
it, to be reported as NOT SUPPORTED on VK_FORMAT_A4B4G4R4_UNORM_PACK16_EXT
even though the device meets every requirement. The 'transform_android'
step started pulling aliases in 0b8bb3e / 5219d14 (Sept 2026); builds
generated straight from profiles/Android were unaffected.
Fix at the source and harden the generator:
* format_flag_converter.py: expand_format_struct() now emits a single
64-bit struct - VkFormatProperties3 on Vulkan >= 1.3, otherwise
VkFormatProperties3KHR when VK_KHR_format_feature_flags2 is enabled.
* gen_profiles_solution.py: treat the core and KHR names as the same
struct when building the format chain, and compare the single chained
struct against capabilities written under either name, so a profile
that still lists both can never produce a duplicate-sType chain.
* test_format_flags.py: add regression test covering the version /
extension combinations.
Verified with the Android profiles checker app: cheetah and comet now
report VP_ANDROID_15/16 (and 17 on comet) as SUPPORTED; blazer unchanged.
|
User cgopinathc not on autobuild list. Waiting for curator authorization before starting CI build. |
1 similar comment
|
User cgopinathc not on autobuild list. Waiting for curator authorization before starting CI build. |
|
Hi @cgopinathc ! Something is not clear to me. Using In the case of the Vulkan profiles API library generation, As a result, after calling, If you could share reproduction cases, that would be great. |
|
Thanks for taking a look — you're right that library --strip dedupes the profile JSON, and the #1047 tests confirm that. The problem is one stage later: gen_profiles_solution.py re-expands the format struct names when it builds the pNext chain, so the duplicate comes back in the generated C++ regardless of what the JSON looks like. Same two steps the Android pipeline / vkprofiles_graph.json runpython3 scripts/vkprofiles.py transform --registry $REG/vk.xml python3 scripts/vkprofiles.py library --registry $REG/vk.xml After this we could compare the chains of VkFormatProperties3KHR and VkFormatProperties3 If we can fix only the gen_profiles_solution.py, that would be enough to fix the bug, what do you think? |
I am investigating. I think there are multiple issues. The "strip" duplicated |
|
I believe this is resolved with #1055 Let me know what you think ! |
|
I am closing for now but if I am missing something, please reopen ! |
Fixes #1045
Problem
Since
transform --pull aliaseswas enabled for thetransform_androidstep,expand_format_struct()emits bothVkFormatProperties3andVkFormatProperties3KHRfor everyVkFormatPropertiesentry.gen_profiles_solution.pyonly special-cases the KHR spelling, so the core name falls through and the generated library chains two structs with the samesTypeinto thevkGetPhysicalDeviceFormatProperties2pNext chain:VkFormatProperties3KHR formatProperties3KHR{ VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_3_KHR, nullptr }; VkFormatProperties3 formatProperties3 { VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_3, &formatProperties3KHR };This violates
VUID-VkFormatProperties2-sType-uniqueand the outcome is driver dependent: PowerVR fills both copies, Arm Mali fills only the first and leaves the duplicate zeroed, so the comparator reports the format as unsupported. On Mali devicesVP_ANDROID_15_requirements— and every profile inheriting it — is falsely reported as NOT SUPPORTED onVK_FORMAT_A4B4G4R4_UNORM_PACK16_EXTeven though all bits are present.Fix
scripts/source/format_flag_converter.py—expand_format_struct()now emits a single 64-bit struct:VkFormatProperties3on Vulkan ≥ 1.3, otherwiseVkFormatProperties3KHRwhenVK_KHR_format_feature_flags2is enabled, otherwise none.scripts/gen_profiles_solution.py— treat the core and KHR names as the same struct when building the format chain, and compare the single chained struct against capabilities written under either name, so a profile that still lists both can never produce a duplicate-sTypechain.scripts/tests/test_format_flags.py— regression testtestExpandFormatStructSingle64BitAliascovering the version / extension combinations and KHR-named input normalisation.Verification
Generated header now contains one
VkFormatProperties3[KHR]per format chain (previously two), with the comparators for both 4444 formats intact.Android profiles checker app results:
scripts/tests: 200 pass / 7 skipped. The 4 pre-existing failures intest_profiles_json_utilsare unrelated and identical onmain.