Commit Graph

15002 Commits

Author SHA1 Message Date
Jake Turner 53e73a1eda DXIL Debugger support for Source Variables
Using Dwarf debug metadata and llvm.dbg.declare, llvm.dbg.value calls
2024-09-18 11:34:56 +01:00
Cam Mannett 031c4955e9 Check command buffer callback queue before VkDevice is destroyed
We only check for signaled events on each queue submit, so the last submission before exit will never be checked.  This change makes sure we release for completed submissions just before the device is destroyed (typically target application exit).  In this case the callbacks are not called.
2024-09-18 11:06:58 +01:00
Jake Turner 0f8ad0d1fe Conditionally test SM 6.0, 6.6 in D3D12_Shader_Debug_Zoo
Added SM 5.0 to the basic compute shader debug test
2024-09-16 09:36:37 +01:00
Jake Turner 97c4899d66 DXIL Debugger BeginDebug 2024-09-13 16:40:17 +01:00
Jake Turner 14d0fdb964 DXIL Debugger methods
void CalcActiveMask(rdcarray<bool> &activeMask);
void ParseDbgOpDeclare(const DXIL::Instruction &inst, uint32_t instructionIndex);
void ParseDbgOpValue(const DXIL::Instruction &inst, uint32_t instructionIndex);
size_t AddScopedDebugData(const DXIL::Metadata *scopeMD, uint32_t instructionIndex);
size_t FindScopedDebugDataIndex(const DXIL::Metadata *md) const;
size_t Debugger::FindScopedDebugDataIndex(const uint32_t instructionIndex) const;
void AddDebugType(const DXIL::Metadata *typeMD);
2024-09-13 16:38:53 +01:00
Jake Turner 5f3e864795 DXIL Debugger ThreadState::ExecuteInstruction 2024-09-13 16:33:13 +01:00
Jake Turner b528119494 DXIL Debugger ThreadState methods
ThreadState(uint32_t workgroupIndex, Debugger &debugger, const GlobalState &globalState);
~ThreadState();
void EnterFunction(const DXIL::Function *function, const rdcarray<DXIL::Value *> &args);
void EnterEntryPoint(const DXIL::Function *function, ShaderDebugState *state);
bool Finished() const;
MarkResourceAccess(const rdcstr &name, const DXIL::ResourceReference *resRef);
void SetResult(const Id &id, ShaderVariable &result, DXIL::Operation op, DXIL::DXOp dxOpCode,
                 ShaderEvents flags);
bool GetShaderVariable(const DXIL::Value *dxilValue, DXIL::Operation op, DXIL::DXOp dxOpCode,
                         ShaderVariable &var, bool flushDenormInput = true) const;
bool GetVariable(const Id &id, DXIL::Operation opCode, DXIL::DXOp dxOpCode,
                   ShaderVariable &var) const;
void ProcessScopeChange(const rdcarray<Id> &oldLive, const rdcarray<Id> &newLive);
rdcstr GetArgumentName(uint32_t i) const;
Id GetArgumentId(uint32_t i) const;
void PerformGPUResourceOp(const rdcarray<ThreadState> &workgroups, DXIL::Operation opCode,
                            DXIL::DXOp dxOpCode, const DXIL::ResourceReference *resRef,
                            DebugAPIWrapper *apiWrapper, const DXIL::Instruction &inst,
                            ShaderVariable &result);
void Sub(const ShaderVariable &a, const ShaderVariable &b, ShaderValue &ret) const;

ShaderValue DDX(bool fine, DXIL::Operation opCode, DXIL::DXOp dxOpCode,
                  const rdcarray<ThreadState> &quad, const Id &id) const;
ShaderValue DDY(bool fine, DXIL::Operation opCode, DXIL::DXOp dxOpCode,
                  const rdcarray<ThreadState> &quad, const Id &id) const;

ExecuteInstruction() is just a stub

And Debugger methods

const rdcarray<Id> &GetLiveGlobals();
const DXIL::Program &GetProgram() const;
const FunctionInfo *GetFunctionInfo(const DXIL::Function *function) const;
2024-09-13 16:30:16 +01:00
Jake Turner 853aee353c DXIL Debugger internal helper methods
DXILDebug::Id GetSSAId(DXIL::Value *value);
bool OperationFlushing(const Operation op, DXOp dxOpCode);
ShaderEvents AssignValue(ShaderVariable &result, const ShaderVariable &src, bool flushDenorm);
uint8_t GetElementByteSize(VarType type);
DXBC::ResourceRetType ConvertComponentTypeToResourceRetType(const ComponentType compType);
DXBCBytecode::ResourceDimension ConvertResourceKindToResourceDimension(const ResourceKind kind);
DXBCBytecode::SamplerMode ConvertSamplerKindToSamplerMode(const SamplerKind kind);
VarType ConvertDXILTypeToVarType(const Type *type);
void TypedUAVStore(DXILDebug::GlobalState::ViewFmt &fmt, byte *d, const ShaderValue &value);
ShaderValue TypedUAVLoad(DXILDebug::GlobalState::ViewFmt &fmt, const byte *d);
void FillViewFmt(VarType type, DXILDebug::GlobalState::ViewFmt &fmt);
2024-09-13 16:06:22 +01:00
Jake Turner ef6dea5397 DXIL DebugAPIWrapper Interface 2024-09-13 15:56:24 +01:00
Jake Turner 82005c8fee DXIL Debugger support code in D3D12_ShaderDebug.cpp
Code is effectively disabled because DXIL GetDebugStatus() returns "Debugging DXIL is not supported"
Includes minimum required helper structs/methods in DXIL Debugger
2024-09-13 15:31:36 +01:00
Jake Turner d1f69b5c72 DXIL Debugging D3D12APIWrapper
Includes minimum required helper structs/methods in DXILDebug
2024-09-13 15:03:31 +01:00
Jake Turner 772be86ec4 DXIL Source File and Line Debug Data 2024-09-13 14:46:48 +01:00
Jake Turner f8ddc1720a Added prototype of DXIL Source Variable Debug Data 2024-09-13 14:43:04 +01:00
Jake Turner 881e5e8e03 Added DoStringise() for DXIL::DW_OP 2024-09-13 14:40:28 +01:00
baldurk eed31e2a09 Fix compute shader handling of implicitly-set unspecified root signature
* Previous commit 304e636 fixed this for most cases but was incorrect for
  compute PSOs.
2024-09-13 13:22:04 +01:00
baldurk 51baf8a6af Add test of implicit compute shader root signature 2024-09-13 13:22:03 +01:00
baldurk 457e91f194 Make sure root signatures *precisely* patch between HLSL and code
* Also don't finish with the backbuffer too early and re-bind VB after execute
  indirect.
2024-09-13 13:22:03 +01:00
baldurk f689b23024 Don't run D3D12 singleton device test if we're using new device creation 2024-09-13 13:22:03 +01:00
Jake Turner 1cc0fd0323 D3D12 Shader Debug preparation for DXIL Pixel Shader Debugging
Move pixel shader debugging code which is shared by DXBC/DXIL to outside of if DXBC scope
2024-09-10 14:59:04 +01:00
Jake Turner 2dad8233a3 Added more DXIL Debug Info helpers, made debug info helpers const
rdcstr GetDebugScopeFilePath(const DIBase *d) const;
uint64_t GetDebugScopeLine(const DIBase *d) const;
const Metadata *GetDebugScopeParent(const DIBase *d) const;
2024-09-10 14:59:04 +01:00
Jake Turner 7b2754a978 Santisie the shader source filenames in DXIL BuildReflection
Reset Files and m_CompileFlags to avoid accumulation with repeated calls to BuildReflection
Set "preferSourceDebug" to "1" if the DXIL has source file data
2024-09-10 14:59:04 +01:00
Jake Turner f730eb6659 Add helper: rdcstr standardise_directory_separator(const rdcstr &path);
Replaces all directory separators combinations with '/'
i.e.
'\' -> '/'
'//' -> '/'
2024-09-10 14:59:03 +01:00
Jake Turner e7e3f00508 Move DXIL SSA ID for function arguments outside of instructions loop 2024-09-10 14:59:03 +01:00
Jake Turner a6bcd8c472 Added DoStringise for DXIL::LLVMDbgOp and DXIL::DIBase::Type 2024-09-10 14:59:03 +01:00
Jake Turner b245917867 Renamed DXIL::Program::GetReflection() to BuildReflection() 2024-09-10 14:59:03 +01:00
Jake Turner 8745c399ad Extended existing shader model coverage to include 6.0, and 6.6
Added Compute shader test for SM 6.0 and SM 6.6
Added very basic vertex shader test to the triangle rendering for each SM
2024-09-10 14:59:03 +01:00
Cam Mannett de07e66728 Use GLSL 460 for built-in spirv-cross -> GLSL calls
spirv-cross defaults to 450 but will not parse shaders containing the RayQuery capability unless the version is set to 460.

This change modifies the built-in GLSL cross tool to set `--version 460`.  This change does not affect user-specified spirv-cross configurations.
2024-09-10 12:16:08 +01:00
baldurk 407c74de01 Fixed an issue with indirect count and secondary command buffers
* Added logic to shift the beginEvent for any command nodes that occur after a
  draw indirect count action within a command tree.
2024-09-09 14:45:30 +01:00
baldurk 178b733001 Add helper for loading a shader module from disk in tests 2024-09-09 14:45:30 +01:00
baldurk 1ca4b70bf9 Display quad overdraw as disabled when MSAA is enabled on vulkan
* No API supports the quad overdraw with MSAA, but on other APIs it's feasible
  to downgrade and render the overlay at single sampled. On Vulkan with
  renderpasses this is not possible.
2024-09-09 14:45:30 +01:00
baldurk 3c6520d250 Add support for multiview with quad overdraw overlay. Closes #3424
* We multiply the internal array image up by the number of views and read from
  viewindex to write and resolve from different sets of slices
2024-09-09 14:43:17 +01:00
baldurk c7b0c240e2 Fix deferred handles to start properly from the upper bits
* INTPTR_MAX may overlap with valid pointers on android
2024-09-07 12:37:23 +01:00
baldurk 546490c1a6 Add a unit test for strip_nonbasic 2024-09-06 16:42:11 +01:00
baldurk bd62fb9a1d Release all internal pointers in wrapped device configuration 2024-09-06 16:42:11 +01:00
baldurk 5fe6b5c8e2 Print file & line for error-checked return codes 2024-09-06 16:42:10 +01:00
Cam Mannett f6327194bc Switch to a ref-counted solution 2024-09-06 16:38:43 +01:00
Cam Mannett b730e55b93 Vulkan AS rebuild-on-replay: On queue submission completion events
If an AS build command is called on an already built AS (i.e. an update build) then we need to safely destroy the previously copied input buffers and their memory.  However at the point this happens, we do not own the command buffer so we don't know if the original data has actually been copied yet.

Using the mechanism in this patch we associate function objects with the command buffer that will be executed when the queue the command buffer is submitted to, has finished executing on the GPU.

This works by carying the function objects in command buffer and once it is submitted, we poll on a VkEvent we inserted.  Once signalled, we call the function objects in the order they were inserted.
2024-09-06 16:38:43 +01:00
baldurk 677bc4701f 32-bit compile fix 2024-09-04 17:22:27 +01:00
baldurk 05ac8bed37 Update to latest DX headers and block workgraph functionality 2024-09-04 16:35:06 +01:00
baldurk bb6c6d84b2 Fix deferred pipeline compilation & naming on vulkan 2024-09-04 13:23:52 +01:00
baldurk 1402c5c417 Compile fix for use of sqrt 2024-09-03 17:00:49 +01:00
baldurk 076e07912d Add test of implicit embedded root signatures 2024-09-03 15:00:35 +01:00
baldurk 282e76a2f5 Defer state object compilation on D3D12 2024-09-03 14:22:01 +01:00
baldurk d7f3f194da Defer normal pipeline object compilation on D3D12 2024-09-03 14:22:01 +01:00
baldurk 54ee4217b9 Defer pipeline compilation on Vulkan to jobs 2024-09-03 14:22:01 +01:00
baldurk c4e9ef1d77 Add the ability to defer a wrapped handle during replay temporarily
* We create a fake handle to provide to the wrapping system which will be non-
  functional, and then later on update the mapping information once the real
  handle has been patched in.
* On vulkan we don't know what valid handles might be but we assume they will
  likely be pointer-like, so we start from -1 and move downward with the fake
  handles to avoid a clash (which would break).
2024-09-03 14:22:00 +01:00
baldurk 8826c96454 Initialise job system on Vulkan & D3D12
* We only expect to use jobs currently for the loading portion before the frame
  capture scope, so we synchronise on jobs and process any deferred failures
  immediately after applying initial contents and before doing the first frame
  capture replay.
2024-09-03 14:22:00 +01:00
baldurk a784c9a1a7 Add unit tests for the job system 2024-09-03 14:22:00 +01:00
baldurk 69a92bbc84 Add job system for deferring tasks in parallel 2024-09-03 14:22:00 +01:00
baldurk abdc3c2b4f Fix android compilation 2024-09-02 18:10:37 +01:00