Commit Graph
225 Commits
Author SHA1 Message Date
Jake Turner 234a78ecf2 Remove Vulkan_Hack_EnableGroupCaps 2025-09-24 15:18:14 +01:00
Jake Turner b536bbaf95 Spirv Debugger run jobs in a hot spin loop in a single JobQueue job
Each JobQueue Job runs SimulationJobHelper which is a while loop looking for threads to simulate
2025-09-24 15:14:55 +01:00
Jake Turner 7bdf8a8d88 Make pointer read/write methods return DeviceOpResult
ThreadState

  DeviceOpResult ReadPointerValue(Id pointer, ShaderVariable &ret);

Debugger

  DeviceOpResult ReadFromPointer(const ShaderVariable &ptr, ShaderVariable &ret) const;
  DeviceOpResult GetPointerValue(const ShaderVariable &v, ShaderVariable &ret) const;
2025-09-24 14:52:42 +01:00
Jake Turner d93be6f2b2 Multi-threaded support for SPIRV wrapper APIs ReadTexel, WriteTexel 2025-09-24 14:45:14 +01:00
Jake Turner 6e28ff1ca8 Convert Spirv Debugger to run Thread steps via the JobSystem
Enabled by default : config option "Vulkan_Debug_EnableShaderDebugMT"
2025-09-24 14:29:59 +01:00
Jake Turner 94d7f4365d Batch Spirv debugger MathOp and SampleGatherOp GPU operations
Thread Simulation queues MathOp, SampleGatherOp requests and then the Thread is paused.
The Debugger loop processes the MathOp queue, batches MathOps together into a single command list, Submit, Sync.
The Debugger loop processes the SampleGatherOp queue, batches GPU SampleGatherOps together into a single command list, Submit, Sync. Some SampleGatherOps are run on the CPU and do not use the GPU.

When the queued operations are completed, the results are written back into the Thread Simulation and the paused Threads are rerun.
2025-09-24 14:22:04 +01:00
Jake Turner d0d385ceef Use const reference for ShaderBindIndex argument passing 2025-09-24 13:53:56 +01:00
Jake Turner c0b77c1d0c Add thread safe SPIRV Debugger::AddDebugMessage()
Adds to an MT safe queue which is processed on the debugger device thread
Made ClampScalars static methods become Debugger helper member functions
2025-09-24 13:39:48 +01:00
Jake Turner 135389a605 Add asserts for VulkanAPIWrapper APIs to be called on the device thread 2025-09-24 12:17:58 +01:00
Jake Turner 6518e89b3e Change VulkanAPIWrapper::m_Creation to be const 2025-09-24 12:13:05 +01:00
baldurk 2fd7cd94e3 Only consider active lanes when choosing the candidate compute thread 2025-09-15 10:27:39 +01:00
baldurk d0b7d602a7 Fix the wrong type being declared for subgroupid 2025-09-11 12:55:21 +01:00
baldurk 07396210d3 Fix 32-bit compile errors 2025-07-31 00:52:37 +01:00
baldurk 316a9bafd7 Handle buffer views not being present when debugging descriptor buffers 2025-07-30 22:10:26 +01:00
baldurk 799a9a8452 Report and display descriptor buffer state in pipeline view 2025-07-30 22:10:25 +01:00
baldurk c9dc74c572 Use GPU address range tracker during replay for BDA buffers 2025-07-30 22:10:24 +01:00
baldurk ceb062b658 Add a DescriptorType to GetDescriptors query
* This will be optional in many cases but for some situations might be required
  when type information is not implicitly available in the descriptor store.
  Generally it should always be available unless the descriptor store is being
  viewed 'blank' purely from its contents with no other context.
2025-07-30 22:10:23 +01:00
baldurk d7236e0d91 Fix reads & writes to storage texel buffers in vulkan shader debugging 2025-05-26 14:59:46 +01:00
Jake Turner 7d35635844 Only default activate lane zero for SPIRV single threaded compute debug
Workgroup and Subgroup compute debug will set lane Active/SubgroupId properties for all threads
2025-05-07 11:15:05 +01:00
baldurk ade38c43d4 Only apply dynamic offsets for the relevant pipeline type 2025-04-24 16:12:15 +01:00
Jake Turner 261f957d5b SPIRV workgroup debugger, add padding lanes to align to subgroup size 2025-04-18 13:58:10 +01:00
Jake Turner 5f00ed9d39 SPIRV Debugger workgroup debugging fixes
Set the thread property SubgroupId for the extra lanes outside of the subgroup
pass the workgroup laneIndex to BeginDebug
Set the thread property GroupThreadIndex, GroupFlatIndex for all workgroup lanes
2025-04-18 13:58:10 +01:00
Jake Turner 29544f34e2 Remove VK, D3D12 Workgroup lane value is active assert
It will fire on lanes when workgroup size is not a multiple of the subgroup size
2025-04-14 17:25:09 +01:00
Jake Turner 88a9bde2f9 Add SubgroupSize to global_builtins for Vulkan shader debugging
Added for all stages (Vertex, Compute, Pixel)
2025-04-06 12:50:18 +01:00
baldurk 0ccec22757 Fix handling of sub-32-bit inputs in PS debugging. Closes #3569 2025-03-28 17:09:51 +00:00
baldurk b565693e15 Pass subgroup size and index through to DXIL instruction execute 2025-03-19 18:31:56 +00:00
baldurk 54810cc8a5 Fix thread calculation for subgroup&workgroup scope in shader debug 2025-03-19 18:31:55 +00:00
baldurk 2322e165de Update copyright years to 2025 2025-03-14 18:54:37 +00:00
baldurk c78f827c9e Improve quad swizzle helper to handle all possible swaps
* The old method with coarse+fine derivatives didn't return us thread 3's data
  into thread 0 (or vice versa) across the diagonal, which we needed in some
  cases.
* Porting the quad overdraw message passing works better.
2025-03-06 19:20:41 +00:00
Jake Turner 631144faab Set per-thread builtins for Vk Compute single thread debugging
DispatchThreadIndex
GroupThreadIndex
GroupFlatIndex
2025-02-26 12:08:24 +00:00
baldurk 0cc8cded0c Only simulate multiple threads with config option enabled 2025-02-21 13:46:59 +00:00
baldurk 98ce506da5 Specialise std::hash for old gcc/clang 2025-02-10 18:28:53 +00:00
baldurk 1befd5c32a Always consider subgroup index non-flat
* This is needed to ensure we get the right value for helper lanes
2025-02-10 17:52:31 +00:00
baldurk 876b0f8ff7 Pass subgroup size separately from workgroup size when beginning debug
* For compute shaders these can be different, in vertex/pixel these are at most
  identical
2025-02-10 17:52:30 +00:00
baldurk c3abc4504c Fetch subgroup data for vertex & compute shaders the same as pixel 2025-02-10 17:52:30 +00:00
baldurk 1347741463 Add some helpers for setting up debug-grab patching spec constants 2025-02-10 17:52:30 +00:00
baldurk af4bd659e0 Add fetch of subgroup data via GPU readback, handling helpers in PS 2025-02-10 17:52:30 +00:00
baldurk 8d3f40b0a9 Prepare SPIR-V debugger for larger workgroup sizes
* The workgroup size is passed in at creation time, and we handle the potenttial
  for multiple quads by identifying quads via quad ID
2025-02-10 17:52:30 +00:00
baldurk 1cfb684d16 Fetch subgroup configuration (which extensions) and max subgroup size 2025-02-10 17:52:30 +00:00
baldurk 7fcf64a562 Add query for per-thread properties when shader debugging
* This is distinct from input values or builtins because they're entirely
  internal for configuring the workgroup
2025-02-10 17:52:29 +00:00
baldurk f3ed63c7bf Refactor PS Input fetcher patch to be less pixel-specific
* We also (for now) preserve the existing entry point to keep codegen as similar
  as possible.
2025-02-10 17:52:29 +00:00
baldurk 4ad2deb049 Add a helper for running an action with proper barriers for feedback 2025-02-10 17:52:29 +00:00
baldurk 7369b8ad6c Refactor vulkan shader debugging to not apply derivatives
* We still use derivatives to fetch the input values for the quad when
  debugging, but we do it on the shader side and read back the raw inputs rather
  than input+derivatives
2025-02-10 17:52:29 +00:00
baldurk 26ef7efaa5 Update shader debugging to use new patched-descriptor helpers 2025-02-10 17:52:28 +00:00
baldurk f7c3bb61fe Calculate desired patched-buffer storage mode once 2025-02-10 17:52:28 +00:00
baldurk c4caa7395c Keep GPUBuffer fully unwrapped to avoid problems during capture 2024-12-09 16:19:20 +00:00
Honeybunch 3ea9735866 Mesh Shader Debugging 2024-11-20 10:50:14 +00:00
Jasmine Hansen 4e6cd9a0ae Add shader debugging support for VkShaderEXT objects
Functions: DebugVertex, DebugPixel, DebugThread
2024-10-09 13:04:23 +01:00
baldurk 8f88f1d125 Fix out of bounds array or iterator accesses 2024-10-04 10:32:32 +01:00
Jake Turner 66a43b3d45 Moved var_dispatch_helpers.h to replay/common folder
To enable sharing ShaderVariable helpers for the SPIRV and DXIL Shader Debuggers
2024-09-20 17:44:41 +01:00