Skip to content

Commit 88a9bde

Browse files
committed
Add SubgroupSize to global_builtins for Vulkan shader debugging
Added for all stages (Vertex, Compute, Pixel)
1 parent e0f8f29 commit 88a9bde

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

renderdoc/driver/vulkan/vk_shaderdebug.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5135,6 +5135,8 @@ ShaderDebugTrace *VulkanReplay::DebugVertex(uint32_t eventId, uint32_t vertid, u
51355135
memcpy((var.value.u8v.data()) + elemSize * comp, value + i * paramAlign, sz);
51365136
}
51375137
}
5138+
apiWrapper->global_builtins[ShaderBuiltin::SubgroupSize] =
5139+
ShaderVariable(rdcstr(), numThreads, 0U, 0U, 0U);
51385140

51395141
ShaderDebugTrace *ret = debugger->BeginDebug(apiWrapper, ShaderStage::Vertex, entryPoint, spec,
51405142
shadRefl.instructionLines, shadRefl.patchData,
@@ -5311,6 +5313,10 @@ ShaderDebugTrace *VulkanReplay::DebugVertex(uint32_t eventId, uint32_t vertid, u
53115313

53125314
rdcspv::Debugger *debugger = new rdcspv::Debugger;
53135315
debugger->Parse(shader.spirv.GetSPIRV());
5316+
5317+
apiWrapper->global_builtins[ShaderBuiltin::SubgroupSize] =
5318+
ShaderVariable(rdcstr(), numThreads, 0U, 0U, 0U);
5319+
53145320
ShaderDebugTrace *ret = debugger->BeginDebug(apiWrapper, ShaderStage::Vertex, entryPoint, spec,
53155321
shadRefl.instructionLines, shadRefl.patchData,
53165322
laneIndex, numThreads, numThreads);
@@ -5830,6 +5836,9 @@ ShaderDebugTrace *VulkanReplay::DebugPixel(uint32_t eventId, uint32_t x, uint32_
58305836
}
58315837
}
58325838

5839+
apiWrapper->global_builtins[ShaderBuiltin::SubgroupSize] =
5840+
ShaderVariable(rdcstr(), numThreads, 0U, 0U, 0U);
5841+
58335842
ret = debugger->BeginDebug(apiWrapper, ShaderStage::Pixel, entryPoint, spec,
58345843
shadRefl.instructionLines, shadRefl.patchData, winner->laneIndex,
58355844
numThreads, numThreads);
@@ -6232,6 +6241,9 @@ ShaderDebugTrace *VulkanReplay::DebugComputeCommon(ShaderStage stage, uint32_t e
62326241
}
62336242
}
62346243

6244+
apiWrapper->global_builtins[ShaderBuiltin::SubgroupSize] =
6245+
ShaderVariable(rdcstr(), winner->subgroupSize, 0U, 0U, 0U);
6246+
62356247
ShaderDebugTrace *ret = debugger->BeginDebug(
62366248
apiWrapper, stage, entryPoint, spec, shadRefl.instructionLines, shadRefl.patchData,
62376249
winner->laneIndex, numThreads, winner->subgroupSize);
@@ -6294,6 +6306,10 @@ ShaderDebugTrace *VulkanReplay::DebugComputeCommon(ShaderStage stage, uint32_t e
62946306

62956307
rdcspv::Debugger *debugger = new rdcspv::Debugger;
62966308
debugger->Parse(shader.spirv.GetSPIRV());
6309+
6310+
apiWrapper->global_builtins[ShaderBuiltin::SubgroupSize] =
6311+
ShaderVariable(rdcstr(), 1U, 0U, 0U, 0U);
6312+
62976313
ShaderDebugTrace *ret =
62986314
debugger->BeginDebug(apiWrapper, stage, entryPoint, spec, shadRefl.instructionLines,
62996315
shadRefl.patchData, laneIndex, numThreads, 1);

0 commit comments

Comments
 (0)