Commit Graph

14674 Commits

Author SHA1 Message Date
Jake Turner 69bc0eaa47 Added Empty DXIL Shader Debugger helper files to the project
renderdoc/driver/d3d12/d3d12_dxil_debug.[h,cpp]
Will contain replay helper functions for DXIL debugger including the wrapper for D3D12 API interaction i.e. "DXILDebug::D3D12APIWrapper"
2024-05-11 13:28:52 +01:00
Jake Turner 2dcb0d0364 RD DXIL Disassembly: tweaks to label formatting
Add the DXIL::Identifier before labels for consistency
Do not display predicate "_0"
Change predicate column to 30 instead of 50
2024-05-11 07:05:02 +01:00
Jake Turner 139167a001 RD DXIL Disassembly: Use HLSL intrinsic names where possible for dx.op.* 2024-05-11 06:49:50 +01:00
Jake Turner 8a5b5754fd RD DXIL Disassembly: fix type decoding for arrayed resources
Before

Texture2D<Texture2D<vector<float, 4> >[0]> bindlessTexture2D[] : register(t0, space4);

After

Texture2D<float4> bindlessTexture2D[] : register(t0, space4);
2024-05-11 06:11:19 +01:00
baldurk e1283a7440 Handle root signature ranges that bind a subset of a binding array 2024-05-10 10:29:42 +01:00
William Pearson 3b2bb46d9a Don't replace shaders for incomplete pipeline libraries
Before, RenderDoc would treat these incomplete pipeline libraries as if
they were complete pipelines, and thus attempt to create pipelines with
incomplete data, producing several validation errors and on some devices
crashes.

For instance, a pipeline library that only contains a vertex or fragment
shader but not input assembly state would use invalid input assembly
state (specifically, VulkanShaderCache::MakeGraphicsPipelineInfo would
use the topology value from VulkanCreationInfo::Pipeline, which is set
to VK_PRIMITIVE_TOPOLOGY_MAX_ENUM (0x7fffffff) if the pipeline has no
input assembly state by VulkanCreationInfo::Pipeline::Init).

Additionally, those pipeline libraries were treated as complete graphics
pipelines, not libraries, as VulkanShaderCache::MakeGraphicsPipelineInfo
removes VK_PIPELINE_CREATE_LIBRARY_BIT_KHR and no
VkGraphicsPipelineLibraryCreateInfoEXT was added to the pNext chain.

RenderDoc already merges the pipeline libraries into complete graphics
pipelines, so there is no reason to recreate the libraries with modified
shaders.
2024-05-10 09:53:10 +01:00
Jasmine Hansen 91c13a0e9f Implemented vkGetShaderBinaryDataEXT.
Added logic to return a fake UUID for shader binaries if vkGetShaderBinaryDataEXT is called.

Co-authored-by: James Sumihiro <james.sumihiro@ntd.nintendo.com>
2024-05-10 09:35:41 +01:00
baldurk 2e2b9d2cf9 Add support for AddToStateObject 2024-05-09 15:00:30 +01:00
baldurk 913e4b680d Pass wrapped subobjects to export database initialisation 2024-05-09 15:00:30 +01:00
baldurk 088fc3e1f6 Fix handling of implicit default local root signatures in state objects 2024-05-09 15:00:30 +01:00
baldurk 9b3861a97f Fix loop looking up shader record offset 2024-05-09 15:00:30 +01:00
baldurk 84dc120871 Fix GPU patching of handles in local root signatures 2024-05-09 15:00:30 +01:00
baldurk 731f137e2f Destroy ASs when the ASB backing them is destroyed 2024-05-09 15:00:30 +01:00
baldurk b41d4159ce Use unmangled names for looking up shader identifiers 2024-05-09 15:00:30 +01:00
baldurk ace23d3f61 Actually remove export databases when unregistered 2024-05-09 15:00:30 +01:00
baldurk 4001d197e1 Serialise handle base for descriptor heaps to GPU unwrap on replay 2024-05-09 15:00:30 +01:00
baldurk 25f7eff9a3 Add support for AS copies on D3D12
* Most of these - all but a clone - require us to wait for the GPU execution to
  finish to get the size of the resulting AS to update our tracking. We issue a
  fence from the queue at submission time and then leave the RT manager to check
  for updates on each submission to get the latest information.
2024-05-09 15:00:30 +01:00
baldurk cc3b2f6443 Add post-submission AS build callbacks that need to wait for GPU sync
* This will be needed for copies where the size may not be known on the CPU -
  currently for AS builds we know the size directly.
* We also only store the size of an AS not the whole pre-build info since we
  don't need the scratch data and it won't be available in full for copies.
2024-05-09 15:00:29 +01:00
Jake Turner 75810b983c DXIL Shader Debug paths for DebugThread/DebugVertex/DebugPixel
The DXIL paths should not be executed and currently populated with error messages that DXIL debugger support is missing.
2024-05-09 12:36:45 +01:00
Jake Turner c54299f63f Added "DXBCContainerDebugger" to wrap DXBC or DXIL shader debugger
DXBC and DXIL Shader Debugger's inherit from "DXBCContainerDebugger : public ShaderDebugger".
"DXBCContainerDebugger" has member variable "isDXIL" to be able to choose if DXIL or DXBC ShaderDebugger is active and allow the correct cast from "ShaderDebugger" to be made.
Added stub of DXILDebug::Debugger in new files "drivers/shaders/dxil/dxil_debug.[h,cpp]"
2024-05-09 12:36:45 +01:00
Jake Turner 8ba66e92a7 Added rdcstr DXIL::Program::GetDebugStatus()
returns "DXIL Debugging is not supported"
2024-05-09 07:23:27 +01:00
Jake Turner b75fa90630 Add DoStringise(const DXIL::Operation &el) 2024-05-08 14:42:17 +01:00
Jake Turner 8498f24ce3 Use STRINGISE_ENUM_CLASS for DXIL::AtomicBinOpCode DoStringise
Didn't need to use STRINGISE_ENUM_CLASS_NAMED
2024-05-08 14:42:16 +01:00
David McFarland a2aef882e9 Add support for 64-bit elfs from atidxx
This is what I get using the latest drivers (24.4.1) on Windows.
2024-05-08 13:51:29 +01:00
Jake Turner 61011d1d03 RD DXIL Disassembly: fix typo " = " should be " == " 2024-05-06 16:23:53 +01:00
Jake Turner a8cd40cd5d DXIL Reflection GetEntryPoints() handle tags being NULL 2024-05-06 15:49:59 +01:00
Jake Turner d0bbdc3143 Add "DXC DXIL" disassembly target
Default to using DXBC/DXIL disassembly target which shows RD DXIL disassembly
"DXC DXIL" disassembly target shows the DXC style DXIL disassembly which was the default in RenderDoc before the RD DXIL disassembly view existed
2024-05-06 12:39:40 +01:00
Jake Turner 76aa3b026d RD DXIL Disassembly: tweak display of resources
Show resources as part of entry point decoding instead of outside
Format resource display in a more HLSL source way

Example output:

Inputs
  float4 SV_Position;
  float3 WorldPos;
  float2 TexCoord0;
  float3 TexCoord1;
  float3 TexCoord2;
  float3 Normal;
  float3 Tangent;
  float3 Bitangent;

Outputs
  float3 SV_Target0;
  float3 SV_Target1;

StructuredBuffer<struct.LightData> Buffer : register(t14, space0);
Texture2DArray<float> ArrayTex : register(t15, space0);
ByteAddressBuffer<int> Grid : register(t16, space0);
Texture2D<float3> Diffuse : register(t0, space0);
Texture2D<float3> Specular : register(t1, space0);
Texture2D<float3> Normal : register(t3, space0);
Texture2D<float> SSAO : register(t12, space0);
Texture2D<float> Shadow : register(t13, space0);

cbuffer PSConstants : register(b0, space0)
{
  float3 Direction;
  float4 TexelSize;
  int4 CountTiles;
  int4 IndexLight;
};

int defaultSampler : register(s10, space0);
int shadowSampler : register(s11, space0);
2024-05-06 12:08:31 +01:00
Jake Turner 30e32b6a62 RD DXIL Disassembly: hand edit funcNamSigs
remove parameter names from functions when it is clear what the parameter(s) mean i.e.

FAbs(value) -> FAbs()
FMax(a,b) -> FMax()
2024-05-06 12:08:25 +01:00
Jake Turner 03be4a7973 RD DXIL Disassembly: decode "dx.op.dot[234]"
Example Output

%37 = call float @dx.op.dot2.f32(i32 54, float %12, float %15, float %18, float %21)
%39 = call float @dx.op.dot3.f32(i32 55, float %18, float %21, float %24, float %27, float %30, float %33)
%41 = call float @dx.op.dot4.f32(i32 56, float %27, float %30, float %33, float %36, float %12, float %12, float %12, float %12)

Becomes:

float _37 = dot({_12, _15}, {_18, _21});
float _39 = dot({_18, _21, _24}, {_27, _30, _33});
float _41 = dot({_27, _30, _33, _36}, {_12, _12, _12, _12});
2024-05-06 12:08:21 +01:00
Jake Turner 0d3c118666 RD DXIL Disassembly: decode "dx.op.atomicBinOp"
Example Output

%AtomicAdd = call i32 @dx.op.atomicBinOp.i32(i32 78, %dx.types.Handle %Histogram_UAV_rawbuf, i32 0, i32 %16, i32 undef, i32 undef, i32 %15)

Becomes

int _AtomicAdd = Histogram.InterlockedAdd({_16}, _15);
2024-05-06 06:57:59 +01:00
Jake Turner 1b351968fa Added DXIL::AtomicBinOpCode enum and DoStringise 2024-05-06 06:57:59 +01:00
Jake Turner 68b757aab6 Add more entries to DXOp enum
Use the DXOp enum instead of hard coded values in RD DXIL Disassembly
2024-05-06 06:57:59 +01:00
Jasmine Hansen 20f0d6870b Add function hooks for VK_EXT_shader_object
Functions that are provided by VK_EXT_shader_object as well as other extensions are declared as an OR of both extensions in the macro.

Added a new feature boolean: m_ShaderObject to WrappedVulkan that can be checked against wherever the dynamic state booleans are used.

Co-authored-by: James Sumihiro <james.sumihiro@ntd.nintendo.com>
2024-05-04 08:58:33 +01:00
Jasmine Hansen 0b0d8b4703 Add serialization of VK_EXT_shader_object types 2024-05-04 08:58:33 +01:00
baldurk 71d3e41fbf Fix delete that should be release 2024-05-02 19:17:57 +01:00
baldurk f8b5c42100 Add a command line argument to the demos project to load a DLL
* We also automatically check for a DLL under /D3D12/ next to the executable
2024-05-02 18:30:46 +01:00
baldurk 87a905b0e6 Add support for capturing programs using new D3D12 DLL selection API
* We also use it for replay when available instead of self-function-hooking
2024-05-02 18:10:57 +01:00
Jake Turner 2b0d898b34 RD DXIL Disassembly: add "ssaAliases" container
Used to display dx.op function arguments with a different string.
The resource handles store the resource name as an SSA register alias.
2024-05-02 10:58:23 +01:00
Jake Turner d71496aabc RD DXIL Disassembly: decode "dx.op.sample*"
Example Output

%25 = call %dx.types.ResRet.f32 @dx.op.sample.f32(i32 60, %dx.types.Handle %texDiffuse_texture_2d, %dx.types.Handle %defaultSampler_sampler, float %16, float %17, float undef, float undef, i32 0, i32 0, i32 undef, float undef)

Becomes

_dx.types.ResRet.f32 _25 = texDiffuse.Sample(defaultSampler, _16, _17, Offset = {0, 0});
2024-05-02 10:07:28 +01:00
Jake Turner 91f19a9ed5 RD DXIL Disassembly: merged funcNames and funcSigs together
Makes development simpler to be able to see parameter names with function names
2024-05-02 10:07:28 +01:00
Jake Turner 13ccbe2b84 RD DXIL Disassembly: decode "dx.op.textureStore"
Example Output

call void @dx.op.textureStore.f32(i32 67, %dx.types.Handle %OutLuma_UAV_2d, i32 %1, i32 %2, i32 undef, float %18, float %18, float %18, float %18, i8 15)

Becomes

OutLuma[_1, _2] = {_18, _18, _18, _18};
2024-05-02 07:09:49 +01:00
Jake Turner d1150f244f RD DXIL Disassembly: decode "dx.op.textureLoad"
Example Output

%TextureLoad = call %dx.types.ResRet.f32 @dx.op.textureLoad.f32(i32 66, %dx.types.Handle %texSSAO_texture_2d, i32 0, i32 %23, i32 %24, i32 undef, i32 undef, i32 undef, i32 undef)
Becomes

_dx.types.ResRet.f32 _TextureLoad = texSSAO.Load(_23, _24);
2024-05-02 07:09:43 +01:00
Jake Turner e6bf418c30 RD DXIL Disassembly: decode "dx.op.bufferStore" &"dx.op.rawBufferStore"
Example Output

call void @dx.op.rawBufferStore.f32(i32 140, %dx.types.Handle %Exposure_UAV_structbuf, i32 1, i32 0, float %75, float undef, float undef, float undef, i8 1, i32 4)
call void @dx.op.rawBufferStore.f32(i32 140, %dx.types.Handle %Exposure_UAV_structbuf, i32 2, i32 0, float %FMin, float undef, float undef, float undef, i8 1, i32 4)
call void @dx.op.rawBufferStore.f32(i32 140, %dx.types.Handle %Exposure_UAV_structbuf, i32 3, i32 0, float %59, float undef, float undef, float undef, i8 1, i32 4)

Becomes

Exposure[1] = {_75};
Exposure[2] = {_FMin};
Exposure[3] = {_59};
2024-05-02 07:09:38 +01:00
Jake Turner 30cf5412ba RD DXIL Disassembly: decode "dx.op.bufferLoad" &"dx.op.rawBufferLoad"
Example Output

%31 = call %dx.types.ResRet.i32 @dx.op.bufferLoad.i32(i32 68, %dx.types.Handle %bufOut_UAV_structbuf, i32 1, i32 0);

Becomes

_dx.types.ResRet.i32 _31 = bufOut[1];
2024-05-01 15:58:04 +01:00
Jake Turner 70c5fd91ad RD DXIL Disassembly: handle non-constant args during specifc decoding
dx.op.loadInput
dx.op.storeOutput
dx.op.createHandle
dx.op.cbufferLoad
dx.op.cbufferLoadLegacy
2024-05-01 14:52:46 +01:00
Jake Turner 99e10f24c7 RD DXIL Disassembly: decode "dx.op.cbufferLoad*" to show members
CBuffer[0] blah Space: 0 Reg: 0 Count: 1
{
  int4 mult;
};

Example Output

_dx.types.CBufRet.i32 %1 = CBufferLoadLegacy(%blah_cbuffer, 0);

becomes

_dx.types.CBufRet.i32 _1 = {blah.mult};
2024-05-01 14:52:46 +01:00
Jake Turner 9b97fa5ed0 RD DXIL Disassembly: improve presentation of Inputs and Outputs
Handle Inputs and Outputs which have multiple rows
Prefix Inputs with "<IN>."
Prefix Outputs with "<OUT>."
Inputs and Outputs can share the same names (semantic names) i.e. COLOR, INTERPOLATOR
2024-05-01 10:26:14 +01:00
Jake Turner 18b655edf5 RD DXIL Disassembly refactoring
Renamed:
DXIL::EntryPoint -> DXIL::EntryPointInterface
DXIL::Program::FetchEntryPoints() -> DXIL::Program::FetchEntryPointInterfaces()
Deleted EntryPointsInfo helper struct
2024-05-01 08:07:27 +01:00
Jake Turner 4d10322908 RD DXIL Disassembly: decode "dx.op.createHandle" to show resource name 2024-05-01 08:05:29 +01:00