Repository navigation
qt-patches: HLSL gl_NumWorkGroups, Metal per-call buffer sizes, Vulkan render-pass sync - #52
Merged
Merged
Conversation
qtshadertools never called SPIRV-Cross's remap_num_workgroups_builtin(), so a compute shader reading gl_NumWorkGroups could not be baked for HLSL. The patch makes it opt-in through QShaderBaker::setHlslNumWorkGroupsBinding and reports the added cbuffer in the native resource binding map. Applies after 0001/0002 on the pinned qtshadertools (4e195e12c7); verified with git apply --check and against the pinned SPIRV-Cross sources. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JeL19ofVgPe9u9q7J1V9ex
QRhiMetal rewrote one per-pipeline buffer size buffer in place on every setShaderResources, so all draws and dispatches recorded with a pipeline in a frame read the storage buffer sizes of the last one. Each call now gets its own region, per frame slot. score's test_gfx_csf_every_mesh: 24/216 assertions failed on Metal with the continuous SDK, all pass with this patch; 83 other storage, CSF, indirect, raw raster and scene tests unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JeL19ofVgPe9u9q7J1V9ex
…nt writes A texture render target's render pass had no external subpass dependency, so the UNDEFINED -> attachment layout transition of a pass did not chain after the resource-tracking barrier and raced the previous pass's writes to the same image: SYNC-HAZARD-WRITE-AFTER-WRITE at vkCmdBeginRenderPass whenever a frame renders twice into one target. score, Vulkan, synchronization validation on, Linux debug Qt with the patch: 7 tests lose all their validation errors (raw_raster_input_buffer_count 690 -> 0, raw_raster_aux_count 575 -> 0, selffb_depth_grab, per_layer_depth, raw_raster_depth_array_input, raster_layer_queue, gltf_light_shadows); 84 other render-target tests unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JeL19ofVgPe9u9q7J1V9ex
This was referenced Oct 26, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three Qt patches found while testing score's shader pipeline on D3D, Metal and Vulkan.
qtshadertools 0003: HLSL
gl_NumWorkGroupsthrough a constant bufferqtshadertools never calls SPIRV-Cross's
remap_num_workgroups_builtin(), so a compute shader that readsgl_NumWorkGroupscannot be baked for HLSL (D3D11/D3D12).QShaderBaker::setHlslNumWorkGroupsBinding(int)makes the remap opt-in; nothing changes for shaders that don't set it.QT_SHADERTOOLS_HAS_HLSL_NUM_WORKGROUPS_BINDINGlets score detect the patched build.Applies after 0001/0002 on the pinned qtshadertools (4e195e12c7); checked with
git apply --checkand against the pinned SPIRV-Cross sources. The score side (filling the cbuffer, including for indirect dispatch) comes in a separate score PR and needs a Windows test run.qtbase 0015: Metal
length()reads the sizes of its own draw or dispatchQRhiMetal rewrote one per-pipeline buffer-size buffer in place on every
setShaderResources, so all draws and dispatches recorded with a pipeline in a frame read the storage buffer sizes of the last one. Each call now gets its own region, per frame slot.score's
test_gfx_csf_every_mesh: 24/216 assertions failed on Metal with the continuous SDK, all pass with the patch; 83 other storage, CSF, indirect, raw raster and scene tests unchanged.qtbase 0016: Vulkan offscreen render passes wait for previous attachment writes
A texture render target's render pass had no external subpass dependency, so the UNDEFINED → attachment layout transition did not chain after the resource-tracking barrier and raced the previous pass's writes to the same image (SYNC-HAZARD-WRITE-AFTER-WRITE at
vkCmdBeginRenderPasswhenever a frame renders twice into one target).score on Vulkan with synchronization validation, Linux debug Qt with the patch: 7 tests lose all their validation errors (
raw_raster_input_buffer_count690 → 0,raw_raster_aux_count575 → 0,selffb_depth_grab,per_layer_depth,raw_raster_depth_array_input,raster_layer_queue,gltf_light_shadows); 84 other render-target tests unchanged.🤖 Generated with Claude Code
https://claude.ai/code/session_01JeL19ofVgPe9u9q7J1V9ex