Commit Graph
16281 Commits
Author SHA1 Message Date
baldurk 4df53b41d3 Delete parents after base objects
* This fixes a potential crash deleting an image view after an image, by
  ensuring a non-owning pointer to the image's resinfo remains valid until after
  the image view is destroyed.
2025-09-25 16:17:46 +01:00
Jake Turner 39c7dc1027 Fix python message handling reading out of bounds read 2025-09-24 15:47:14 +01:00
Jake Turner 8203032ec3 Fix out of bounds writes during spirv debugging
Previously it would allow writes to width/height/depth
2025-09-24 15:46:06 +01:00
Jake Turner da03329b12 Improve handling of NULL resources in Spirv Shader Debugger 2025-09-24 15:35:01 +01:00
Jake Turner 8898fa2e3e Use liveID to find the descriptor buffer resource in shader debug 2025-09-24 15:34:51 +01:00
Jake Turner 668fa75660 Change some asserts to be development only in Spirv Debugger
Asserts used during development of multi-threading and related to the consistency of expected state
2025-09-24 15:31:49 +01:00
Jake Turner 56415992ac Added CHECK_DEBUGGER_THREAD() to Spirv_Debug.cpp
Does nothing in RELEASE, replaces calls to

RDCASSERT(debugger.IsDeviceThread());
2025-09-24 15:29:01 +01:00
Jake Turner 5222954723 Add a lock when simulating Atomic Memory instructions 2025-09-24 15:21:41 +01:00
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 e9e081a55f Spirv Debugger run multiple simulation steps per job 2025-09-24 15:08:43 +01:00
Jake Turner d78edcbbea Added Debugger::GetBufferLength() 2025-09-24 15:02:32 +01:00
Jake Turner b9945d563e Active thread runs scope changes on the device thread
Run EnterFunction(), EnterEntryPoint(), ProcessScopeChange() on device thread
2025-09-24 14:59:28 +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 781984703b Change WritePointerValue, WriteThroughPointer to return DeviceOpResult
Mark any pointer writes that require a callback to run on the device thread
2025-09-24 14:50:46 +01:00
Jake Turner d93be6f2b2 Multi-threaded support for SPIRV wrapper APIs ReadTexel, WriteTexel 2025-09-24 14:45:14 +01:00
Jake Turner 8d9bb3f168 Add Spirv Debugger APIs to wrap API Wrapper APIs
The Debugger APIs run on the device thread if required,

FillInputValue(), ReadTexel(), WriteTexel()
2025-09-24 14:38:33 +01:00
Jake Turner 35fdf44c20 Spirv debugger support for queue and run of Simulation on Device Thread 2025-09-24 14:33:01 +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 b9d86315ff Change Spirv Shader Debugger steps chunk size to 1,000,000
Helps to reduce the number of replays during shader debugging which helps when captures have non-deterministic replay
2025-09-24 14:18:43 +01:00
Jake Turner f12aa91ba2 Python helpers to generate and check a full trace from shader debug 2025-09-24 14:13:59 +01:00
Jake Turner e6f75e1530 Update Spirv debugger methods to be const methods
Add read/write locking for containers "usedNames" and "dynamicNames"
2025-09-24 14:09:43 +01:00
Jake Turner 64b9e517e0 VK_Shader_Debug_Zoo test of overlapped GPU math and sampling operations 2025-09-24 14:01:47 +01:00
Jake Turner fc2c080a77 Remove unused cycles variable in VK_ShaderDebugZoo 2025-09-24 14:01:30 +01:00
Jake Turner d0d385ceef Use const reference for ShaderBindIndex argument passing 2025-09-24 13:53:56 +01:00
Jake Turner 3b74e038d2 Assert for SPIRV Subgroup Ops that the subgroup is converged 2025-09-24 13:49:51 +01:00
Jake Turner e5121962f3 Spirv Debugger control flow helper variable tweaks
Removed unused mergeBlock
Made control flow variables private with helper methods to get them
2025-09-24 13:46:00 +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 6163426870 Assert for SPIRV CalcDeriv that the lanes are converged 2025-09-24 13:36:12 +01:00
Jake Turner a2de7cb4ff Add Threading::JobSystem::GetCountWorkers() 2025-09-24 13:32:37 +01:00
Jake Turner a4bf961af3 Add asserts for SPIRV Debugger APIs to be called on the device thread 2025-09-24 13:22:46 +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
Jake Turner 6058969b74 Add VulkanCreationInfo const helpers
Useful for multi-threaded use of VulkanCreationInfo to guarantee it can't be accidentally mutated.

Primary usage is for SPRIV shader debugging.

Change existing VulkanDebugManager helpers to use the new helpers
2025-09-24 12:05:20 +01:00
Jake Turner decbcff6ab Enable Vk Workgroup and Subgroup tests 2025-09-24 12:04:37 +01:00
Jake Turner 754b5d21eb Change VK_Workgroup_Zoo test to be deterministic 2025-09-24 11:50:52 +01:00
Jake Turner b3981e9bf6 Change DXIL debugger to generate CBuffer Handle ShaderVariable data
Generate a struct of N x uint4, where N comes from the DXIL metadata cbuffer resource size
Fixes ShaderVariable malformed errors when using cbuffers with packedoffset
2025-09-23 16:18:00 +01:00
Jake Turner 0f0da06737 Fix DXIL Debugger Constants display of cbuffer with packedoffset
The simulation had the correct values

cbuffer packed_consts : register(b1)
{
  float col1z : packoffset(c1.z); // 4+2
  float col2w : packoffset(c2.w); // 8+3
};
2025-09-23 16:16:32 +01:00
Jake Turner bfb0b09db9 Fix DXBC Debugger for cbuffer with packedoffset at non-zero component
cbuffer packed_consts : register(b1)
{
  float col1z : packoffset(c1.z); // 4+2
  float col2w : packoffset(c2.w); // 8+3
};
2025-09-23 16:14:13 +01:00
Jake Turner e16a714aba New cbuffer tests: D3D11, D3D12 packedoffset; D3D12 cbuffer array
cbuffer packed_consts : register(b2)
{
  float col1z : packoffset(c1.z); // 4+2
  float col2w : packoffset(c2.w); // 8+3
};

struct ArrayStruct
{
  float4 a;
};

ConstantBuffer<ArrayStruct> array_consts[2] : register(b3);
2025-09-23 15:59:48 +01:00
Jake Turner b47e703c06 Include the cbuffer element byte offset in DXIL disassembly 2025-09-23 15:59:32 +01:00
baldurk 659bdee578 Implement D3D12 shader feedback for constant buffers 2025-09-23 14:49:20 +01:00
baldurk 3d1e78ba17 Handle buffers created in new state with undefined layout
* These can implicitly be transitioned to old states even though the spec says
  resources must go via COMMON - because there is no way to do that for new
  buffers.
2025-09-23 10:16:03 +01:00
baldurk de1fd89591 Remove debug code 2025-09-23 09:48:17 +01:00
baldurk 2381c2669d Add support in tests for compiling with separate shader debug info 2025-09-22 14:21:56 +01:00
baldurk 872752cd51 Add version check for -select-validator which was annoyingly removed 2025-09-22 14:21:36 +01:00
baldurk cda6da6945 Enumerate supported shader model in demos a bit more tightly 2025-09-22 13:49:51 +01:00
baldurk d4fd5b4977 Don't use = for argument parameters in SRCI information from dxc 2025-09-22 13:48:42 +01:00
baldurk 26cf7d3d7f Ensure shader reflection information is stored as const
* Avoids accidental modifications
2025-09-22 11:58:56 +01:00