vk_image_fuzz: enable shaderDrawParameters for the translated vertex shader #1417

Open
github-bot wants to merge 1 commit from github-bot/gh-1417 into main AGit
Owner

@⁠whoalin1 on GitHub · 2026-11-24 23:45 UTC · original
whoalin1:vk-image-fuzz-drawparams → main · +9 −0 · 1 files · 1 commits · open

Claimed in the coordination issue: #14

What

Every translated vertex shader declares the SPIR-V DrawParameters capability (BaseVertex/BaseInstance for the zero-based v0/v3 inputs), but vk_image_fuzz never enabled VkPhysicalDeviceVulkan11Features::shaderDrawParameters. Under LEONIDA_VK_VALIDATION=1, vkCreateShaderModule fails with VUID-VkShaderModuleCreateInfo-pCode-08740 on every case, on both vendors — silently zeroing entire image_fuzz campaigns (found when a fuzz sweep's AMD image_fuzz run produced all-fail results that turned out to be this harness bug, not translator bugs). Without validation, drivers tolerate the missing feature.

Fix (+9 lines, one file): query VkPhysicalDeviceVulkan11Features with a separate vkGetPhysicalDeviceFeatures2 call and set enable11.shaderDrawParameters in the device-creation chain (Features2 → Vulkan12Features → Vulkan11Features), matching the shape used by vk_bindless_test/vk_sampler_test.

Tested

  • Before fix (e0b08c77d): image_fuzz --seed 1 first case fails on both GPUs with VUID-08740.
  • After fix, LEONIDA_VK_VALIDATION=1 + LEONIDA_PC_TAIL_UBO=1:
    • AMD Radeon iGPU (gfx1035, driver 24.10.24): seed 1 --programs 60 → 60/60 match; seed 2 --programs 30 → 30/30; 0 VUIDs.
    • NVIDIA RTX 4070 SUPER: seed 1 → 60/60; seed 2 → 30/30; 0 VUIDs.
  • vk_bindless_test and vk_sampler_test ctest entries also pass with validation on both GPUs (same chain shape already worked there).

AI-assisted (Devin).

**@⁠whoalin1** on GitHub · 2026-11-24 23:45 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1417) `whoalin1:vk-image-fuzz-drawparams` → `main` · +9 −0 · 1 files · 1 commits · open Claimed in the coordination issue: https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14 ## What Every translated vertex shader declares the SPIR-V `DrawParameters` capability (BaseVertex/BaseInstance for the zero-based v0/v3 inputs), but `vk_image_fuzz` never enabled `VkPhysicalDeviceVulkan11Features::shaderDrawParameters`. Under `LEONIDA_VK_VALIDATION=1`, `vkCreateShaderModule` fails with `VUID-VkShaderModuleCreateInfo-pCode-08740` on **every case, on both vendors** — silently zeroing entire `image_fuzz` campaigns (found when a fuzz sweep's AMD image_fuzz run produced all-fail results that turned out to be this harness bug, not translator bugs). Without validation, drivers tolerate the missing feature. Fix (+9 lines, one file): query `VkPhysicalDeviceVulkan11Features` with a separate `vkGetPhysicalDeviceFeatures2` call and set `enable11.shaderDrawParameters` in the device-creation chain (`Features2 → Vulkan12Features → Vulkan11Features`), matching the shape used by `vk_bindless_test`/`vk_sampler_test`. ## Tested - Before fix (`e0b08c77d`): `image_fuzz --seed 1` first case fails on both GPUs with VUID-08740. - After fix, `LEONIDA_VK_VALIDATION=1` + `LEONIDA_PC_TAIL_UBO=1`: - AMD Radeon iGPU (gfx1035, driver 24.10.24): seed 1 `--programs 60` → **60/60 match**; seed 2 `--programs 30` → **30/30**; 0 VUIDs. - NVIDIA RTX 4070 SUPER: seed 1 → 60/60; seed 2 → 30/30; 0 VUIDs. - `vk_bindless_test` and `vk_sampler_test` ctest entries also pass with validation on both GPUs (same chain shape already worked there). AI-assisted (Devin).
Every translated VS declares the SPIR-V DrawParameters capability (BaseVertex /
BaseInstance for the zero-based v0 / v3), but the harness never enabled
VkPhysicalDeviceVulkan11Features::shaderDrawParameters. Under
LEONIDA_VK_VALIDATION=1, vkCreateShaderModule fails with
VUID-VkShaderModuleCreateInfo-pCode-08740 on every case, on both AMD and
NVIDIA, silently zeroing an image_fuzz campaign; drivers tolerate it without
validation.

Query Vulkan11 features on their own vkGetPhysicalDeviceFeatures2 call and
chain enable11 under the Vulkan12 features at device creation, as
vk_sampler_test and vk_bindless_test already do for their queries.

Verified: image_fuzz seed 1 (60 programs) and seed 2 (30 programs) match on
AMD Radeon Graphics and NVIDIA RTX 4070 SUPER with LEONIDA_VK_VALIDATION=1,
0 validation errors; before the fix the first case of each GPU failed with
the VUID. vk_bindless_test and vk_sampler_test run clean under validation on
both GPUs, so their chained Vulkan11-under-Vulkan12 queries needed no change.

Co-Authored-By: Devin <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:50:47 +00:00
Author
Owner

@⁠GeorgiyDemo on GitHub · 2026-11-24 23:55 UTC · original

Tested ff3dbee82 on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against main 364ab4eab:

  • Rebuilt runtime/test/vk_image_fuzz.cpp from this head (cmake + -DVulkan_INCLUDE_DIR=/opt/homebrew/include; no other changes needed).
  • Validation on (LEONIDA_VK_VALIDATION=1, LEONIDA_PC_TAIL_UBO=1, Khronos validation 1.4.363, --seed 1 --programs 1): main's binary reports 5 validation errors, including vkCreateShaderModule(): SPIR-V Capability DrawParameters was declared, but … shaderDrawParameters … (VUID-VkShaderModuleCreateInfo-pCode-08740, vertex module). With this head: 4 errors, and the DrawParameters one is gone.
  • The 4 remaining VUIDs are DenormPreserve for f16 (VUID-RuntimeSpirv-shaderDenormPreserveFloat16-06296 plus the matching capability VUID-08740) on both the vertex and fragment modules. They appear with main's binary too, so they are pre-existing on MoltenVK (shaderDenormPreserveFloat16 is false there), not caused by this PR.
  • Without validation: --seed 1 --programs 20 matches 20/20 on both the main binary and this head — no functional change on MoltenVK.

AI-assisted; synthetic fixtures only, no game data.

**@⁠GeorgiyDemo** on GitHub · 2026-11-24 23:55 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1417#issuecomment-7147953445) Tested `ff3dbee82` on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against `main` `364ab4eab`: - Rebuilt `runtime/test/vk_image_fuzz.cpp` from this head (cmake + `-DVulkan_INCLUDE_DIR=/opt/homebrew/include`; no other changes needed). - **Validation on** (`LEONIDA_VK_VALIDATION=1`, `LEONIDA_PC_TAIL_UBO=1`, Khronos validation 1.4.363, `--seed 1 --programs 1`): `main`'s binary reports 5 validation errors, including `vkCreateShaderModule(): SPIR-V Capability DrawParameters was declared, but … shaderDrawParameters …` (VUID-VkShaderModuleCreateInfo-pCode-08740, vertex module). With this head: 4 errors, and the DrawParameters one is gone. - The 4 remaining VUIDs are `DenormPreserve` for f16 (`VUID-RuntimeSpirv-shaderDenormPreserveFloat16-06296` plus the matching capability VUID-08740) on both the vertex and fragment modules. They appear with `main`'s binary too, so they are pre-existing on MoltenVK (`shaderDenormPreserveFloat16` is false there), not caused by this PR. - **Without validation**: `--seed 1 --programs 20` matches 20/20 on both the `main` binary and this head — no functional change on MoltenVK. AI-assisted; synthetic fixtures only, no game data.
Author
Owner

@⁠whoalin1 on GitHub · 2026-11-25 20:07 UTC · original

Rebased cleanly onto current main (db1a22d29) as 285801f0a to refresh the stale CI baseline; no conflicts. The branch remains the vk_image_fuzz shaderDrawParameters enablement. AI-assisted with Devin.

**@⁠whoalin1** on GitHub · 2026-11-25 20:07 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1417#issuecomment-7173226573) Rebased cleanly onto current main (`db1a22d29`) as `285801f0a` to refresh the stale CI baseline; no conflicts. The branch remains the vk_image_fuzz shaderDrawParameters enablement. AI-assisted with Devin.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1417/head:github-bot/gh-1417'
git switch 'github-bot/gh-1417'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1417'
git switch 'github-bot/gh-1417'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1417'
git switch 'github-bot/gh-1417'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1417'
git switch 'main'
git merge --squash 'github-bot/gh-1417'
git switch 'main'
git merge --ff-only 'github-bot/gh-1417'
git switch 'main'
git merge 'github-bot/gh-1417'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.