Silent hill bringup #654
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!654
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/654/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@shadowbeat070 on GitHub · 2026-09-16 23:40 UTC · original
shadowbeat070:silent-hill-bringup→main· +9193 −864 · 81 files · 37 commits · closed without mergingMany fixes and implementations to make silent hill f and the silent hill 2 remake reach gameplay and render (mostly) correct.
Summary
Shader Recompiler
Shader descriptors
Renderer and texture cache
a dispatch or draw whose counts exceeding the the driver limit now get skipped instead of resetting the driver.
readbacks over 32Mib are split.
images age by presented frames and no longer queue submissions.
Driver pipline cache persists across runs (maybe this shouldn't be merged either).
an image reallocated larger is expanded.
R11G11B10 and E5B9G9R9 targets no longer share an 8 bit image which would clamp hdr.
a stencil pass can no longer take over a live depth target.
HTile/CMask/FMask state is tracked beyond 32 slices.
readback linear images is enabled by default.
Device buffers that are read before anything writes them start zeroed.
Red zone protection in RBP framed functions too, execute only code is scanned for function starts since silent hill f's unwind tables only cover 7% of it's code.
an end of pipe address patch on a foreign packet is rejected instead of exiting, UE writes that scratc memory from several threads.
Silent hill 2 remake was tested with the graphics mode set to performance. Silent hill 2 crased undetermanistically after starting new game occasionally.
PR follows contribution guidelines and the Windows build is verified.
Summary by CodeRabbit
New Features
Bug Fixes
Tests
@coderabbitai[bot] on GitHub · 2026-09-16 23:40 UTC · original · edited 2026-09-18 00:44 UTC
📝 Walkthrough
Walkthrough
Changes
The pull request updates GPU memory and texture handling, dispatch validation, pipeline caching, shader decoding and recompilation, SPIR-V emission, Windows red-zone patching, and related tests. Unsupported shader and packet cases now return structured failures instead of terminating execution.
Graphics and runtime
src/graphics/host_gpu/renderer/cache/*,src/graphics/host_gpu/renderer/render*.cpp,src/kernel/memory.*src/graphics/host_gpu/renderer/cache/textureCache.*,src/graphics/host_gpu/renderer/image/*,src/graphics/presentation/window/*src/graphics/host_gpu/renderer/pipeline/*,src/graphics/shader/recompiler/*src/loader/*,CMakeLists.txt,src/common/emulatorConfig.h,src/main.cpptests/*,src/libs/agc.cppPriority: ➖ Normal
Estimated code review effort: 5 (Critical) | ~90 minutes
Change: Feature
Suggested reviewers:
nmzikMerge Risk: 🟠 High · up to
d0a69The change can produce incorrect rendering, skip affected shaders or draws, leave CPU-visible data stale, and crash while loading malformed modules. These issues should be fixed before merging.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring Coverage
Explanation
Docstring coverage is 19.14% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 324 functions across 58 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1
⚔️ Resolve merge conflicts 💡
silent-hill-bringup🧪 Generate unit tests (beta)
Comment
@coderabbitai helpto get the list of available commands.@shadowbeat070 on GitHub · 2026-09-16 23:46 UTC · original
@shadowbeat070 on GitHub · 2026-09-17 00:11 UTC · original
@ -639,0 +698,4 @@m_bda_tracked_ranges.Add(begin, end - begin);m_bda_unmarked_ranges.Add(begin, end - begin);});missing.ForEach([this](uint64_t begin, uint64_t end) { (void)FindBuffer(begin, end - begin); });@coderabbitai[bot] on GitHub · 2026-09-17 00:51 UTC · original
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Track newly created BDA pages before registration.
missingpages are created without first adding them tom_bda_tracked_ranges. Therefore,Registerwrites their page-table entries withoutBDA_STORE_TRACKED_BIT.A later BDA store can use the untagged entry without a fault.
MarkBdaStoresInRangealso cannot find that page. The CPU backing can remain stale after the GPU write.Add each missing range to both tracking sets before
FindBufferregisters it.Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents
@ -1796,0 +1882,4 @@}std::vector<TextureDownloadChunk> chunks;if (regions.empty() || !TexturePlanDownloadChunks(regions, info.data.size, block, capacity,chunk_alignment, chunks)) {@coderabbitai[bot] on GitHub · 2026-09-17 00:51 UTC · original
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 27926
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 19186
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 50371
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 29955
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 5241
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 10454
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 2688
Pass the copy alignment to
TexturePlanDownloadChunks.For a linear transfer,
CalcTextureSliceStridecan selectinfo.data.size / depthwithout block alignment.TextureBuildImageCopiesthen uses that stride inbufferOffset. The planner currently uses alignment1, so it accepts these offsets and rebases them.DownloadImageBatchaligns only the mapped chunk base. An unaligned rebased offset can therefore reachvkCmdCopyImageToBufferand violate its offset alignment requirement.🤖 Prompt for AI Agents
@ -112,1 +112,4 @@S8 = 1u << 24,// Vulkan gives each packed float format a class of its own: no 32-bit view shares its texels.B10G11R11 = 1u << 25,E5B9G9R9 = 1u << 26,@coderabbitai[bot] on GitHub · 2026-09-17 00:51 UTC · original
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 10686
🌐 Web query:
Vulkan format compatibility class B10G11R11_UFLOAT_PACK32 E5B9G9R9_UFLOAT_PACK32 R32_UINT💡 Result:
<search_synthesis>
In the Vulkan API, the formats VK_FORMAT_B10G11R11_UFLOAT_PACK32, VK_FORMAT_E5B9G9R9_UFLOAT_PACK32, and VK_FORMAT_R32_UINT belong to the same compatibility class, categorized as a 32-bit format class [1]. Specifically, within the internal validation and utility definitions of the Vulkan ecosystem, both B10G11R11_UFLOAT_PACK32 and E5B9G9R9_UFLOAT_PACK32 are explicitly classified under the VK_FORMAT_COMPATIBILITY_CLASS_32_BIT [1]. These formats are treated as compatible for certain operations, such as image views and copying, because they occupy the same number of bits per texel block (32 bits) and share similar structural characteristics defined by the Vulkan specification for memory layout compatibility [1][2]. While R32_UINT is also a 32-bit format, note that "compatibility" in Vulkan is technically defined by the specification&
#39;s rules regarding block size and format type; formats that share the same bit-depth and layout constraints are often grouped together in implementation-specific compatibility classes [1][2].</search_synthesis>
<source_evidence>
https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/blob/master/layers/vk_format_utils.cpp { ... {VK_FORMAT_R64G64B64A64_UINT, {32, 4, VK_FORMAT_COMPATIBILITY_CLASS_2 ... 6_BIT}}, {VK_FORMAT_R64G64B64A64_SINT, {32, 4, VK_FORMAT_COMPATIBILITY_CLASS_256_BIT}}, {VK_FORMAT_R64G64B64A64_SFLOAT, {32, 4, VK_FORMAT_COMPATIBILITY_CLASS_256_BIT}}, {VK_FORMAT_B10G11R11_UFLOAT_PACK32, {4, 3, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT}}, {VK_FORMAT_E5B9G9R9_UFLOAT_PACK32, {4, 3, VK_FORMAT_COMPATIBILITY_CLASS_32_BIT}}, {VK_FORMAT_D16_UNORM, {2, 1, VK_FORMAT_COMPATIBILITY_CLASS_NONE_BIT}}, {VK_FORMAT_X8_D24_UNORM_PACK32, {4, 1, VK_FORMAT_COMPATIBILITY_CLASS_NONE_BIT}}, {VK_FORMAT_D32_SFLOAT, {4, 1, VK_FORMAT_COMPATIBILITY_CLASS_NONE_BIT}}, {VK_FORMAT_S8_UINT, {1, 1, VK_FORMAT_COMPATIBILITY_CLASS_NONE_BIT}}, {VK_FORMAT_D16_UNORM_S8_UINT, {3, 2, VK_FORMAT_COMPATIBILITY_CLASS_NONE_BIT}}, {VK_FORMAT_D24_UNORM_S8_UINT, {4, 2, VK_FORMAT_COMPATIBILITY_CLASS_NONE_BIT}}, {VK_FORMAT_D32_SFLOAT_S8_UINT, {8, 2, VK_FORMAT_COMPATIBILITY_CLASS_NONE_BIT}}, {VK_FORMAT_BC1_RGB_UNORM_BLOCK, ... {8, ... norm = false ... switch ( ... ) { case https://vkdoc.net/chapters/formats PACK32 ... PACK32` ... `VK_FORMAT_ ... - `VK_FORMAT_A2R10G10B10_UINT_PACK32` - `VK_FORMAT_A2R10G10B10_SINT_PACK32` - `VK_FORMAT_A2B10G10R10_UNORM_PACK32` - `VK_FORMAT_A2B10G10R10_SNORM_PACK32` - `VK_FORMAT_A2B10G10R10_USCALED_PACK32` - `VK_FORMAT_A2B10G10R10_SSCALED_PACK32` - `VK_FORMAT_A2B10G10R10_UINT_PACK32` - `VK_FORMAT_A2B10G10R10_SINT_PACK32` - `VK_FORMAT_B10G11R11_UFLOAT_PACK32` - `VK_FORMAT_E5B9G9R9_UFLOAT_PACK32` - `VK_FORMAT_X8_D24_UNORM_PACK32` ... `VK_FORMAT_B10G11R11_UFLOAT_PACK32` ... `VK_FORMAT_E5B9G9R9_UFLOAT_PACK32` ... ### Format Compatibility Classes ... Uncompressed color formats are compatible with each other if they occupy the same number of bits per texel block as long as neither or both are alpha formats (e.g.,`VK_FORMAT_A8_UNORM`) . Compressed color formats are compatible with each other if the only difference between them is the numeric format of the uncompressed texels. Each depth/stencil format is only compatible with itself. In the following table, all the formats in the same row are compatible. Each format has a defined texel block extent specifying how many texels each texel block represents in each dimension. ... _PACK1 ... VK_FORMAT ... VK_FORMAT_R16_SINT`,`VK_FORMAT_R16_SFLOAT` | ... _FORMAT_ ... VK_FORMAT_ ... R8A ... ORM`,`VK_FORMAT_ ... G8R8A8_SNORM`,`VK_FORMAT_ ... G8R8A8_USCALED`,`VK_FORMAT_ ... 8G8R8A8_SSCALED`,`VK_FORMAT_ ... 8G8R8A8_ ... `,`VK_FORMAT_ ... 8G8R8A8 ... INT`,`VK_FORMAT_ ... _FORMAT_ ... CALED_ ... PACK32`,`VK_FORMAT_A8 ... 8R8_ ... _PACK32`,`VK_FORMAT_A8B8G8R8_SINT_PACK32`,`VK_FORMAT_A8B8G8R8_SRGB_PACK32`,`VK_FORMAT_A2R10G10B10_UNORM_PACK32`,`VK_FORMAT_A2R10G10B10_SNORM_PACK32`,`VK_FORMAT_A2R10G10B10_USCALED_PACK32`,`VK_FORMAT_A2R10G10B10_SSCALED_PACK32`,`VK_FORMAT_A2R10G10B10_UINT_PACK32`,`VK_FORMAT_A2R10G10B10_SINT_PACK32`,`VK_FORMAT_A2B10G10R10_UNORM_PACK32`,`VK_FORMAT_A2B10G10R10_SNORM_PACK32`,`VK_FORMAT_A2B10G10R10_USCALED_PACK32`,`VK_FORMAT_A2B10G10R10_SSCALED_PACK32`,`VK_FORMAT_A2B10G10R10_UINT_PACK32`,`VK_FORMAT_A2B10G10R10_SINT_PACK32`,`VK_FORMAT_R16G16_UNORM`,`VK_FORMAT_R16G16_SNORM`,`VK_FORMAT_R16G16_USCALED`,`VK_FORMAT_R16G16_SSCALED` | ... | 32-bit (continued)Block size 4 byte1x1x1 block extent1 texel/block | `VK_FORMAT_R16G16_UINT`,`VK_FORMAT_R16G16_SINT`,`VK_FORMAT_R16G16_SFLOAT`,`VK_FORMAT_R32_UINT`,`VK_FORMAT_R32_SINT`,`VK_FORMAT_R32_SFLOAT`,`VK_FORMAT_B10G11R11_UFLOAT_PACK32`,`VK_FORMAT_E5B9G9R9_UFLOAT_PACK32` | https://docs.vulkan.org/refpages/latest/refpages/source/VkFormat.html 38, ... 8, ... , ... , ... PACK32 ... 56, ... _PACK32 = ... 57, VK ... _A2 ... 0G10B1 ... _PACK32 ... 58, VK_ ... _A2 ... PACK32 = ... 59, ... _PACK32 ... 60, VK_FORMAT ... PACK32 ... 61, ... 62, ... PACK32 ... 3, ... _A2B10G10R ... , VK_ ... 65, VK_ ... A2B ... _PACK32 = 66, VK_ ... _A2B10G10 ... 10_ ... _PACK32 = 67, VK_FORMAT_A2B10G10R10 ... _PACK32 = 68, VK_FORMAT_A2B10G10R ... _PACK32 = ... 69, VK_ ... _R16 ... UNORM = 70, VK_FORMAT_R16_SNORM = 71, VK_FORMAT_R16 ... USCALED = 72, VK_FORMAT_R16_SSCALED = 73, VK_FORMAT_R16_UINT = 74, VK_FORMAT_R16_SINT = 75, VK_FORMAT_R16_SFLOAT = 76, VK_FORMAT_R16G16_UNORM = 77, VK_FORMAT_R16G16_SNORM = 78, VK_FORMAT_R16G16_USCALED = 79, VK_FORMAT_R16G16_SSCALED = 80, VK_FORMAT_R16G16_UINT = 81, VK_FORMAT_R16G16_SINT = 82, VK_FORMAT_R16G1 ... FLOAT = 83, VK_FORMAT_R16G16B16_UNORM = 84, VK_FORMAT_R16G16B16_SNORM = 85, VK_FORMAT_R16G16B16_USCALED = 86, VK_FORMAT_R16G16B16_SSCALED = 87, VK_FORMAT_R16G16B16_UINT = 88, VK_FORMAT_R16G16B16_SINT = 89, VK_FORMAT_R16G16B16_SFLOAT = 90, VK_FORMAT_R16G16B16A16_UNORM = 91, VK_FORMAT_R16G16B16A16_SNORM = 92, VK_FORMAT_R16G16B16A16_USCALED = 93, VK_FORMAT_R16G16B16A16_SSCALED = 94, VK_FORMAT_R16G16B16A16_UINT = 95, VK_FORMAT_R16G16B16A16_SINT = 96, VK_FORMAT_R16G16B16A16_SFLOAT = 97, VK_FORMAT_R32_UINT = 98, VK_FORMAT_R32_SINT = 99, VK_FORMAT_R32_SFLOAT = 100, VK_FORMAT_R32G32_UINT = 101, VK_FORMAT_R32G32_SINT = 102, VK_FORMAT_R32G32_SFLOAT = 103, VK_FORMAT_R32G32B32_UINT = 104, VK_FORMAT_R32G32B32_SINT = 105, VK_FORMAT_R32G32B32_SFLOAT = 106, VK_FORMAT_R32G32B32A32_UINT = 107, VK_FORMAT_R32G32B32A32_SINT = 108, VK_FORMAT_R32G32B32A32_SFLOAT = 109, VK_FORMAT_R64_UINT = 110, VK_FORMAT_R64_SINT = 111, VK_FORMAT_R64_SFLOAT = 112, VK_FORMAT_R64G64_UINT = 113, VK_FORMAT_R64G64_SINT = 114, VK_FORMAT_R64G64_SFLOAT = 115, VK_FORMAT_R64G64B64_UINT = 116, VK_FORMAT_R64G64B64_SINT = 117, VK_FORMAT_R64G64B64_SFLOAT = 118, VK_FORMAT_R64G64B64A64_UINT = 119, VK_FORMAT_R64G64B64A64_SINT = 120, VK_FORMAT_R64G64B64A64_SFLOAT = 121, VK_FORMAT_B10G11R11_UFLOAT_PACK32 = 122, VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 = 123, VK_FORMAT_D16_UNORM = 124, VK_FORMAT_X8_D24_UNORM_PACK32 = 125, VK_FORMAT_D32_SFLOAT = 126, VK_FORMAT_S8_UINT = 127, VK_FORMAT_D16_UNORM_S8_UINT = 128, VK_FORMAT_D24_UNORM_S8_UINT = 129, VK_FORMAT_D32_SFLOAT_S8_UINT = 130, VK_FORMAT_BC1_RGB_UNORM_BLOCK = 131, VK_FORMAT_BC1_RGB_SRGB_BLOCK = 132, VK_FORMAT_BC1_RGBA_UNORM_BLOCK = 133, VK_FORMAT_BC1_RGBA_SRGB_BLOCK = 134, VK_FORMAT_BC2_UNORM_BLOCK = 135, VK_FORMAT_BC2_SRGB_BLOCK = 136, VK_FORMAT_BC3_UNORM_BLOCK = 137, VK_FORMAT_BC3_SRGB_BLOCK = 138, VK_FORMAT_BC4_UNORM_BLOCK = 139, VK_FORMAT_BC4_SNORM_BLOCK = 140, VK_FORMAT_BC5_UNORM_BLOCK = 141, VK_FORMAT_BC5_SNORM_BLOCK = 142, VK_FORMAT_BC6H_UFLOAT_BLOCK = 143, VK_FORMAT_BC6H_SFLOAT_BLOCK = 144, VK_FORMAT_BC7_UNORM_BLOCK = 145, VK_FORMAT_BC7_SRGB_BLOCK = 146, VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK = 147, VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK = 148, VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK = 149, VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK = 150, VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK = 151, VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK = 152, VK_FORMAT_EAC_R11_UNORM_BLOCK = 153, VK_FORMAT_EAC_R11_SNORM_BLOCK = 154, VK_FORMAT_EAC_R11G11_UNORM_BLOCK = 155, VK_FORMAT_EAC_R11G11_SNORM_BLOCK = 156, VK_FORMAT_ASTC_4x4_UNORM_BLOCK = 157, VK_FORMAT_ASTC_4x4_SRGB_BLOCK = 158, VK_FORMAT_ASTC_5x4_UNORM_BLOCK = 159, VK_FORMAT_ASTC_5x4_SRGB_BLOCK = 160, VK_FORMAT_ASTC_5x5_UNORM_BLOCK = 161, VK_FORMAT_ASTC_5x5_SRGB_BLOCK = 162, VK_FORMAT_ASTC_6x5_UNORM_BLOCK = 163, VK_FORMAT_ASTC_6x5_SRGB_BLOCK = 164, VK_FORMAT_ASTC_6x6_UNORM_BLOCK = 165, VK_FORMAT_ASTC_6x6_SRGB_BLOCK = 166, VK_FORMAT_ASTC_8x5_UNORM_BLOCK = 167, VK_FORMAT_ASTC_8x5_SRGB_BLOCK = 168, VK_FORMAT_ASTC_8x6_UNORM_BLOCK = 169, VK_FORMAT_ASTC_8x6_SRGB_BLOCK = 170, VK_FORMAT_ASTC_8x8_UNORM_BLOCK = 171, VK_FORMAT_ASTC_8x8_SRGB_BLOCK = 172, VK_FORMAT_ASTC_10x5_UNORM_BLOCK = 173, VK_FORMAT_ASTC_10x5_SRGB_BLOCK = 174, VK_FORMAT_ASTC_10x6_UNORM_BLOCK = 175, VK_... https://docs.vulkan.org/spec/latest/chapters/formats.html PACK32 ... PACK32 ... 10G ... PACK32 = 66, ... _PACK32 = 67, VK_ ... _PACK32 = ... 68, ... A2B10G10R ... _PACK32 = 69, VK_ ... _R16 ... UNORM = 70, VK_FORMAT_R16_SNORM = 71, VK_FORMAT_R16_US ... ED = 72, VK_FORMAT_R16_ ... CALED = 73, VK_FORMAT_R16 ... UINT = 74, VK_FORMAT_R16_SINT = 75, VK_FORMAT_R16_SFLOAT = 76, VK_FORMAT_R16G16_UNORM = 77, VK_FORMAT_R16G16_SNORM = 78, VK_FORMAT_R16G16_USCALED = 79, VK_FORMAT_R16G16_SSCALED = 80, VK_FORMAT_R16G16_UINT = 81, VK_FORMAT_R16G16_SINT = 82, VK_FORMAT_R16G16_SFLOAT = 83, VK_FORMAT_R16G16B16_UNORM = 84, VK_FORMAT_R16G16B16_SNORM = 85, VK_FORMAT_R16G16B16_USCALED = 86, VK_FORMAT_R16G16B16_SSCALED = 87, VK_FORMAT_R16G16B16_UINT = 88, VK_FORMAT_R16G16B16_SINT = 89, VK_FORMAT_R16G16B16_SFLOAT = 90, VK_FORMAT_R16G16B16A16_UNORM = 91, VK_FORMAT_R16G16B16A16_SNORM = 92, VK_FORMAT_R16G16B16A16_USCALED = 93, VK_FORMAT_R16G16B16A16_SSCALED = 94, VK_FORMAT_R16G16B16A16_UINT = 95, VK_FORMAT_R16G16B16A16_SINT = 96, VK_FORMAT_R16G16B16A16_SFLOAT = 97, VK_FORMAT_R32_UINT = 98, VK_FORMAT_R32_SINT = 99, VK_FORMAT_R32_SFLOAT = 100, VK_FORMAT_R32G32_UINT = 101, VK_FORMAT_R32G32_SINT = 102, VK_FORMAT_R32G32_SFLOAT = 103, VK_FORMAT_R32G32B32_UINT = 104, VK_FORMAT_R32G32B32_SINT = 105, VK_FORMAT_R32G32B32_SFLOAT = 106, VK_FORMAT_R32G32B32A32_UINT = 107, VK_FORMAT_R32G32B32A32_SINT = 108, VK_FORMAT_R32G32B32A32_SFLOAT = 109, VK_FORMAT_R64_UINT = 110, VK_FORMAT_R64_SINT = 111, VK_FORMAT_R64_SFLOAT = 112, VK_FORMAT_R64G64_UINT = 113, VK_FORMAT_R64G64_SINT = 114, VK_FORMAT_R64G64_SFLOAT = 115, VK_FORMAT_R64G64B64_UINT = 116, VK_FORMAT_R64G64B64_SINT = 117, VK_FORMAT_R64G64B64_SFLOAT = 118, VK_FORMAT_R64G64B64A64_UINT = 119, VK_FORMAT_R64G64B64A64_SINT = 120, VK_FORMAT_R64G64B64A64_SFLOAT = 121, VK_FORMAT_B10G11R11_UFLOAT_PACK32 = 122, VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 = 123, VK_FORMAT_D16_UNORM = 124, VK_FORMAT_X8_D24_UNORM_PACK32 = 125, VK_FORMAT_D32_SFLOAT = 126, VK_FORMAT_S8_UINT = 127, VK_FORMAT_D16_UNORM_S8_UINT = 128, VK_FORMAT_D24_UNORM_S8_UINT = 129, VK_FORMAT_D32_SFLOAT_S8_UINT = 130, VK_FORMAT_BC1_RGB_UNORM_BLOCK = 131, VK_FORMAT_BC1_RGB_SRGB_BLOCK = 132, VK_FORMAT_BC1_RGBA_UNORM_BLOCK = 133, VK_FORMAT_BC1_RGBA_SRGB_BLOCK = 134, VK_FORMAT_BC2_UNORM_BLOCK = 135, VK_FORMAT_BC2_SRGB_BLOCK = 136, VK_FORMAT_BC3_UNORM_BLOCK = 137, VK_FORMAT_BC3_SRGB_BLOCK = 138, VK_FORMAT_BC4_UNORM_BLOCK = 139, VK_FORMAT_BC4_SNORM_BLOCK = 140, VK_FORMAT_BC5_UNORM_BLOCK = 141, VK_FORMAT_BC5_SNORM_BLOCK = 142, VK_FORMAT_BC6H_UFLOAT_BLOCK = 143, VK_FORMAT_BC6H_SFLOAT_BLOCK = 144, VK_FORMAT_BC7_UNORM_BLOCK = 145, VK_FORMAT_BC7_SRGB_BLOCK = 146, VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK = 147, VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK = 148, VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK = 149, VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK = 150, VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK = 151, VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK = 152, VK_FORMAT_EAC_R11_UNORM_BLOCK = 153, VK_FORMAT_EAC_R11_SNORM_BLOCK = 154, VK_FORMAT_EAC_R11G11_UNORM_BLOCK = 155, VK_FORMAT_EAC_R11G11_SNORM_BLOCK = 156, VK_FORMAT_ASTC_4x4_UNORM_BLOCK = 157, VK_FORMAT_ASTC_4x4_SRGB_BLOCK = 158, VK_FORMAT_ASTC_5x4_UNORM_BLOCK = 159, VK_FORMAT_ASTC_5x4_SRGB_BLOCK = 160, VK_FORMAT_ASTC_5x5_UNORM_BLOCK = 161, VK_FORMAT_ASTC_5x5_SRGB_BLOCK = 162, VK_FORMAT_ASTC_6x5_UNORM_BLOCK = 163, VK_FORMAT_ASTC_6x5_SRGB_BLOCK = 164, VK_FORMAT_ASTC_6x6_UNORM_BLOCK = 165, VK_FORMAT_ASTC_6x6_SRGB_BLOCK = 166, VK_FORMAT_ASTC_8x5_UNORM_BLOCK = 167, VK_FORMAT_ASTC_8x5_SRGB_BLOCK = 168, VK_FORMAT_ASTC_8x6_UNORM_BLOCK = 169, VK_FORMAT_ASTC_8x6_SRGB_BLOCK = 170, VK_FORMAT_ASTC_8x8_UNORM_BLOCK = 171, VK_FORMAT_ASTC_8x8_SRGB_BLOCK = 172, VK_FORMAT_ASTC_10x5_UNORM_BLOCK = 173, VK_FORMAT_ASTC_10x5_SRGB_BLOCK = 174, VK_FORMAT_ASTC_10x6_UNORM_BLOCK = 175, VK_FORMAT_ASTC_10x6_SRGB_BLOCK = 176, VK_FORMAT_ASTC_10x8_UNORM_BLOCK = 177, VK_FORMAT_ASTC_10x8_SRGB_BLOCK = 178, VK ... _ASTC_10x10_UNORM_BLOCK = ... 179, VK_FORMAT_ASTC_10x10_SRGB_BLOCK = 180, VK_FORMAT_ASTC_12x10_UN ... _BLOCK = 181, VK_ ... _ASTC_12x10_SRGB_BLOCK = 182, VK_FORMA... https://docs.vulkan.org/guide/latest/formats.html Formats :: Vulkan Documentation Project Vulkan Guide latest * Khronos Vulkan Tutorial * latest * OpenGL Shading Language Extensions * latest * OpenGL Shading Language Specification * latest * Vulkan API Reference Pages * latest * Vulkan Feature Descriptions * latest * Vulkan Guide * latest * Vulkan Samples * latest * Vulkan Specification * latest ### Contents * Feature Support * Format Feature Query Example * Variations of Formats * Color * Depth and Stencil * Compressed * Planar * Packed * External # Formats ### Contents * Feature Support * Format Feature Query Example * Variations of Formats * Color * Depth and Stencil * Compressed * Planar * Packed * External Vulkan formats are used to describe how memory is laid out. This chapter aims to give a high-level overview of the variations of formats in Vulkan and some logistical information for how to use them. All details are already well specified in both the Vulkan Spec format chapter and the Khronos Data Format Specification. The most common use case for a `VkFormat` is when creating a `VkImage`. Because the `VkFormat`s are well defined, they are also used when describing the memory layout for things such as a `VkBufferView`, vertex input attribute, mapping SPIR-V image formats, creating triangle geometry in a bottom-level acceleration structure, etc. ## Feature Support It is important to understand that "format support" is not a single binary value per format, but rather each format has a set of VkFormatFeatureFlagBits that each describes which features are supported for a format. The supported formats may vary across implementations, but a minimum set of format features are guaranteed. An application can query for the supported format properties. |**| Both VK\_KHR\_get\_physical\_device\_properties2 and VK\_KHR\_format\_feature\_flags2 expose another way to query for format features. | ### Format Feature Query Example In this example, the code will check if the `VK\_FORMAT\_R8\_UNORM` format supports being sampled from a `VkImage` created with `VK\_IMAGE\_TILING\_LINEAR` for `VkImageCreateInfo::tiling`. To do this, the code will query the `linearTilingFeatures` flags for `VK\_FORMAT\_R8\_UNORM` to see if the `VK\_FORMAT\_FEATURE\_SAMPLED\_IMAGE\_BIT` is supported by the implementation. ```cpp // Using core Vulkan 1.0 VkFormatProperties formatProperties; vkGetPhysicalDeviceFormatProperties(physicalDevice, VK_FORMAT_R8_UNORM, &formatProperties); if ((formatProperties.linearTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) != 0) { // supported } else { // not supported } ``` cppcopy iconCopied! ```cpp // Using core Vulkan 1.1 or VK_KHR_get_physical_device_properties2 VkFormatProperties2 formatProperties2; formatProperties2.sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2; formatProperties2.pNext = nullptr; // used for possible extensions vkGetPhysicalDeviceFormatProperties2(physicalDevice, VK_FORMAT_R8_UNORM, &formatProperties2); if ((formatProperties2.formatProperties.linearTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) != 0) { // supported } else { // not supported } ``` cppcopy iconCopied! ```cpp // Using VK_KHR_format_feature_flags2 VkFormatProperties3KHR formatProperties3; formatProperties3.sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_3_KHR; formatProperties3.pNext = nullptr; VkFormatProperties2 formatProperties2; formatProperties2.sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2; formatProperties2.pNext = &formatProperties3; vkGetPhysicalDeviceFormatProperties2(physicalDevice, VK_FORMAT_R8_UNORM, &formatProperties2); if ((formatProperties3.linearTilingFeatures & VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT_KHR) != 0) { // supported } else { // not supported } ``` cppcopy iconCopied! ## Variations of Formats Formats come in many variations, most can be grouped by the name of the format. When dealing with images, the VkImageAspectFlagBits values are used to represent which part of the data is being accessed for operations suc…[truncated]Citations:
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 31351
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 4488
Restore the packed-float formats to the Vulkan 32-bit compatibility class.
VK_FORMAT_B10G11R11_UFLOAT_PACK32andVK_FORMAT_E5B9G9R9_UFLOAT_PACK32share Vulkan's 32-bit compatibility class with the R32 formats. Their dedicated classes makeFormatsCompatiblereject valid mutable-format views, soFindViewexits before creating them.Map both formats to
Bit32. Keep emulator-specific restrictions outsideFormatsCompatible.🤖 Prompt for AI Agents
@ -873,0 +1155,4 @@}if (state.program.info.writes_dma) {DefineGetBdaStorePointer(state);}@coderabbitai[bot] on GitHub · 2026-09-17 00:51 UTC · original
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 14319
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 45373
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 46958
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 7794
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 6021
Guard
writes_dmafor every emitted address store. Resource tracking skips planning-only memory before it updateswrites_dma. A planning-only address memory entry can be used by a store, while another DMA operation setsuses_dma. The native-program validator checksuses_dmafor this handle but notwrites_dma, so the program can reachEmitStoreMemorywithwrites_dma == false.StoreBdathen calls the undefined store-pointer function and emits an invalid SPIR-V call.Add an explicit
writes_dmacheck for address handles used by stores inValidateNativeProgram, or reject such stores before resource tracking skips them.🤖 Prompt for AI Agents
@ -1103,0 +1146,4 @@case Opcode::V_CMP_GT_U16:case Opcode::V_CMPX_GT_U16:case Opcode::V_CMP_NE_U16:case Opcode::V_CMP_GE_U16:@coderabbitai[bot] on GitHub · 2026-09-17 00:51 UTC · original
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Add
V_CMPX_LT_U16toIsVopc16BitCompareOpcode.VOPC_OPCODE_LISTmaps encoding0xb9toOpcode::V_CMPX_LT_U16, andIsVopcCompareExecalready lists it. This 16-bit list omits it, while its siblingV_CMPX_GT_U16is present.VopcSdwaSourceClasstherefore classifiesV_CMPX_LT_U16asInteger32. A byte selector withSRC_SEXTthen passesVopcSdwaSourceRejectioninstead of being rejected, and the source is sign-extended from bit 31 rather than bit 15.🐛 Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents
@ -664,0 +1019,4 @@lane_walk.m_barred = m_barred;for (const auto& assumed: m_assumed) {lane_walk.m_barred.insert(assumed.first);}@coderabbitai[bot] on GitHub · 2026-09-17 00:51 UTC · original
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 40000
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 23105
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 11225
Give the ballot lane sweep its own lane-bound clean evaluator.
lane_walkpasses the outerm_clean_evaluatortoSelectU32,SelectU1, andSelectF32. That evaluator has no lane scope. A lane-dependent select condition inside a ballot predicate can therefore reachLaneIdwithm_lane == nullptr, return false, and make ballot evaluation fail. Bind the clean evaluator to the current lane, asReadFirstLanedoes.Keep
clean_runtimein a named local becauseEvaluatorstoresconst SrtRuntime&.🐛 Proposed fix to bind the lane in the ballot predicate walk
🤖 Prompt for AI Agents
@ -1440,0 +1946,4 @@}if (aug.empty() || aug[0] != 'z' || !ReadUleb128(&cursor, end, &ignored)) {return aug.empty() ? std::optional<uint8_t>(0) : std::nullopt;}@coderabbitai[bot] on GitHub · 2026-09-17 00:51 UTC · original
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 5300
🌐 Web query:
DWARF .eh_frame CIE augmentation string without z default FDE pointer encoding absptr💡 Result:
<search_synthesis>
In the context of the DWARF.eh_frame section, the Common Information Entry (CIE) augmentation string controls how optional data fields in the CIE and Frame Description Entries (FDEs) are interpreted [1][2]. When the augmentation string begins with the character &
#39;z', it signals that the CIE contains additional augmentation data, starting with an unsigned LEB128 length field [1][3]. This length field allows tools and unwinders to skip the augmentation data if they encounter unrecognized augmentation characters [1][3]. The 'R' character in the augmentation string, when present, indicates that the CIE's augmentation data includes a single byte specifying the pointer encoding used for FDE address pointers (such as the FDE PC begin address) [1][2]. The DWARF standard defines the default value for this pointer encoding as DW_EH_PE_absptr (encoded as 0x00) [1][4]. DW_EH_PE_absptr specifies that the associated addresses are stored as absolute, machine-native pointers [1][5]. Because these absolute pointers require runtime relocation in position-independent code (such as shared libraries), they are often less desirable than PC-relative encodings (like DW_EH_PE_pcrel) [6][7]. Tools and linkers, such as the GNU BFD linker and LLVM's JITLink, often recognize DW_EH_PE_absptr and, if possible, convert it to a relative encoding during the linking process to avoid runtime relocations [6][7]. When encountering absptr in code analysis, tools often map it to an explicit data size (e.g., udata4 or udata8) based on the target architecture's pointer size [8][9].</search_synthesis>
<source_evidence>
https://www.airs.com/blog/archives/460 2. NUL terminated augmentation string. This is a sequence of characters. Very old versions of gcc used the string “eh” here, but I won’t document that. This is described further below. ... - If the augmentation string starts with ‘z’, we now find an unsigned LEB128 which is the length of the augmentation data, rounded up so that the CIE ends on an address boundary. This is used to skip to the end of the augmentation data if an unrecognized augmentation character is seen. ... - If the next character in the augmentation string is ‘L’, the next byte in the CIE is the LSDA (Language Specific Data Area) encoding. This is a DW_EH_PE_xxx value (described later). The default is DW_EH_PE_absptr. ... - If the next character in the augmentation string is ‘R’, the next byte in the CIE is the FDE encoding. This is a DW_EH_PE_xxx value. The default is DW_EH_PE_absptr. ... 1. The starting address to which this FDE applies. This is encoded using the FDE encoding specified by the associated CIE. ... 3. If the CIE augmentation string starts with ‘z’, the FDE next has an unsigned LEB128 which is the total size of the FDE augmentation data. This may be used to skip data associated with unrecognized augmentation characters. 4. If the CIE does not specify DW_EH_PE_omit as the LSDA encoding, the FDE next has a pointer to the LSDA, encoded as specified by the CIE. ... The DW_EH_PE_xxx encodings describe how to encode values in a CIE or FDE. The basic encoding is as follows: ... - DW_EH_PE_absptr = 0x00: An absolute pointer. The size is determined by whether this is a 32-bit or 64-bit address space, and will be 32 or 64 bits. ... - DW_EH_PE_omit = 0xff: The value is omitted. ... - DW_EH_PE_uleb128 = 0x01: The value is an unsigned LEB128. ... - DW_EH_PE_udata2 = 0x02, DW_EH_PE_udata4 = 0x03, DW_EH_PE_udata8 = 0x04: The value is stored as unsigned data with the specified number of bytes. ... In .eh ... frame the ID for an F ... offset. In .debug_frame http://refspecs.linux-foundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html | Length | Required | | --- | --- | | Extended Length | Optional | | CIE ID | Required | | Version | Required | | Augmentation String | Required | | Code Alignment Factor | Required | | Data Alignment Factor | Required | | Return Address Register | Required | | Augmentation Data Length | Optional | | Augmentation Data | Optional | | Initial Instructions | Required | | Padding | | ... `Augmentation String` : This value is a NUL terminated string that identifies the augmentation to the CIE or to the FDEs associated with this CIE. A zero length string indicates that no augmentation data is present. The augmentation string is case sensitive and shall be interpreted as described below. ... `Augmentation Length` ... : An unsigned LEB128 encoded value indicating the length in bytes of the Augmentation Data. This field is only present if the Augmentation String contains the character &`#39`;z&`#39`;. ... : A block of data whose contents are defined by the contents of the Augmentation String as described below. This field is only present if the Augmentation String contains the character &`#39`;z&`#39`;. The size of this data is given by the Augentation Length. ... The Agumentation String indicates the presence of some optional fields, and how those fields should be intepreted. This string is case sensitive. Each character in the augmentation string in the CIE can be interpreted as below: ... | &`#39`;z&`#39`; | A &`#39`;z&`#39`; may be present as the first character of the string. If present, the Augmentation Data field shall be present. The contents of the Augmentation Data shall be intepreted according to other characters in the Augmentation String. | | --- | --- | ... | &`#39`;L&`#39`; | A &`#39`;L&`#39`; may be present at any position after the first character of the string. This character may only be present if &`#39`;z&`#39`; is the first character of the string. If present, it indicates the presence of one argument in the Augmentation Data of the CIE, and a corresponding argument in the Augmentation Data of the FDE. The argument in the Augmentation Data of the CIE is 1-byte and represents the pointer encoding used for the argument in the Augmentation Data of the FDE, which is the address of a language-specific data area (LSDA). The size of the LSDA pointer is specified by the pointer encoding used. | ... | &`#39`;P&`#39`; | A &`#39`;P&`#39`; may be present at any position after the first character of the string. This character may only be present if &`#39`;z&`#39`; is the first character of the string. If present, it indicates the presence of two arguments in the Augmentation Data of the CIE. The first argument is 1-byte and represents the pointer encoding used for the second argument, which is the address of a personality routine handler. The personality routine is used to handle language and vendor-specific tasks. The system unwind library interface accesses the language-specific exception handling semantics via the pointer to the personality routine. The personality routine does not have an ABI-specific name. The size of the personality routine pointer is specified by the pointer encoding used. | ... | &`#39`;R&`#39`; | A &`#39`;R&`#39`; may be present at any position after the first character of the string. This character may only be present if &`#39`;z&`#39`; is the first character of the string. If present, The Augmentation Data shall include a 1 byte argument that represents the pointer encoding for the address pointers used in the FDE. | ... | Length | Required | | --- | --- | | Extended Length | Optional | | FDE Pointer | Required | | PC Begin | Required | | PC Range | Required | | Augmentation Data Length | Optional | | Augmentation Data | Optional | | Call Frame Instructions | Required | | Padding | | ... `CIE Pointer` ... : A 4 byte unsigned value that when subtracted from the offset of the CIE Pointer in the current FDE yields the offset of the start of the associated CIE. This value shall never be 0. ... `PC Begin` ... : An encoded value that indicates t…[truncated] https://www.airs.com/blog/archives/460/comment-page-1 2. NUL terminated augmentation string. This is a sequence of characters. Very old versions of gcc used the string “eh” here, but I won’t document that. This is described further below. ... The next fields ... the augmentation string ... - If the augmentation string starts with ‘z’, we now find an unsigned LEB128 which is the length of the augmentation data, rounded up so that the CIE ends on an address boundary. This is used to skip to the end of the augmentation data if an unrecognized augmentation character is seen. ... - If the next character in the augmentation string is ‘L’, the next byte in the CIE is the LSDA (Language Specific Data Area) encoding. This is a DW_EH_PE_xxx value (described later). The default is DW_EH_PE_absptr. ... - If the next character in the augmentation string is ‘R’, the next byte in the CIE is the FDE encoding. This is a DW_EH_PE_xxx value. The default is DW_EH_PE_absptr. ... starting address to which this FDE applies. ... is encoded using the FDE encoding specified by the associated CIE. ... 3. If the CIE augmentation string starts with ‘z’, the FDE next has an unsigned LEB128 which is the total size of the FDE augmentation data. This may be used to skip data associated with unrecognized augmentation characters. 4. If the CIE does not specify DW_EH_PE_omit as the LSDA encoding, the FDE next has a pointer to the LSDA, encoded as specified by the CIE. ... The DW_EH_PE_xxx encodings describe how to encode values in a CIE or FDE. The basic encoding is as follows: ... - DW_EH_PE_absptr = 0x00: An absolute pointer. The size is determined by whether this is a 32-bit or 64-bit address space, and will be 32 or 64 bits. ... - DW_EH_PE_omit = 0xff: The value is omitted. ... - DW_EH_PE_uleb128 = 0x01: The value is an unsigned LEB128. ... - DW_EH_PE_udata2 = 0x02, DW_EH_PE_udata4 = 0x03, DW_EH_PE_udata8 = 0x04: The value is stored as unsigned data with the specified number of bytes. https://chromium.googlesource.com/external/elfutils/+/master/libdw/cie.c libdw/cie.c - external/elfutils - Git at Google blob: 1b0aae7c9fa3a713f65ccba4c2f8359a79bc7237 [file] | /* CIE reading. | | --- | | Copyright (C) 2009-2010 Red Hat, Inc. | | This file is part of elfutils. | | This file is free software; you can redistribute it and/or modify | | it under the terms of either | | * the GNU Lesser General Public License as published by the Free | | Software Foundation; either version 3 of the License, or (at | | your option) any later version | | or | | * the GNU General Public License as published by the Free | | Software Foundation; either version 2 of the License, or (at | | your option) any later version | | or both in parallel, as here. | | elfutils is distributed in the hope that it will be useful, but | | WITHOUT ANY WARRANTY; without even the implied warranty of | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | General Public License for more details. | | You should have received copies of the GNU General Public License and | | the GNU Lesser General Public License along with this program. If | | not, see. */ | | `#ifdef` HAVE_CONFIG_H | | # include <config.h> | | `#endif` | | `#include` "cfi.h" | | `#include` "encoded-value.h" | | `#include` <assert.h> | | `#include` <search.h> | | `#include` <stdlib.h> | | static int | | compare_cie (const void *a, const void *b) | | { | | const struct dwarf_cie *cie1 = a; | | const struct dwarf_cie *cie2 = b; | | if (cie1->offset < cie2->offset) | | return -1; | | if (cie1->offset > cie2->offset) | | return 1; | | return 0; | | } | | /* There is no CIE at OFFSET in the tree. Add it. */ | | static struct dwarf_cie * | | intern_new_cie (Dwarf_CFI *cache, Dwarf_Off offset, const Dwarf_CIE *info) | | { | | struct dwarf_cie *cie = malloc (sizeof (struct dwarf_cie)); | | if (cie == NULL) | | { | | __libdw_seterrno (DWARF_E_NOMEM); | | return NULL; | | } | | cie->offset = offset; | | cie->code_alignment_factor = info->code_alignment_factor; | | cie->data_alignment_factor = info->data_alignment_factor; | | cie->return_address_register = info->return_address_register; | | cie->fde_augmentation_data_size = 0; | | cie->sized_augmentation_data = false; | | cie->signal_frame = false; | | cie->fde_encoding = DW_EH_PE_absptr; | | cie->lsda_encoding = DW_EH_PE_omit; | | /* Grok the augmentation string and its data. */ | | const uint8_t *data = info->augmentation_data; | | for (const char *ap = info->augmentation; *ap != &`#39`;\0&`#39`;; ++ap) | | { | | uint8_t encoding; | | switch (*ap) | | { | | case &`#39`;z&`#39`;: | | cie->sized_augmentation_data = true; | | continue; | | case &`#39`;S&`#39`;: | | cie->signal_frame = true; | | continue; | | case &`#39`;L&`#39`;: /* LSDA pointer encoding byte. */ | | cie->lsda_encoding = *data++; | | if (!cie->sized_augmentation_data) | | cie->fde_augmentation_data_size | | += encoded_value_size (&cache->data->d, cache->e_ident, | | cie->lsda_encoding, NULL); | | continue; | | case &`#39`;R&`#39`;: /* FDE address encoding byte. */ | | cie->fde_encoding = *data++; | | continue; | | case &`#39`;P&`#39`;: /* Skip personality routine. */ | | encoding = *data++; | | data += encoded_value_size (&cache->data->d, cache->e_ident, | | encoding, data); | | continue; | | default: | | /* Unknown augmentation string. If we have &`#39`;z&`#39`; we can ignore it, | | otherwise we must bail out. */ | | if (cie->sized_augmentation_data) | | continue; | | } | | /* We only get here when we need to bail out. */ | | break; | | } | | if ((cie->fde_encoding & 0x0f) == DW_EH_PE_absptr) | | { | | /* Canonicalize encoding to a specific size. */ | | assert (DW_EH_PE_absptr == 0); | | /* XXX should get from dwarf_next_cfi with v4 header. */ | | uint_fast8_t address_size | | = cache->e_ident[EI_CLASS] == ELFCLASS32 ? 4 : 8; | | switch (address_size) | | { | | case 8: | | cie->fde_encoding |= DW_EH_PE_uda…[truncated]github.com/llvm/llvm-project@0d52536b04Merge eh-frame-value-format{1..9}.s into eh-frame-fde-encoding.s ... (encoding is ... DWARF term) using split-file. Add .eh_frame and .eh_frame_hdr content verification for absptr, udata2, sdata4, udata4. ... +## Test that various DW_EH_PE_* encodings in CIE are accepted. + ... +## absptr/udata2: Also verify .eh_frame content to test relocation with addend. ... +## .eh_frame_hdr initial_location: foo(0x1000)+0x234 - .eh_frame_hdr(0x2004) = 0xfffff230 ... +# RUN: llvm-readobj -x .eh_frame_hdr -x .eh_frame absptr | FileCheck %s --check-prefix=ABSPTR ... +# ABSPTR: Hex dump of section &`#39`;.eh_frame_hdr&`#39`;: +# ABSPTR-NEXT: 0x00002004 011b033b 10000000 01000000 30f2ffff +# ABSPTR-NEXT: 0x00002014 24000000 ... +# ABSPTR: Hex dump of section &`#39`;.eh_frame&`#39`;: +# ABSPTR-NEXT: 0x00002018 0c000000 00000000 01520001 010100ff +# ABSPTR-NEXT: 0x00002028 0c000000 14000000 34120000 00000000 ... +## CIE offset--^ ^-- PC begin = 0x1234 (foo + 0x234) + ... +#--- absptr.s ... +## DW_EH_PE_absptr (0x00) with FDE for verification ... +.section .eh_frame,"a",`@unwind` + .long 12 # Size + .long 0x00 # ID (CIE) + .byte 0x01 # Version + .byte 0x52 # Augmentation string: &`#39`;R&`#39`;,&`#39`;\0&`#39`; + .byte 0x00 + .byte 0x01 # Code alignment + .byte 0x01 # Data alignment + .byte 0x01 # Return address register + .byte 0x00 # DW_EH_PE_absptr + .byte 0xFF + + .long 12 # Size + .long 0x14 # CIE offset + .quad foo + 0x234 # PC begin + ... + .long 0x0E # Size + .long 0x00 # ID (CIE) + .byte 0x01 # Version + .byte 0x50 # Augmentation string: &`#39`;P&`#39`;,&`#39`;\0&`#39`; + .byte 0x00 + .byte 0x01 # Code alignment + .byte 0x01 # Data alignment (LEB128) + .byte 0x01 # Return address register (LEB1 ... + .byte 0x0A # DW_EH_PE_sdata2 + .short 0xFFFF ... byte 0xFF ... +## DW_EH_PE_sdata4 (0x0B) with FDE for verification ... +.section .eh_frame,"a",`@unwind` + .long 12 # Size + .long 0x00 # ID (CIE) + .byte 0x01 # Version + .byte 0x52 # Augmentation string: &`#39`;R&`#39`;,&`#39`;\0&`#39`; + .byte 0x00 + .byte 0x01 # Code alignment + .byte 0x01 # Data alignment + .byte 0x01 # Return address register + .byte 0x0B # DW_EH_PE_sdata4 + .byte 0xFF + + .long 12 # Size + .long 0x14 # CIE offset + .long foo # PC begin + .long 1 # PC range + ... + .long 0x14 # Size + .long 0x00 # ID (CIE) + .byte 0x01 # Version + .byte 0x50 # Augmentation string: &`#39`;P&`#39`;,&`#39`;\0&`#39`; + .byte 0x00 ... + .byte 0x01 # Code alignment ... + .byte 0 ... 01 # Data alignment (LE ... 128) + ... # Return address ... + . ... # DW_EH_PE_ ... + .quad 0xFFFFFFFFFFFFFFFF ... + .byte 0xFF ... --- udata ... +## DW_EH_PE_udata2 (0x02) with FDE for verification ... +.section .eh_frame,"a",`@unwind` + .long 14 # Size + .long 0x00 # ID (CIE) + .byte 0x01 # Version + .byte 0x52 # Augmentation string: &`#39`;R&`#39`;,&`#39`;S&`#39`;,&`#39`;\0&`#39`; + .byte 0x53 + .byte 0x00 + .byte 0x01 # Code alignment + .byte 0x01 # Data alignment + .byte 0x01 # Return address register + .byte 0x02 # DW_EH_PE_udata2 + .byte 0xFF + .byte 0x00 + + .long 6 # Size + .long 0x16 # CIE offset + .short foo + 0x234 # PC begin + ... +## DW_EH_PE_udata4 (0x03) with FDE for verification ... .eh_frame," ... + .long 12 # Size + .long 0x00 # ID (CIE) + .byte 0x01 # Version + .byte 0x52 # Augmentation string: &`#39`;R&`#39`;,&`#39`;\0&`#39`; + .byte 0x00 + .byte 0x01 # Code alignment + .byte 0x01 # Data alignment + .byte 0x01 # Return address register + .byte 0x03 # DW_EH_PE_udata4 + .byte 0xFF + + .long 12 # Size + .long 0x14 # CIE offset + .long foo # PC begin + .long 1 # PC range + ... +# RUN: not ld.lld --eh-frame-hdr unknown-size-encoding.o 2>&1 | FileCheck %s --check-prefix=UNKNOWN-SIZE --implicit-check-not=error: # UNKNOWN-AUG: PREFIX: corrupted .eh_frame: unknown .eh_frame augmentation string: {{.+}} @@ -23,6 +25,8 @@ # ALIGNED: error: corrupted .eh_frame: DW_EH_PE_aligned encoding is not supported +# UNKNOWN-SIZE: error: unknown FDE size encoding ... .section . ... 0x0 ... +.section .eh_frame,"a",`@u`…[truncated]Citations:
github.com/llvm/llvm-project@0d52536b04🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 19293
Handle the legacy
ehaugmentation.The parser already recognizes the legacy
ehaugmentation and skips its pointer field, but then returnsstd::nullopt. The FDE encoding defaults toDW_EH_PE_absptr(0) for this format.ReadFdeRangeconvertsstd::nulloptto a zero range, soinside_unwind_functioncannot protect valid function interiors.Accept the supported
ehform, but continue rejecting unknown non-zaugmentations.📝 Committable suggestion
🤖 Prompt for AI Agents
@ -1440,0 +1993,4 @@const auto size = EhPointerFormatSize(*cached->second);if (!size || static_cast<size_t>(end - cursor) < *size * 2) {return 0;}@coderabbitai[bot] on GitHub · 2026-09-17 00:51 UTC · original
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 8480
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 50372
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 6239
Validate the FDE and CIE addresses before reading them.
DecodeEhFrameFunctionsbounds only itsPT_GNU_EH_FRAMEheader cursor. It passes each decodedfdedirectly toReadFdeRange.ReadFdeRangethen derivesciefrom the guest-controlledcie_refand passes it toReadCieFdeEncoding. Both helpers can read through an address outside the module because their initialReadEhValuebound is computed from the same unvalidated pointer.Pass a trusted module or
.eh_framerange toReadFdeRangeandReadCieFdeEncoding. Reject the FDE and computed CIE, including their record ranges, before dereferencing them.🤖 Prompt for AI Agents
@coderabbitai[bot] on GitHub · 2026-09-17 00:51 UTC · original · reviewed
Actionable comments posted: 10
🧹 Nitpick comments (1)
🤖 Prompt for all review comments with AI agents
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Advanced
Run ID:
8b930610-324f-4dac-aff5-7df132b9a623📥 Commits
Reviewing files that changed from the base of the PR and between
63fb822f8aand015187e663.📒 Files selected for processing (74)
CMakeLists.txtsrc/common/emulatorConfig.hsrc/graphics/guest_gpu/command_processor/commandProcessor.hsrc/graphics/guest_gpu/command_processor/pm4Handlers.cppsrc/graphics/guest_gpu/graphicsRun.cppsrc/graphics/host_gpu/renderer/cache/bufferCache.cppsrc/graphics/host_gpu/renderer/cache/bufferCache.hsrc/graphics/host_gpu/renderer/cache/faultManager.cppsrc/graphics/host_gpu/renderer/cache/textureCache.cppsrc/graphics/host_gpu/renderer/cache/textureCache.hsrc/graphics/host_gpu/renderer/dispatchGuard.hsrc/graphics/host_gpu/renderer/image/image.hsrc/graphics/host_gpu/renderer/image/imageView.cppsrc/graphics/host_gpu/renderer/image/textureCommon.cppsrc/graphics/host_gpu/renderer/image/textureCommon.hsrc/graphics/host_gpu/renderer/pipeline/descriptors.cppsrc/graphics/host_gpu/renderer/pipeline/pipelineCache.cppsrc/graphics/host_gpu/renderer/pipeline/pipelineCache.hsrc/graphics/host_gpu/renderer/render.hsrc/graphics/host_gpu/renderer/renderCompute.cppsrc/graphics/host_gpu/renderer/renderContext.cppsrc/graphics/host_gpu/renderer/renderContext.hsrc/graphics/host_gpu/renderer/renderDraw.cppsrc/graphics/presentation/window/swapchain.cppsrc/graphics/presentation/window/vulkanWindow.cppsrc/graphics/shader/recompiler/ShaderRecompiler.cppsrc/graphics/shader/recompiler/ShaderRecompiler.hsrc/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cppsrc/graphics/shader/recompiler/backend/spirv/SpirvEmitter.hsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterAlu.cppsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterAnalysis.cppsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cppsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cppsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterInstructions.hsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterInternal.hsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cppsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterMemoryHelpers.cppsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterMesh.cppsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cppsrc/graphics/shader/recompiler/frontend/cfg/ShaderCFG.cppsrc/graphics/shader/recompiler/frontend/cfg/ShaderCFG.hsrc/graphics/shader/recompiler/frontend/decode/ImageOps.cppsrc/graphics/shader/recompiler/frontend/decode/ImageOps.hsrc/graphics/shader/recompiler/frontend/decode/MemoryOps.cppsrc/graphics/shader/recompiler/frontend/decode/ShaderDecoder.cppsrc/graphics/shader/recompiler/frontend/decode/ShaderDecoder.hsrc/graphics/shader/recompiler/frontend/decode/VectorAluOps.cppsrc/graphics/shader/recompiler/frontend/translate/Integer.cppsrc/graphics/shader/recompiler/frontend/translate/Memory.cppsrc/graphics/shader/recompiler/frontend/translate/Translate.cppsrc/graphics/shader/recompiler/frontend/translate/Translator.hsrc/graphics/shader/recompiler/frontend/translate/Vector.cppsrc/graphics/shader/recompiler/ir/Program.cppsrc/graphics/shader/recompiler/ir/ShaderIR.hsrc/graphics/shader/recompiler/ir/opcodes/ValueOpcodes.cppsrc/graphics/shader/recompiler/ir/opcodes/ValueOpcodes.hsrc/graphics/shader/recompiler/ir/opcodes/ValueOpcodes.incsrc/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cppsrc/graphics/shader/recompiler/ir/passes/ResourceTracking.cppsrc/graphics/shader/recompiler/ir/passes/ResourceTracking.hsrc/graphics/shader/recompiler/ir/passes/SrtWalker.cppsrc/graphics/shader/recompiler/ir/passes/SrtWalker.hsrc/kernel/memory.cppsrc/kernel/memory.hsrc/libs/agc.cppsrc/loader/redZonePatcher.cppsrc/loader/redZonePatcher.hsrc/loader/runtimeLinker.cppsrc/main.cpptests/ResourceTrackingTests.cpptests/ScalarProvenanceTests.cpptests/ShaderRecompilerComputeTests.cpptests/VirtualMemoryAllocationTests.cpptests/shaderCfgTests.cppIncluded review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
@ -29,0 +62,4 @@case IR::StageOutputKind::CullDistance: return &state.cull_distance_variable;case IR::StageOutputKind::ViewportIndex: return &state.viewport_index_variable;default: return nullptr;}@coderabbitai[bot] on GitHub · 2026-09-17 00:52 UTC · original
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 12763
🌐 Web query:
SPIR-V Vulkan mesh shader BuiltIn Layer ShaderLayer capability requirement SPIR-V 1.4💡 Result:
<search_synthesis>
In the context of Vulkan and SPIR-V, the ShaderLayer capability is fundamentally a SPIR-V 1.5+ feature [1]. It is not available for use in SPIR-V 1.4 modules [1]. For Vulkan mesh shaders (specifically using the VK_EXT_mesh_shader extension), the following requirements apply: 1. SPIR-V Version: The VK_EXT_mesh_shader extension requires SPIR-V 1.4 or higher [2][3]. 2. Capability Requirement: To use the Layer built-in within a mesh shader (MeshEXT execution model), the shader must declare the MeshShadingEXT capability [2][3]. 3. Enabling Layer Output: While the MeshShadingEXT capability enables the mesh shader model, the ability to output the Layer built-in requires the device to support and have enabled the shaderOutputLayer feature [4][5]. In Vulkan 1.2 and later, this feature corresponds to the ShaderLayer SPIR-V capability [6][7]. For environments constrained to SPIR-V 1.4, the ShaderLayer capability cannot be used [1]. Instead, developers typically rely on the SPV_EXT_shader_viewport_index_layer extension, which introduces the ShaderViewportIndexLayerEXT capability [8][9]. Note that this legacy capability was intended primarily for vertex and tessellation shaders [8]; its application to mesh shaders is defined by the specific mesh shading extensions implemented by the hardware vendor or the core VK_EXT_mesh_shader specification [2][3]. If you are targeting SPIR-V 1.4 and attempting to use Layer, you must ensure your toolchain emits the SPV_EXT_shader_viewport_index_layer extension and the ShaderViewportIndexLayerEXT capability rather than the ShaderLayer capability, which is restricted to SPIR-V 1.5 and newer [1].
</search_synthesis>
<source_evidence>
GitHub issue 10513 in shader-slang/slang (link omitted to avoid creating a cross-reference) # SPIR-V: ShaderLayer/ShaderViewportIndex capabilities emitted for spirv_1_4 target (requires 1.5+) - State: open - Author: jvepsalainen-nv - Created: 2026-03-12T07:49:15Z - Updated: 2026-03-12T08:31:52Z - Repository: shader-slang/slang - Number: `#10513` ## Labels - spirv_vulkan --- ## Issue Description When targeting SPIR-V 1.4 (`-profile spirv_1_4`), Slang emits `OpCapability ShaderLayer` and `OpCapability ShaderViewportIndex` for geometry shaders that use `SV_RenderTargetArrayIndex` and `SV_ViewportArrayIndex` semantics. These capabilities were introduced in SPIR-V 1.5 and are not valid in SPIR-V 1.4. For SPIR-V 1.4 and earlier, Slang should instead emit `OpExtension "SPV_EXT_shader_viewport_index_layer"` with `OpCapability ShaderViewportIndexLayerEXT` to enable the same functionality. ## Reproducer ```bash # deferredshadows/shadow.slang from SaschaWillems/Vulkan slangc shadow.slang -profile spirv_1_4 -target spirv -o shadow.spv -entry geometryMain -stage geometry ``` Minimal reproducer: ```hlsl struct GSOutput { float4 Pos : SV_Position; int Layer : SV_RenderTargetArrayIndex; }; [shader("geometry")] [maxvertexcount(3)] [instance(3)] void geometryMain(triangle float4 input[3] : SV_Position, inout TriangleStream<GSOutput> outStream, uint InvocationID : SV_GSInstanceID) { for (int i = 0; i < 3; i++) { GSOutput output; output.Pos = input[i]; output.Layer = InvocationID; outStream.Append(output); } outStream.RestartStrip(); } ``` ## Expected Behavior When targeting SPIR-V 1.4, Slang should emit: ``` OpExtension "SPV_EXT_shader_viewport_index_layer" OpCapability ShaderViewportIndexLayerEXT ``` instead of: ``` OpCapability ShaderLayer ; requires SPIR-V 1.5+ OpCapability ShaderViewportIndex ; requires SPIR-V 1.5+ ``` ## Actual Behavior SPIR-V validation fails: ``` error: line 1: 1st operand of Capability: operand ShaderLayer(69) requires SPIR-V version 1.5 or later error: line 1: 1st operand of Capability: operand ShaderViewportIndex(70) requires SPIR-V version 1.5 or later ``` ## Workaround Compiling with `-profile spirv_1_5` avoids the issue. The shaders compile and validate correctly with SPIR-V 1.5. ## Environment - Slang Version: 2025.23.1 (also reproduces on latest ToT) - Target: SPIR-V 1.4 ## Impact This affects the Sascha Willems Vulkan Shader nightly CI (2 geometry shaders): - `deferredshadows/shadow.slang` (uses `SV_RenderTargetArrayIndex`) - `viewportarray/scene.slang` (uses `SV_ViewportArrayIndex`) ## Timeline - Referenced in commit cae39be - Referenced by PR `#10514`: Skip geometry shaders needing SPIR-V 1.5 caps in Sascha Willems nightly CI - jvepsalainen-nv issue_type_added - jvepsalainen-nv added label "spirv_vulkan" - jvepsalainen-nv milestoned - Referenced in commit bb20db4 https://github.khronos.org/SPIRV-Registry/extensions/EXT/SPV_EXT_mesh_shader.html This extension is written against the SPIR-V Specification, Version 1.5 Revision 5. ... This extension requires SPIR-V 1.4. ... extension adds new functionality ... task and mesh ... Layer Layer selection for multi-layer framebuffer. See the client API specification for more detail. ... ShaderViewportIndexLayerEXT ... Layer output by a MeshEXT Execution Model. ... ShaderViewportIndexLayerEXT, MeshShadingEXT ... Answer : In a multiple entry point SPIR-V each OpEntryPoint should be associated with at most one global OpVariable of storage class TaskPayloadWorkgroupEXT. Thus more than one such OpVariable can be present in the SPIR-V. But only one OpVariable of type TaskPayloadWorkgroupEXT is allowed as part of interface of a OpEntryPoint. To support this requirement in OpEntryPoint, SPIR-V version has to 1.4 or above. ... Require SPIR-V 1.4 and add validation rules for TaskPayloadWorkgroupEXT https://vulkan.lunarg.com/doc/view/1.4.341.1/windows/antora/refpages/latest/refpages/source/VK_EXT_mesh_shader.html VK_EXT_mesh_shader(3) :: Vulkan Documentation Project ## Name VK_EXT_mesh_shader - device extension ## VK_EXT_mesh_shader Name String : `VK_EXT_mesh_shader` Extension Type : Device extension Registered Extension Number : 329 Revision : 1 Ratification Status : Ratified Extension and Version Dependencies : VK_KHR_spirv_1_4 or Vulkan Version 1.2 API Interactions : - Interacts with VK_VERSION_1_2 - Interacts with VK_AMD_draw_indirect_count - Interacts with VK_EXT_device_generated_commands - Interacts with VK_KHR_draw_indirect_count - Interacts with VK_KHR_fragment_shading_rate - Interacts with VK_NV_device_generated_commands - Interacts with VkPhysicalDeviceMeshShaderFeaturesEXT::primitiveFragmentShadingRateMeshShader SPIR-V Dependencies : - SPV_EXT_mesh_shader Contact : - Christoph Kubisch pixeljetstream Extension Proposal : VK_EXT_mesh_shader ### Other Extension Metadata Last Modified Date : 2022-01-20 Interactions and External Dependencies : - This extension provides API support for `GLSL_EXT_mesh_shader` - Interacts with Vulkan 1.1 - Interacts with `VK_KHR_multiview` - Interacts with `VK_KHR_fragment_shading_rate` Contributors : - Christoph Kubisch, NVIDIA - Pat Brown, NVIDIA - Jeff Bolz, NVIDIA - Daniel Koch, NVIDIA - Piers Daniell, NVIDIA - Pierre Boudier, NVIDIA - Patrick Mours, NVIDIA - David Zhao Akeley, NVIDIA - Kedarnath Thangudu, NVIDIA - Timur Kristóf, Valve - Hans-Kristian Arntzen, Valve - Philip Rebohle, Valve - Mike Blumenkrantz, Valve - Slawomir Grajewski, Intel - Michal Pietrasiuk, Intel - Mariusz Merecki, Intel - Tom Olson, ARM - Jan-Harald Fredriksen, ARM - Sandeep Kakarlapudi, ARM - Ruihao Zhang, QUALCOMM - Ricardo Garcia, Igalia, S.L. - Tobias Hector, AMD - Stu Smith, AMD ### Description This extension provides a new mechanism allowing applications to generate collections of geometric primitives via programmable mesh shading. It is an alternative to the existing programmable primitive shading pipeline, which relied on generating input primitives by a fixed function assembler as well as fixed function vertex fetch. This extension also adds support for the following SPIR-V extension in Vulkan: - `SPV_EXT_mesh_shader` ### New Commands - vkCmdDrawMeshTasksEXT - vkCmdDrawMeshTasksIndirectEXT If Vulkan Version 1.2 or VK_KHR_draw_indirect_count or VK_AMD_draw_indirect_count is supported: - vkCmdDrawMeshTasksIndirectCountEXT ### New Structures - VkDrawMeshTasksIndirectCommandEXT - Extending VkPhysicalDeviceFeatures2, VkDeviceCreateInfo: - VkPhysicalDeviceMeshShaderFeaturesEXT - Extending VkPhysicalDeviceProperties2: - VkPhysicalDeviceMeshShaderPropertiesEXT ### New Enum Constants - `VK_EXT_MESH_SHADER_EXTENSION_NAME` - `VK_EXT_MESH_SHADER_SPEC_VERSION` - Extending VkPipelineStageFlagBits: - `VK_PIPELINE_STAGE_MESH_SHADER_BIT_EXT` - `VK_PIPELINE_STAGE_TASK_SHADER_BIT_EXT` - Extending VkQueryPipelineStatisticFlagBits: - `VK_QUERY_PIPELINE_STATISTIC_MESH_SHADER_INVOCATIONS_BIT_EXT` - `VK_QUERY_PIPELINE_STATISTIC_TASK_SHADER_INVOCATIONS_BIT_EXT` - Extending VkQueryType: - `VK_QUERY_TYPE_MESH_PRIMITIVES_GENERATED_EXT` - Extending VkShaderStageFlagBits: - `VK_SHADER_STAGE_MESH_BIT_EXT` - `VK_SHADER_STAGE_TASK_BIT_EXT` - Extending VkStructureType: - `VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_EXT` - `VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_PROPERTIES_EXT` If VK_EXT_device_generated_commands is supported: - Extending VkIndirectCommandsTokenTypeEXT: - `VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_MESH_TASKS_COUNT_EXT` - `VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_MESH_TASKS_EXT` If VK_NV_device_generated_commands is supported: - Extending VkIndirectCommandsTokenTypeNV: - `VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_MESH_TASKS_NV` ### New or Modified Built-In Variables - CullPrimitiveEXT - PrimitivePointIndicesEXT - PrimitiveLineIndicesEXT - PrimitiveTriangleIndicesEXT - (modified)`Position` - (modified)`PointSize` - (modified)`ClipDistance` - (modified)`CullDistance` - (modified)`PrimitiveId` - (modified)`Layer` - (modified)`... https://docs.vulkan.org/refpages/latest/refpages/source/Layer.html Layer(3) :: Vulkan Documentation Project ### Contents - Name - Description - See Also - Document Notes ### Contents - Name - Description - See Also - Document Notes ## Name Layer - Layer index for layered rendering ## Description `Layer` : Decorating a variable with the `Layer` built-in decoration will make that variable contain the select layer of a multi-layer framebuffer attachment. In a mesh, vertex, tessellation evaluation, or geometry shader, any variable decorated with `Layer` can be written with the framebuffer layer index to which the primitive produced by that shader will be directed. The last active pre-rasterization shader stage (in pipeline order) controls the `Layer` that is used. Outputs in previous shader stages are not used, even if the last stage fails to write the `Layer`. If the last active pre-rasterization shader stage shader entry point’s interface does not include a variable decorated with `Layer`, then the first layer is used. If a pre-rasterization shader stage shader entry point’s interface includes a variable decorated with `Layer`, it must write the same value to `Layer` for all output vertices of a given primitive. If the `Layer` value is less than 0 or greater than or equal to the number of layers in the framebuffer, then primitives may still be rasterized, fragment shaders may be executed, and the framebuffer values for all layers are undefined. In a mesh shader this also applies when the `Layer` value is greater than or equal to the `maxMeshOutputLayers` limit. If a variable with the `Layer` decoration is also decorated with `ViewportRelativeNV`, then the `ViewportIndex` is added to the layer that is used for rendering and that is made available in the fragment shader. If the shader writes to a variable decorated `ViewportMaskNV`, then the layer selected has a different value for each viewport a primitive is rendered to. In a fragment shader, a variable decorated with `Layer` contains the layer index of the primitive that the fragment invocation belongs to. Valid Usage - VUID-Layer-Layer-04272 The `Layer` decoration must be used only within the `MeshEXT`, `MeshNV`, `Vertex`, `TessellationEvaluation`, `Geometry`, or `Fragment` `Execution` `Model` - VUID-Layer-Layer-04273 If the `shaderOutputLayer` feature is not enabled then the `Layer` decoration must be used only within the `Geometry` or `Fragment` `Execution` `Model` - VUID-Layer-Layer-04274 The variable decorated with `Layer` within the `MeshEXT`, `MeshNV`, `Vertex`, `TessellationEvaluation`, or `Geometry` `Execution` `Model` must be declared using the `Output` `Storage` `Class` - VUID-Layer-Layer-04275 The variable decorated with `Layer` within the `Fragment` `Execution` `Model` must be declared using the `Input` `Storage` `Class` - VUID-Layer-Layer-04276 The variable decorated with `Layer` must be declared as a scalar 32-bit integer value for all supported execution models except `MeshEXT` - VUID-Layer-Layer-07039 The variable decorated with `Layer` within the `MeshEXT` `Execution` `Model` must also be decorated with the `PerPrimitiveEXT` decoration - VUID-Layer-Layer-10592 `Layer` within the `MeshEXT` `Execution` `Model` must decorate a scalar 32-bit integer member of a structure decorated as `Block`, or decorate a variable of type `OpTypeArray` of scalar 32-bit integer values - VUID-Layer-Layer-10593 If `Layer` is declared as an array of 32-bit integer values, within the `MeshEXT` `Execution` `Model`, size of the array must match the value specified by `OutputPrimitivesEXT` - VUID-Layer-Layer-10594 If `Layer` decorates a member of a structure, the variable declaration of the containing `Block` type must have an array size that matches the value specified by `OutputPrimitivesEXT` ## Document Notes For more information, see the Vulkan Specification (NOTE: cannot determine Specification page containing this refpage). This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly. https://docs.vulkan.org/refpages/latest/refpages/source/VkPhysicalDeviceVulkan12Features.html `shaderOutputViewportIndex` indicates whether the implementation supports the`ShaderViewportIndex` SPIR-V capability enabling variables decorated with the`ViewportIndex` built-in to be exported from mesh, vertex or tessellation evaluation shaders. If this feature is not enabled, the`ViewportIndex` built-in decoration must not be used on outputs in mesh, vertex or tessellation evaluation shaders. ... `shaderOutputLayer` indicates whether the implementation supports the`ShaderLayer` SPIR-V capability enabling variables decorated with the`Layer` built-in to be exported from mesh, vertex or tessellation evaluation shaders. If this feature is not enabled, the`Layer` built-in decoration must not be used on outputs in mesh, vertex or tessellation evaluation shaders.Citations:
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 50371
Record the mesh Layer variable so the module declares
ShaderLayer.MeshOutputBuiltInemitsspv::BuiltInLayer, butMeshBuiltInVariablereturnsnullptrforIR::StageOutputKind::Layer.DefineMeshOutputstherefore creates and decorates the Layer output without assigningstate.layer_variable.DefineModulerequiresspv::CapabilityShaderLayerand SPIR-V 1.5 only whenstate.layer_variableor a Layer input is set. The mesh path otherwise starts at SPIR-V 1.4 andCapabilityMeshShadingEXTdoes not enableShaderLayer.ViewportIndexcan raise the version to 1.5, but it does not addShaderLayer. A mesh shader that writes Layer can therefore fail SPIR-V/Vulkan validation because its Layer decoration lacks the required capability.Add the Layer case:
🐛 Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents
@ -610,0 +634,4 @@result.status.pc = tracking.pc;result.status.reason = std::move(tracking.reason);result.program = std::move(ir);return result;@coderabbitai[bot] on GitHub · 2026-09-17 00:52 UTC · original
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 50371
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 50372
Preserve the decoded dump on resource-tracking rejection.
When
options.dump_iris true,TranslateProgramcreatesdecoded_dump. The CFG rejection path returns it, but the resource-tracking path returns before assigning it.pipelineCache.cpppasses this field toDumpShaderOriginalfor rejected translations, so the empty field prevents the.rdna2diagnostic file from being written.cfg_dumpis also empty here, but current rejection callers do not consume it. Populate the decoded dump required by the supported diagnostic workflow:📝 Committable suggestion
🤖 Prompt for AI Agents
@coderabbitai[bot] on GitHub · 2026-09-17 00:52 UTC · original · reviewed
Review continued from previous batch...
@gandalfthewhite19890404 on GitHub · 2026-09-17 02:55 UTC · original
1.006 hits this:
@Nmzik on GitHub · 2026-09-17 06:19 UTC · original
@shadowbeat070 you are legend! nanite support in a project thats only been around for ~5 months is crazy.
@shadowbeat070 on GitHub · 2026-09-17 15:36 UTC · original · edited 2026-09-17 15:41 UTC
@gandalfthewhite19890404 I think you ran out of vram.
@coderabbitai[bot] on GitHub · 2026-09-18 00:44 UTC · original · reviewed
Actionable comments posted: 1
🤖 Prompt to fix review comments
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Advanced
Run ID:
8e526be8-ef18-4294-aab4-02005535c38e📥 Commits
Reviewing files that changed from the base of the PR and between
015187e663andd0a691d0b3.📒 Files selected for processing (20)
src/graphics/host_gpu/graphicContext.hsrc/graphics/host_gpu/renderer/pipeline/pipelineCache.cppsrc/graphics/host_gpu/renderer/pipeline/shaders.cppsrc/graphics/presentation/window/vulkanWindow.cppsrc/graphics/shader/recompiler/ShaderRecompiler.cppsrc/graphics/shader/recompiler/ShaderRecompiler.hsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterAlu.cppsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterAluHelpers.cppsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterInstructions.hsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterInternal.hsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterMemoryHelpers.cppsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cppsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterProgram.cppsrc/graphics/shader/recompiler/frontend/translate/Float.cppsrc/graphics/shader/recompiler/frontend/translate/Translate.cppsrc/graphics/shader/recompiler/frontend/translate/Translate.hsrc/graphics/shader/recompiler/frontend/translate/Translator.hsrc/graphics/shader/recompiler/ir/ShaderIR.hsrc/graphics/shader/recompiler/ir/opcodes/ValueOpcodes.incsrc/libs/libNet.cppIncluded review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
@ -580,0 +1004,4 @@// stages narrower than its compute default, so the width is pinned rather than assumed.mesh.host_subgroup_size = m_graphics.CanPinMeshSubgroupSize(mesh.wave_size)? mesh.wave_size: std::max(m_graphics.min_subgroup_size, 32u);@coderabbitai[bot] on GitHub · 2026-09-18 00:44 UTC · original
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 35081
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 50371
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 42678
🌐 Web query:
Vulkan VK_EXT_mesh_shader unpinned mesh shader subgroup size default minSubgroupSize maxSubgroupSize subgroupSize contract💡 Result:
<search_synthesis>
In the context of the Vulkan VK_EXT_mesh_shader extension, there is no single "default" subgroup size. Instead, subgroup size behavior is governed by the underlying hardware and the Vulkan subgroup size control mechanisms [1][2]. Key points regarding subgroup size and mesh shaders: 1. Subgroup Size Constraints: The builtin variable SubgroupSize, when used in mesh or task shaders, must be a power-of-two integer [1]. Its value must be uniform across the command scope [1]. 2. Pipeline Configuration: - If a pipeline is created with the VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT flag, the SubgroupSize variable will reflect the size for each dispatched subgroup, bounded by the hardware&
#39;s minSubgroupSize and maxSubgroupSize [3][1]. - If a pipeline is created with a chained VkPipelineShaderStageRequiredSubgroupSizeCreateInfo structure, the SubgroupSize variable is explicitly set to the user-provided requiredSubgroupSize [3][1]. - If neither of the above is used, the SubgroupSize variable will match the implementation-defined default subgroupSize [3][1]. 3. Mesh Shader Preferences: While specific subgroup sizes are not hard-coded defaults, the extension provides properties to guide performance. The VkPhysicalDeviceMeshShaderPropertiesEXT structure includes maxPreferredTaskWorkGroupInvocations and maxPreferredMeshWorkGroupInvocations [4][5]. These values are guaranteed by the implementation to be multiples of a supported subgroup size for the respective shader stage, making them recommended targets for workgroup sizing to ensure optimal performance [4][5][6]. 4. Uniformity: In both mesh and task shaders, SubgroupSize must be uniform with command scope [1]. While they may have different subgroup sizes from one another within a single command scope, they must adhere to the rules set during pipeline creation [1]. For optimal, portable performance, it is recommended to use compile-time loops for processing vertices and primitives, allowing the shader to handle varying workgroup sizes effectively [6].</search_synthesis>
<source_evidence>
https://vulkan.lunarg.com/doc/view/latest/windows/antora/refpages/latest/refpages/source/SubgroupSize.html SubgroupSize(3) :: Vulkan Documentation Project # SubgroupSize(3) ## Name SubgroupSize - Size of a subgroup ## Description `SubgroupSize` Decorating a variable with the`SubgroupSize` builtin decoration will make that variable contain the implementation-dependent number of invocations in a subgroup. This value must be a power-of-two integer. If the pipeline was created with the VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT flag set, or the shader object was created with the VK_SHADER_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT flag set, or the SPIR-V`module` is at least version 1.6, the`SubgroupSize` decorated variable will contain the subgroup size for each subgroup that gets dispatched. This value must be between minSubgroupSize and maxSubgroupSize and must be uniform with subgroup scope. The value may vary across a single draw call, and for fragment shaders may vary across a single primitive. In compute dispatches,`SubgroupSize` must be uniform with command scope. In mesh and task shaders,`SubgroupSize` must be uniform with command scope. In a single command scope, the mesh and task shader may have different`SubgroupSize`. If the pipeline was created with a chained VkPipelineShaderStageRequiredSubgroupSizeCreateInfo structure, or the shader object was created with a chained VkShaderRequiredSubgroupSizeCreateInfoEXT structure, the`SubgroupSize` decorated variable will match requiredSubgroupSize. If SPIR-V`module` is less than version 1.6 and the pipeline was not created with the VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT flag set and no VkPipelineShaderStageRequiredSubgroupSizeCreateInfo structure was chained, and the shader was not created with the VK_SHADER_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT flag set and no VkShaderRequiredSubgroupSizeCreateInfoEXT structure was chained, the variable decorated with`SubgroupSize` will match subgroupSize. The maximum number of invocations that an implementation can support per subgroup is 128. | The old behavior for`SubgroupSize` is considered legacy as certain compute algorithms cannot be easily implemented without the guarantees of VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT and VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT. | | --- | Valid Usage VUID-SubgroupSize-SubgroupSize-04382 The variable decorated with`SubgroupSize` must be declared using the`Input``Storage``Class` VUID-SubgroupSize-SubgroupSize-04383 The variable decorated with`SubgroupSize` must be declared as a scalar 32-bit integer value ## See Also No cross-references are available ## Document Notes For more information, see the Vulkan Specification(NOTE: cannot determine Specification page containing this refpage). This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly. https://github.khronos.org/Vulkan-Site/guide/latest/subgroups.html Subgroups :: Vulkan Documentation Project # Subgroups The Vulkan Spec defines subgroups as: A set of shader invocations that can synchronize and share data with each other efficiently. In compute shaders, the local workgroup is a superset of the subgroup. For many implementations, a subgroup is the groups of invocations that run the same instruction at once. Subgroups allow for a shader writer to work at a finer granularity than a single workgroup. ## Resources For more detailed information about subgroups there is a great Khronos blog post as well as a presentation from Vulkan Developer Day 2018 (slides and video). GLSL support can be found in the GL_KHR_shader_subgroup extension. ## Subgroup size It is important to also realize the size of a subgroup can be dynamic for an implementation. Some implementations may dispatch shaders with a varying subgroup size for different subgroups. As a result, they could implicitly split a large subgroup into smaller subgroups or represent a small subgroup as a larger subgroup, some of whose invocations were inactive on launch. ### VK_EXT_subgroup_size_control Promoted to core in Vulkan 1.3 This extension was created due to some implementation having more than one subgroup size and Vulkan originally only exposing a single subgroup size. For example, if an implementation has both support for subgroups of size `4` and `16` before they would have had to expose only one size, but now can expose both. This allows applications to potentially control the hardware at a finer granularity for implementations that expose multiple subgroup sizes. If an device does not support this extension, it most likely means there is only one supported subgroup size to expose. ## Checking for support With Vulkan 1.1, all the information for subgroups is found in `VkPhysicalDeviceSubgroupProperties` ```cpp VkPhysicalDeviceSubgroupProperties subgroupProperties; VkPhysicalDeviceProperties2KHR deviceProperties2; deviceProperties2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; deviceProperties2.pNext = &subgroupProperties; vkGetPhysicalDeviceProperties2(physicalDevice, &deviceProperties2); // Example of checking if supported in fragment shader if ((subgroupProperties.supportedStages & VK_SHADER_STAGE_FRAGMENT_BIT) != 0) { // fragment shaders supported } // Example of checking if ballot is supported if ((subgroupProperties.supportedOperations & VK_SUBGROUP_FEATURE_BALLOT_BIT) != 0) { // ballot subgroup operations supported } ``` ### Guaranteed support For supported stages, the Vulkan Spec guarantees the following support: supportedStages will have the VK_SHADER_STAGE_COMPUTE_BIT bit set if any of the physical device’s queues support VK_QUEUE_COMPUTE_BIT. For supported operations, the Vulkan Spec guarantees the following support: supportedOperations will have the VK_SUBGROUP_FEATURE_BASIC_BIT bit set if any of the physical device’s queues support VK_QUEUE_GRAPHICS_BIT or VK_QUEUE_COMPUTE_BIT. ## VK_KHR_shader_subgroup_extended_types Promoted to core in Vulkan 1.2 GLSL_EXT_shader_subgroup_extended_types This extension allows subgroup operations to use 8-bit integer, 16-bit integer, 64-bit integer, 16-bit floating-point, and vectors of these types in group operations with subgroup scope if the implementation supports the types already. For example, if an implementation supports 8-bit integers an application can now use the GLSL `genI8Type subgroupAdd(genI8Type value);` call which will get mapped to `OpGroupNonUniformFAdd` in SPIR-V. ## VK_EXT_shader_subgroup_ballot and VK_EXT_shader_subgroup_vote `VK_EXT_shader_subgroup_ballot` and `VK_EXT_shader_subgroup_vote` were the original efforts to expose subgroups in Vulkan. If an application is using Vulkan 1.1 or greater, there is no need to use these extensions and should instead use the core API to query for subgroup support. https://registry.khronos.org/VulkanSC/specs/1.0-extensions/man/html/SubgroupSize.html SubgroupSize(3) # SubgroupSize(3) Manual Page ## Name SubgroupSize - Size of a subgroup Loading… please wait. ## Description `SubgroupSize` Decorating a variable with the `SubgroupSize` builtin decoration will make that variable contain the implementation-dependent number of invocations in a subgroup. This value **must** be a power-of-two integer. If the pipeline was created with the VK\_PIPELINE\_SHADER\_STAGE\_CREATE\_ALLOW\_VARYING\_SUBGROUP\_SIZE\_BIT flag set, the `SubgroupSize` decorated variable will contain the subgroup size for each subgroup that gets dispatched. This value **must** be between `minSubgroupSize` and `maxSubgroupSize` and **must** be uniform with subgroup scope. The value **may** vary across a single draw call, and for fragment shaders **may** vary across a single primitive. In compute dispatches, `SubgroupSize` **must** be uniform with command scope. If the pipeline was created with a chained VkPipelineShaderStageRequiredSubgroupSizeCreateInfo structure, the `SubgroupSize` decorated variable will match `requiredSubgroupSize`. If the pipeline was not created with the VK\_PIPELINE\_SHADER\_STAGE\_CREATE\_ALLOW\_VARYING\_SUBGROUP\_SIZE\_BIT flag set and no VkPipelineShaderStageRequiredSubgroupSizeCreateInfo structure was chained, the variable decorated with `SubgroupSize` will match `subgroupSize`. The maximum number of invocations that an implementation can support per subgroup is 128. Valid Usage * VUID-SubgroupSize-SubgroupSize-04382 The variable decorated with `SubgroupSize` **must** be declared using the `Input` `Storage` `Class` * VUID-SubgroupSize-SubgroupSize-04383 The variable decorated with `SubgroupSize` **must** be declared as a scalar 32-bit integer value ## See Also No cross-references are available ## Document Notes For more information, see the Vulkan Specification. This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly. ## Copyright Copyright 2014-2026 The Khronos Group Inc. SPDX-License-Identifier: CC-BY-4.0 https://github.khronos.org/Vulkan-Site/refpages/latest/refpages/source/VkPhysicalDeviceMeshShaderPropertiesEXT.html ```c // Provided by VK_EXT_mesh_shader typedef struct VkPhysicalDeviceMeshShaderPropertiesEXT { VkStructureType sType; void* pNext; uint32_t maxTaskWorkGroupTotalCount; uint32_t maxTaskWorkGroupCount[3]; uint32_t maxTaskWorkGroupInvocations; uint32_t maxTaskWorkGroupSize[3]; uint32_t maxTaskPayloadSize; uint32_t maxTaskSharedMemorySize; uint32_t maxTaskPayloadAndSharedMemorySize; uint32_t maxMeshWorkGroupTotalCount; uint32_t maxMeshWorkGroupCount[3]; uint32_t maxMeshWorkGroupInvocations; uint32_t maxMeshWorkGroupSize[3]; uint32_t maxMeshSharedMemorySize; uint32_t maxMeshPayloadAndSharedMemorySize; uint32_t maxMeshOutputMemorySize; uint32_t maxMeshPayloadAndOutputMemorySize; uint32_t maxMeshOutputComponents; uint32_t maxMeshOutputVertices; uint32_t maxMeshOutputPrimitives; uint32_t maxMeshOutputLayers; uint32_t maxMeshMultiviewViewCount; uint32_t meshOutputPerVertexGranularity; uint32_t meshOutputPerPrimitiveGranularity; uint32_t maxPreferredTaskWorkGroupInvocations; uint32_t maxPreferredMeshWorkGroupInvocations; VkBool32 prefersLocalInvocationVertexOutput; VkBool32 prefersLocalInvocationPrimitiveOutput; VkBool32 prefersCompactVertexOutput; VkBool32 prefersCompactPrimitiveOutput; } VkPhysicalDeviceMeshShaderPropertiesEXT; ... - `maxMeshWorkGroupSize` [3] is the maximum size of a local workgroup for a mesh shader in each dimension. These three values represent the maximum local workgroup size in the X, Y, and Z dimensions, respectively. The `x`, `y`, and `z` sizes, as specified by the `LocalSize` or `LocalSizeId` execution mode or by the object decorated by the `WorkgroupSize` decoration in shader modules, must be less than or equal to the corresponding limit. ... - `maxPreferredTaskWorkGroupInvocations` is the maximum number of task shader invocations in a single workgroup that is preferred by the implementation for optimal performance. The value is guaranteed to be a multiple of a supported subgroup size for the task shader stage. ... - `maxPreferredMeshWorkGroupInvocations` is the maximum number of mesh shader invocations in a single workgroup that is preferred by the implementation for optimal performance. The value is guaranteed to be a multiple of a supported subgroup size for the mesh shader stage. https://vulkan.lunarg.com/doc/view/1.4.350.1/linux/antora/refpages/latest/refpages/source/VkPhysicalDeviceMeshShaderPropertiesEXT.html ``` // Provided by VK_EXT_mesh_shader typedef struct VkPhysicalDeviceMeshShaderPropertiesEXT { VkStructureType sType; void* pNext; uint32_t maxTaskWorkGroupTotalCount; uint32_t maxTaskWorkGroupCount[3]; uint32_t maxTaskWorkGroupInvocations; uint32_t maxTaskWorkGroupSize[3]; uint32_t maxTaskPayloadSize; uint32_t maxTaskSharedMemorySize; uint32_t maxTaskPayloadAndSharedMemorySize; uint32_t maxMeshWorkGroupTotalCount; uint32_t maxMeshWorkGroupCount[3]; uint32_t maxMeshWorkGroupInvocations; uint32_t maxMeshWorkGroupSize[3]; uint32_t maxMeshSharedMemorySize; uint32_t maxMeshPayloadAndSharedMemorySize; uint32_t maxMeshOutputMemorySize; uint32_t maxMeshPayloadAndOutputMemorySize; uint32_t maxMeshOutputComponents; uint32_t maxMeshOutputVertices; uint32_t maxMeshOutputPrimitives; uint32_t maxMeshOutputLayers; uint32_t maxMeshMultiviewViewCount; uint32_t meshOutputPerVertexGranularity; uint32_t meshOutputPerPrimitiveGranularity; uint32_t maxPreferredTaskWorkGroupInvocations; uint32_t maxPreferredMeshWorkGroupInvocations; VkBool32 prefersLocalInvocationVertexOutput; VkBool32 prefersLocalInvocationPrimitiveOutput; VkBool32 prefersCompactVertexOutput; VkBool32 prefersCompactPrimitiveOutput; } VkPhysicalDeviceMeshShaderPropertiesEXT; ... `maxMeshWorkGroupSize` [3] is the maximum size of a local workgroup for a mesh shader in each dimension. These three values represent the maximum local workgroup size in the X, Y, and Z dimensions, respectively. The`x`,`y`, and`z` sizes, as specified by the`LocalSize` or`LocalSizeId` execution mode or by the object decorated by the`WorkgroupSize` decoration in shader modules, must be less than or equal to the corresponding limit. ... `maxPreferredTaskWorkGroupInvocations` is the maximum number of task shader invocations in a single workgroup that is preferred by the implementation for optimal performance. The value is guaranteed to be a multiple of a supported subgroup size for the task shader stage. ... `maxPreferredMeshWorkGroupInvocations` is the maximum number of mesh shader invocations in a single workgroup that is preferred by the implementation for optimal performance. The value is guaranteed to be a multiple of a supported subgroup size for the mesh shader stage.Citations:
Use the actual subgroup size for unpinned mesh stages. When
CanPinMeshSubgroupSizeis false, pipeline creation does not setrequiredSubgroupSize, buthost_subgroup_sizeis still forced tomax(min_subgroup_size, 32u). If the implementation selects another mesh subgroup size,host_threadsis wrong, and the SPIR-V emitter can select the wrong lane mapping and local size for 64-wide guest waves. Use the implementation’s actual mesh-stage default, or keep the mesh stage pinned before compiling this translation.🤖 Prompt for AI Agents
@francoisatt on GitHub · 2026-09-20 08:32 UTC · original
Runtime check of the glc/Coherent part of this PR on native Vulkan (Windows, NVIDIA RTX 5080, driver 596.49).
GlcBufferAccessIsCoherent checks the emitted SPIR-V text. I wrote a GPU-executed companion that exercises the pattern your comment describes (a spin on a sibling workgroup's status word):
41 workgroups; group 0 publishes flag[0], each group g > 0 polls flag[g - 1] with a glc BUFFER_LOAD_DWORD, then publishes flag[g] with a glc store.
The poll is bounded (65536 tries), so a stale read records result[g] = 0 instead of hanging the device.
Results, same machine, same harness:
Build Result
main (
f100f78) fails: every flag ends at 1, but result[1..40] are all 0. All 40 waiting groups gave up without seeing a store that did landthis PR (
d0a691d) passes: all 41 groups see their predecessor's flagThe main failure is identical on two separate runs, with and without a Vulkan debugging layer loaded.
So on this GPU the missing Coherent is not theoretical: without it a glc poll never observes a sibling workgroup's store.
I did not bisect the 37 commits. The fixture only exercises glc buffer loads and stores, and the Coherent alias comes from
263f6bd, so that is the likely source, but I have not isolated it.One suggestion, since you flagged the draw-skipping workaround as probably not mergeable: the glc/Coherent alias lives in
263f6bdtogether with that workaround. If it were split into its own commit, it could land independently, with this fixture as its runtime test.Also on this PR: full ctest 39/42, the 3 failures being the known SDL link issue (#565), same as on clean main.
Not verified: other GPU vendors (tested on NVIDIA only), and wave32.
Feel free to take the case into this PR if it is useful (run with --glc-spin-only):
// A workgroup that polls a status word published by a sibling workgroup (the
// decoupled look-back pattern) must eventually see that store. Group g > 0 polls
// flag[g - 1] with a glc load, then publishes flag[g] with a glc store. The poll
// is bounded, so a load served from a stale, non-coherent cache shows up as a
// zero in result[g] instead of hanging the device.
TestCase GlcSpinSeesSiblingWorkgroupStore() {
using O = ShaderOpcode;
constexpr u32 kGroups = 41;
constexpr u32 kResultBase = 64; // dwords; flags live in [0, kGroups)
constexpr u32 kSpinBudget = 1u << 16;
// MUBUF word 0 with OFFEN and GLC, encoded here so the case does not depend on
// the glc parameter of the shared helpers.
const auto mubuf_glc = [](u32 opcode) {
return (0x38u << 26u) | ((opcode & 0x7fu) << 18u) | (1u << 14u) |
(1u << 12u);
};
const auto rel = [](u32 from, u32 to) { return (to - from - 1u) & 0xffffu; };
std::vector code;
AppendVMovU32(&code, 1, 0); // v1 = seen
code.push_back(EncodeSopc(0x06, 4, InlineU32(0))); // s_cmp_eq_u32 s4, 0
const auto first_branch = static_cast(code.size());
code.push_back(0); // s_cbranch_scc1 seen
AppendSMovLiteral(&code, 5, kSpinBudget); // s5 = budget
code.push_back(EncodeSop2(0x01, 6, 4, InlineU32(1))); // s_sub_u32 s6, s4, 1
code.push_back(EncodeVop1(0x01, 2, 6)); // v2 = s6
code.push_back(EncodeVop2(0x1a, 2, InlineU32(2), 2)); // v2 <<= 2
const auto loop = static_cast(code.size());
code.push_back(mubuf_glc(0x0cu)); // buffer_load_dword glc
code.push_back(EncodeMubuf1(3, 0, 2)); // v3 <- flag[g - 1]
code.push_back(EncodeVop1(0x02, 7, Vgpr(3))); // s7 = readfirstlane v3
code.push_back(EncodeSopc(0x06, 7, InlineU32(1))); // s_cmp_eq_u32 s7, 1
const auto seen_branch = static_cast(code.size());
code.push_back(0); // s_cbranch_scc1 seen
code.push_back(EncodeSop2(0x01, 5, 5, InlineU32(1))); // s5 -= 1
code.push_back(EncodeSopc(0x06, 5, InlineU32(0))); // s_cmp_eq_u32 s5, 0
const auto back_branch = static_cast(code.size());
code.push_back(0); // s_cbranch_scc0 loop
const auto give_up_branch = static_cast(code.size());
code.push_back(0); // s_branch publish
const auto seen = static_cast(code.size());
AppendVMovU32(&code, 1, 1); // v1 = 1
const auto publish = static_cast(code.size());
code.push_back(EncodeVop1(0x01, 4, 4)); // v4 = s4
code.push_back(EncodeVop2(0x1a, 4, InlineU32(2), 4)); // v4 <<= 2
AppendVMovU32(&code, 5, 1);
code.push_back(mubuf_glc(0x1cu)); // buffer_store_dword glc
code.push_back(EncodeMubuf1(5, 12, 4)); // flag[g] <- 1
AppendVMovU32(&code, 6, kResultBase * 4u);
code.push_back(EncodeVop2(0x25, 6, Vgpr(4), 6)); // v6 = &result[g]
code.push_back(EncodeMubuf0(0x1cu)); // buffer_store_dword
code.push_back(EncodeMubuf1(1, 12, 6)); // result[g] <- seen
AppendEnd(&code);
code[first_branch] = EncodeSopp(0x05, rel(first_branch, seen));
code[seen_branch] = EncodeSopp(0x05, rel(seen_branch, seen));
code[back_branch] = EncodeSopp(0x04, rel(back_branch, loop));
code[give_up_branch] = EncodeSopp(0x02, rel(give_up_branch, publish));
TestCase test;
test.name = "GlcSpinSeesSiblingWorkgroupStore";
test.code = code;
test.initial.assign(kResultBase + kGroups, 0u);
test.expected.assign(kResultBase + kGroups, 0u);
for (u32 group = 0; group < kGroups; ++group) {
test.expected[group] = 1u;
test.expected[kResultBase + group] = 1u;
}
test.opcodes = {O::V_MOV_B32, O::S_CMP_EQ_U32, O::S_CBRANCH_SCC1,
O::S_MOV_B32, O::S_SUB_U32, O::V_LSHLREV_B32,
O::BUFFER_LOAD_DWORD, O::V_READFIRSTLANE_B32, O::S_CBRANCH_SCC0,
O::S_BRANCH, O::V_ADD_NC_U32, O::BUFFER_STORE_DWORD,
O::S_ENDPGM};
test.compute_info.threads_num[0] = 64;
test.compute_info.threads_num[1] = 1;
test.compute_info.threads_num[2] = 1;
test.compute_info.group_id[0] = true;
test.compute_info.thread_ids_num = 1;
test.compute_info.workgroup_register = 4;
test.has_compute_info = true;
test.dispatch_x = kGroups;
return test;
}
if (argc == 2 && std::strcmp(argv[1], "--glc-spin-only") == 0) {
VulkanHarness vulkan;
RunCase(&vulkan, GlcSpinSeesSiblingWorkgroupStore());
return 0;
}
Written with AI assistance (Claude); the test was built and run by me on the hardware above.
@Nmzik on GitHub · 2026-10-04 14:40 UTC · original
@shadowbeat070 Both Silent Hill 2/f are in-game on main. Small graphical artifacts are still there. Both RT (quality) and non-RT modes (performance) are working. I'll leave the PR open coz some opcodes haven't been tested/fixed yet. Credited ofc
@Crispy81 on GitHub · 2026-10-05 00:05 UTC · original
For me, Silent Hill 2, it dies after health warning screen:
--- Guest fault context ---
thread: (host thread)
rax=0000013f6d839c60 rbx=0000013f6d839c60 rcx=0000000000000000 rdx=0000000000000000
rsi=0000000000000000 rdi=0000000000000038 rbp=0000014089e67ac0 rsp=0000014089e67a00
r8 =0000013f6d839c78 r9 =0000013f6d6d0000 r10=0000000000000000 r11=0000014089e67a20
r12=0000000000000010 r13=0000000000000000 r14=0000013f63a11d01 r15=00000140e2ed7340
code (pc-48 .. pc+48, fault at byte 48):
ff 74 13 48 8b cb e8 b9 d9 fb ff 48 8b d0 48 8b
cf e8 4e fa 1f 00 48 85 db 4c 8d 43 18 48 8b c3
48 8b 5c 24 50 4c 0f 44 c6 49 8b 48 08 49 8b 10
48 89 11 48 89 4a 08 49 89 30 49 89 70 08 48 8b
74 24 58 48 83 c4 40 5f c3 cc cc cc cc cc cc cc
cc cc cc cc 40 53 55 41 57 48 83 ec 40 40 32 ed
stack:
00000140e2ed7340 00000140e2ed7110 0000014089e67bc8 00007ffe93f57c35
0000013f6d6d98a0 0000013f63a11da8 00007ffe91440000 0000013f643ba9a8
00000140e2ed7118 00007ffe924941c9 0000013f6d839c60 0000014089e67bc8
0000013f66624240 0000014089e67bc8 0000013f643ba948 0000013f643ba9a8
00000140c6a5aa28 0000000000000000 0000014089e60000 fffffffffffff000
00000140c6a5aa28 0000013f6d839c78 0000014089e60000 00007ffe923a6c04
0000014089e67ef0 0000000000000000 0000013f643ba948 0000013f63df9fc8
0000014089e67bf0 00007ffe92493eb5 0000013f643ba948 00007ffe915f1e83
--- Build ---
Official build KytyPS5-2026-10-04-bbb98bd
--- Error ---
Unhandled host exception: type=1 code=3221225477 pc=0x00007ffe93f9ab9c access=2 address=0x0000000000000000
in D:\a\KytyPS5\KytyPS5\src\loader\runtimeLinker.cpp:720
Silent Hill f dies early:
--- Error ---
mesh draw exceeds host workgroup limits: 2148565903x1
in D:\a\KytyPS5\KytyPS5\src\graphics\host_gpu\renderer\renderDraw.cpp:1059
Could be an AMD hardware thing, I guess.
@Nmzik on GitHub · 2026-10-05 00:34 UTC · original
@shadowbeat070 cherry picked opcode fixes
Pull request closed