Skip to content

Commit 631144f

Browse files
committed
Set per-thread builtins for Vk Compute single thread debugging
DispatchThreadIndex GroupThreadIndex GroupFlatIndex
1 parent 60d0c6b commit 631144f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

renderdoc/driver/vulkan/vk_shaderdebug.cpp

+9-2
Original file line numberDiff line numberDiff line change
@@ -6257,8 +6257,15 @@ ShaderDebugTrace *VulkanReplay::DebugComputeCommon(ShaderStage stage, uint32_t e
62576257
std::unordered_map<ShaderBuiltin, ShaderVariable> &thread_builtins =
62586258
apiWrapper->thread_builtins[0];
62596259

6260-
thread_builtins[ShaderBuiltin::GroupIndex] =
6261-
ShaderVariable(rdcstr(), groupid[0], groupid[1], groupid[2], 0U);
6260+
thread_builtins[ShaderBuiltin::DispatchThreadIndex] = ShaderVariable(
6261+
rdcstr(), groupid[0] * threadDim[0] + threadid[0],
6262+
groupid[1] * threadDim[1] + threadid[1], groupid[2] * threadDim[2] + threadid[2], 0U);
6263+
thread_builtins[ShaderBuiltin::GroupThreadIndex] =
6264+
ShaderVariable(rdcstr(), threadid[0], threadid[1], threadid[2], 0U);
6265+
thread_builtins[ShaderBuiltin::GroupFlatIndex] = ShaderVariable(
6266+
rdcstr(),
6267+
threadid[2] * threadDim[0] * threadDim[1] + threadid[1] * threadDim[0] + threadid[0], 0U,
6268+
0U, 0U);
62626269
}
62636270

62646271
rdcspv::Debugger *debugger = new rdcspv::Debugger;

0 commit comments

Comments
 (0)