cube-vksc: Fix Windows D2D display acquisition and pipeline cache handling - #47
cube-vksc: Fix Windows D2D display acquisition and pipeline cache handling#47dgkoch wants to merge 1 commit into
Conversation
0b844c1 to
377d68e
Compare
No question, that's clearly a bug.
This seems arbitrary. The driver shouldn't report display modes that is not actually supported.
This looks like a bug in the pcutil JSON schema, as we did intend to retain the ability of the old schema allowing integer values (encoded as integer or string). We'll have to look into that.
Such PCC implementations seem to be broken, as the spec clearly states that the viewport/scissor arrays can be |
| "dstAlphaBlendFactor": "VK_BLEND_FACTOR_ZERO", | ||
| "alphaBlendOp": "VK_BLEND_OP_ADD", | ||
| "colorWriteMask": "0xf" | ||
| "colorWriteMask": "VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT" |
There was a problem hiding this comment.
Actually, I looked into the history of this. Apparently the 0xf format (while allowed by the legacy invalid JSON schema), was never accepted even by the legacy parser, but the legacy generator did produce it, so I think this part is a legitimate fix for remnants of the legacy tooling.
18d8b76 to
7484f28
Compare
I investigated this more after posting (trying to fix the alleged pcc bug), and it's actually the pcutils parser that rejects it. It turns out that the arrays can be NULL, but not |
I see. Then yes, the JSON has to be fixed. Unfortunately, that JSON pre-dates the new tools and we never went there to re-validate / fix it. Sure, the Vulkan SC Emulation PCC could use the new parser. It's one of the many good-to-have features we postponed due to other priorities. I guess we may have to revisit that. |
Fix several issues preventing vksccube from running on Windows
Direct-to-Display (D2D) or on real VulkanSC hardware:
1. Fix inverted condition in WinRT display acquisition: the condition
`wsi_platform != WSI_PLATFORM_DISPLAY` was backwards; acquire the
display only when display mode is actually in use. Also fix a typo
in the error message ("get acqurie" -> "acquire").
2. Add --native-resolution flag: some implementations only support
swapchain creation at the display's native panel resolution. When
--native-resolution is specified, enumerate all available modes and
select the one matching the display's physicalResolution; fall back
to mode[0] with a warning if no matching mode is found. Without the
flag, mode[0] is used (default, spec-correct behaviour). If
swapchain creation fails in display mode, an error message directs
the user to --native-resolution.
3. Fix cube.pc.json: use named flag format for colorWriteMask as
required by the pcutil schema (VK_COLOR_COMPONENT_*_BIT instead of
the hex literal "0xf"). Use "NULL" for pViewports and pScissors
when those fields are dynamic state, matching the format the pcutil
serializer produces for null pointers. Also regenerate
pipeline_cache.h using the VulkanSC SDK 1.0.22 emulation layer PCC.
Tested on NVIDIA RTX 5070 with VulkanSC SDK 1.0.22:
- Direct-to-display with --native-resolution: spinning cube visible on
1920x1200 display, on both drivers that enumerate only native modes
and drivers that enumerate non-native modes that fail swapchain
creation.
- Without --native-resolution on an affected driver: clear error
message directing the user to use --native-resolution.
- File output mode (--wsi file): all pixels non-zero, max 230/255.
- File output mode with emulation ICD: exit code 0, embedded cache works.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
7484f28 to
c1d9bfa
Compare
Fair. However, our direct display implementation has behaved that way for Vulkan (and now Vulkan SC) for at least several years, so while I'll look into improving it, all of our shipping drivers behave this way today. That said the heuristic was a bit janky, so I've just replaced it with an explicit --native-resolution option. |
Summary
Fix inverted WinRT display acquisition condition:
wsi_platform != WSI_PLATFORM_DISPLAYwas backwards — the display was never acquired when using display mode. Fix to== WSI_PLATFORM_DISPLAY. Also fix typo in error message ("get acqurie" → "acquire").Add
--native-resolutionflag: Some implementations only support swapchain creation at the display's native panel resolution. When--native-resolutionis specified, all available modes are enumerated and the one matchingphysicalResolutionis selected; if none matches, falls back to mode[0] with a warning. Without the flag, mode[0] is used (default, spec-correct behaviour). If swapchain creation fails in display mode, an actionable error message directs the user to--native-resolution.Fix
cube.pc.json: Use named flag format forcolorWriteMaskas required by the pcutil JSON schema (VK_COLOR_COMPONENT_*_BITinstead of"0xf"). Use"NULL"forpViewportsandpScissorswhen those fields are dynamic state, matching the format the pcutil serializer produces for null pointers.Regenerate
pipeline_cache.husing the VulkanSC SDK 1.0.22 emulation layer PCC.Tested
On NVIDIA RTX 5070 with VulkanSC SDK 1.0.22:
--wsi display --native-resolution: spinning cube visible on 1920×1200 display, on both drivers that enumerate only native modes and drivers that enumerate non-native modes that fail swapchain creation. ✓--wsi displaywithout--native-resolutionon an affected driver: clear error message directing the user to use--native-resolution. ✓--wsi file: all pixels non-zero, max 230/255. ✓VK_DRIVER_FILES=<vksconvk.json>): exit code 0, embedded pipeline cache works. ✓🤖 Generated with Claude Code