Don't declare colorWriteEnable dynamic state on depth-only pipelines #160

Manually merged
github merged 1 commit from gh-pr/160/head into gh-pr/160/base 2026-11-26 09:12:46 +00:00
Owner

@⁠Death-Whispers-U on GitHub · 2026-08-03 22:58 UTC · original
Death-Whispers-U:fix/color-write-enable-dynamic-state → main · +7 −1 · 1 files · 1 commits · merged 2026-08-08 06:21 UTC

Pipelines are created with VK_DYNAMIC_STATE_COLOR_WRITE_ENABLE_EXT unconditionally on non-Apple platforms, but the draw path only calls vkCmdSetColorWriteEnableEXT when there is at least one color attachment (renderDraw.cpp:405).

So a depth-only draw — a shadow pass or a depth prepass — reaches vkCmdDrawIndexed with the dynamic state declared and never set. That is what VUID-vkCmdDrawIndexed-None-07749 forbids:

vkCmdDrawIndexed(): VK_DYNAMIC_STATE_COLOR_WRITE_ENABLE_EXT state is dynamic,
but the command buffer never called vkCmdSetColorWriteEnableEXT.

Why it shows up now

The launcher turns validation on by default (vulkan_validation_enabled = true in configuration.h), and the debug callback currently treats validation errors as fatal, so PAC-MAN WORLD Re-PAC dies a few seconds after launch. From the command line with --vulkan-validation false the same build runs fine, which is probably why this went unnoticed.

Even without validation running, the draw is still out of spec — the value of colorWriteEnable is undefined at that point. This change is about the violation; whether a violation should end the process is a separate question.

Fix

Only declare the dynamic state when the pipeline has color attachments.

Both places read state.color_count from the same draw (renderDraw.cpp:1057 for pipeline creation, :1084 for the dynamic params), so the two conditions now match instead of drifting apart.

One file, 12 lines.

Testing

PAC-MAN WORLD Re-PAC with validation on:

before after
shaders compiled 7 21
VUID-07749 2 0
result dies runs

Reproduce with:

kyty_emulator.exe --vulkan-validation true --game "<PAC-MAN WORLD Re-PAC eboot.bin>"

Two other unrelated validation errors still show up in both runs. I left those alone.

**@⁠Death-Whispers-U** on GitHub · 2026-08-03 22:58 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/160) `Death-Whispers-U:fix/color-write-enable-dynamic-state` → `main` · +7 −1 · 1 files · 1 commits · merged 2026-08-08 06:21 UTC Pipelines are created with `VK_DYNAMIC_STATE_COLOR_WRITE_ENABLE_EXT` unconditionally on non-Apple platforms, but the draw path only calls `vkCmdSetColorWriteEnableEXT` when there is at least one color attachment (`renderDraw.cpp:405`). So a depth-only draw — a shadow pass or a depth prepass — reaches `vkCmdDrawIndexed` with the dynamic state declared and never set. That is what `VUID-vkCmdDrawIndexed-None-07749` forbids: ``` vkCmdDrawIndexed(): VK_DYNAMIC_STATE_COLOR_WRITE_ENABLE_EXT state is dynamic, but the command buffer never called vkCmdSetColorWriteEnableEXT. ``` ## Why it shows up now The launcher turns validation on by default (`vulkan_validation_enabled = true` in `configuration.h`), and the debug callback currently treats validation errors as fatal, so PAC-MAN WORLD Re-PAC dies a few seconds after launch. From the command line with `--vulkan-validation false` the same build runs fine, which is probably why this went unnoticed. Even without validation running, the draw is still out of spec — the value of colorWriteEnable is undefined at that point. This change is about the violation; whether a violation should end the process is a separate question. ## Fix Only declare the dynamic state when the pipeline has color attachments. Both places read `state.color_count` from the same draw (`renderDraw.cpp:1057` for pipeline creation, `:1084` for the dynamic params), so the two conditions now match instead of drifting apart. One file, 12 lines. ## Testing PAC-MAN WORLD Re-PAC with validation on: | | before | after | | --- | --- | --- | | shaders compiled | 7 | 21 | | VUID-07749 | 2 | 0 | | result | dies | runs | Reproduce with: ``` kyty_emulator.exe --vulkan-validation true --game "<PAC-MAN WORLD Re-PAC eboot.bin>" ``` Two other unrelated validation errors still show up in both runs. I left those alone.
Pipelines were created with VK_DYNAMIC_STATE_COLOR_WRITE_ENABLE_EXT
unconditionally on non-Apple platforms, but the draw path only calls
vkCmdSetColorWriteEnableEXT when there is at least one color attachment.
A depth-only draw therefore reached vkCmdDrawIndexed with the dynamic
state declared and never set, which violates
VUID-vkCmdDrawIndexed-None-07749.

With validation enabled the error is fatal, so any title that issues a
depth-only pass aborts. The launcher enables validation by default
(vulkan_validation_enabled = true), so this is the default configuration:
PAC-MAN WORLD Re-PAC crashes from the launcher while the same build runs
normally with --vulkan-validation false.

Gate the declaration on the same color_count the draw path uses. Both
sides read state.color_count from the same draw, so the two conditions
are now identical by construction.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:12:44 +00:00
github manually merged commit 45cbd41ed4 into gh-pr/160/base 2026-11-26 09:12:46 +00:00
Author
Owner

@⁠Crispy81 on GitHub · 2026-08-04 00:27 UTC · original

Interesting... I don't get that result. I've got both those settings ie - Shader and Vulkan validation turned on for that game, and I still get ingame.

Screenshot 2026-08-04 102646
**@⁠Crispy81** on GitHub · 2026-08-04 00:27 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/160#issuecomment-5173182936) Interesting... I don't get that result. I've got both those settings ie - Shader and Vulkan validation turned on for that game, and I still get ingame. <img width="1421" height="1621" alt="Screenshot 2026-08-04 102646" src="https://github.com/user-attachments/assets/f09a3bab-03c4-4abe-8ea8-fc64d961526d" />
This discussion has been locked. Commenting is limited to contributors.
No description provided.