From d40b87aed0fae3358d7376e72426c9bd6360f5ff Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 20 Sep 2016 17:28:37 +0200 Subject: [PATCH] Rejig how root signature data is organised in pipeline state --- renderdoc/api/replay/d3d12_pipestate.h | 51 +++++++++++-------- renderdocui/Interop/D3D12PipelineState.cs | 60 ++++++++++++++--------- 2 files changed, 69 insertions(+), 42 deletions(-) diff --git a/renderdoc/api/replay/d3d12_pipestate.h b/renderdoc/api/replay/d3d12_pipestate.h index 90dca1acb..d1e999700 100644 --- a/renderdoc/api/replay/d3d12_pipestate.h +++ b/renderdoc/api/replay/d3d12_pipestate.h @@ -161,37 +161,48 @@ struct D3D12PipelineState ResourceId Buffer; uint64_t Offset; uint32_t ByteSize; + + rdctype::array Immediate; }; struct RootSignature { ResourceId obj; - struct RootElem + // Immediate indicates either a root parameter (not in a table), or static samplers + // RootElement is the index in the original root signature that this descriptor came from. + + struct CBufferDescriptor { ShaderStageBits VisibilityMask; + bool32 Immediate; + uint32_t RootElement; - // true for root constants and root descriptors - bool32 RootElement; - - // for tables this is the expanded list of all the ranges and their values, for - // root constants and root descriptors there's only one element with their value - struct Descriptor - { - uint32_t RegSpace; - uint32_t RegIndex; - - ShaderBindType Type; - - rdctype::array Constants; - - CBuffer ConstantBuffer; - ResourceView View; - }; - rdctype::array Descriptors; + CBuffer obj; }; - rdctype::array Elements; + struct ViewDescriptor + { + ShaderStageBits VisibilityMask; + bool32 Immediate; + uint32_t RootElement; + + ResourceView obj; + }; + + struct SamplerDescriptor + { + ShaderStageBits VisibilityMask; + bool32 Immediate; + uint32_t RootElement; + + Sampler obj; + }; + + rdctype::array ConstantBuffers; + rdctype::array Samplers; + rdctype::array SRVs; + rdctype::array UAVs; } m_RootSig; struct Streamout diff --git a/renderdocui/Interop/D3D12PipelineState.cs b/renderdocui/Interop/D3D12PipelineState.cs index c82d691db..e86a760c5 100644 --- a/renderdocui/Interop/D3D12PipelineState.cs +++ b/renderdocui/Interop/D3D12PipelineState.cs @@ -164,6 +164,9 @@ namespace renderdoc public ResourceId Buffer; public UInt64 Offset; public UInt32 ByteSize; + + [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] + public UInt32[] Immediate; }; [StructLayout(LayoutKind.Sequential)] @@ -172,33 +175,46 @@ namespace renderdoc public ResourceId Obj; [StructLayout(LayoutKind.Sequential)] - public class RootElem + public class CBufferDescriptor { public ShaderStageBits VisibilityMask; + public bool Immediate; + public UInt32 RootElement; - public bool RootElement; - - [StructLayout(LayoutKind.Sequential)] - public class Descriptor - { - public UInt32 RegSpace; - public UInt32 RegIndex; - - public ShaderBindType Type; - - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public UInt32[] Constants; - - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - CBuffer ConstantBuffer; - [CustomMarshalAs(CustomUnmanagedType.CustomClass)] - ResourceView View; - }; - [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public Descriptor[] Descriptors; + [CustomMarshalAs(CustomUnmanagedType.CustomClass)] + CBuffer obj; }; + + [StructLayout(LayoutKind.Sequential)] + public class ViewDescriptor + { + public ShaderStageBits VisibilityMask; + public bool Immediate; + public UInt32 RootElement; + + [CustomMarshalAs(CustomUnmanagedType.CustomClass)] + ResourceView obj; + }; + + [StructLayout(LayoutKind.Sequential)] + public class SamplerDescriptor + { + public ShaderStageBits VisibilityMask; + public bool Immediate; + public UInt32 RootElement; + + [CustomMarshalAs(CustomUnmanagedType.CustomClass)] + Sampler obj; + }; + [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] - public RootElem[] Elements; + public CBufferDescriptor[] ConstantBuffers; + [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] + public SamplerDescriptor[] Samplers; + [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] + public ViewDescriptor[] SRVs; + [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] + public ViewDescriptor[] UAVs; }; [CustomMarshalAs(CustomUnmanagedType.CustomClass)] public RootSignature m_RootSig;