From c44f355380ab874050ad70a538700488779b0024 Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 15 Mar 2017 13:22:57 +0000 Subject: [PATCH] Remove nested structs from D3D12 pipeline state and move to namespace --- qrenderdoc/Code/CaptureContext.cpp | 2 +- qrenderdoc/Code/CaptureContext.h | 2 +- qrenderdoc/Code/CommonPipelineState.cpp | 15 +- qrenderdoc/Code/CommonPipelineState.h | 6 +- .../D3D12PipelineStateViewer.cpp | 66 +- .../PipelineState/D3D12PipelineStateViewer.h | 11 +- renderdoc/api/replay/d3d12_pipestate.h | 688 +++++++++--------- renderdoc/api/replay/renderdoc_replay.h | 4 +- renderdoc/core/image_viewer.cpp | 2 +- renderdoc/core/replay_proxy.cpp | 43 +- renderdoc/core/replay_proxy.h | 4 +- renderdoc/driver/d3d11/d3d11_replay.h | 2 +- renderdoc/driver/d3d12/d3d12_replay.cpp | 62 +- renderdoc/driver/d3d12/d3d12_replay.h | 8 +- renderdoc/driver/gl/gl_replay.h | 2 +- renderdoc/driver/vulkan/vk_replay.h | 2 +- renderdoc/replay/replay_driver.h | 2 +- renderdoc/replay/replay_renderer.cpp | 6 +- renderdoc/replay/replay_renderer.h | 4 +- 19 files changed, 473 insertions(+), 458 deletions(-) diff --git a/qrenderdoc/Code/CaptureContext.cpp b/qrenderdoc/Code/CaptureContext.cpp index aa247ce1a..c6ec5caf9 100644 --- a/qrenderdoc/Code/CaptureContext.cpp +++ b/qrenderdoc/Code/CaptureContext.cpp @@ -535,7 +535,7 @@ void CaptureContext::CloseLogfile() m_TextureList.clear(); CurD3D11PipelineState = D3D11Pipe::State(); - CurD3D12PipelineState = D3D12PipelineState(); + CurD3D12PipelineState = D3D12Pipe::State(); CurGLPipelineState = GLPipe::State(); CurVulkanPipelineState = VKPipe::State(); CurPipelineState.SetStates(m_APIProps, NULL, NULL, NULL, NULL); diff --git a/qrenderdoc/Code/CaptureContext.h b/qrenderdoc/Code/CaptureContext.h index 02d0d96cc..c29dbff6f 100644 --- a/qrenderdoc/Code/CaptureContext.h +++ b/qrenderdoc/Code/CaptureContext.h @@ -165,7 +165,7 @@ public: void windowClosed(QWidget *window); D3D11Pipe::State CurD3D11PipelineState; - D3D12PipelineState CurD3D12PipelineState; + D3D12Pipe::State CurD3D12PipelineState; GLPipe::State CurGLPipelineState; VKPipe::State CurVulkanPipelineState; CommonPipelineState CurPipelineState; diff --git a/qrenderdoc/Code/CommonPipelineState.cpp b/qrenderdoc/Code/CommonPipelineState.cpp index 907debc3a..e024748e3 100644 --- a/qrenderdoc/Code/CommonPipelineState.cpp +++ b/qrenderdoc/Code/CommonPipelineState.cpp @@ -40,7 +40,7 @@ QString CommonPipelineState::GetImageLayout(ResourceId id) if(IsLogD3D12()) { - for(const D3D12PipelineState::ResourceData &r : m_D3D12->Resources) + for(const D3D12Pipe::ResourceData &r : m_D3D12->Resources) { if(r.id == id) return ToQStr(r.states[0].name); @@ -831,7 +831,7 @@ void CommonPipelineState::GetConstantBuffer(ShaderStage stage, uint32_t BufIdx, } else if(IsLogD3D12()) { - const D3D12PipelineState::Shader &s = GetD3D12Stage(stage); + const D3D12Pipe::Shader &s = GetD3D12Stage(stage); if(s.ShaderDetails != NULL && BufIdx < (uint32_t)s.ShaderDetails->ConstantBlocks.count) { @@ -846,8 +846,7 @@ void CommonPipelineState::GetConstantBuffer(ShaderStage stage, uint32_t BufIdx, return; } - const D3D12PipelineState::CBuffer &descriptor = - s.Spaces[bind.bindset].ConstantBuffers[bind.bind]; + const D3D12Pipe::CBuffer &descriptor = s.Spaces[bind.bindset].ConstantBuffers[bind.bind]; buf = descriptor.Buffer; ByteOffset = descriptor.Offset; @@ -941,13 +940,13 @@ QMap> CommonPipelineState::GetReadOnlyResou } else if(IsLogD3D12()) { - const D3D12PipelineState::Shader &s = GetD3D12Stage(stage); + const D3D12Pipe::Shader &s = GetD3D12Stage(stage); for(int space = 0; space < s.Spaces.count; space++) { for(int reg = 0; reg < s.Spaces[space].SRVs.count; reg++) { - const D3D12PipelineState::ResourceView &bind = s.Spaces[space].SRVs[reg]; + const D3D12Pipe::View &bind = s.Spaces[space].SRVs[reg]; BindpointMap key(space, reg); BoundResource val; @@ -1071,13 +1070,13 @@ QMap> CommonPipelineState::GetReadWriteReso } else if(IsLogD3D12()) { - const D3D12PipelineState::Shader &s = GetD3D12Stage(stage); + const D3D12Pipe::Shader &s = GetD3D12Stage(stage); for(int space = 0; space < s.Spaces.count; space++) { for(int reg = 0; reg < s.Spaces[space].UAVs.count; reg++) { - const D3D12PipelineState::ResourceView &bind = s.Spaces[space].UAVs[reg]; + const D3D12Pipe::View &bind = s.Spaces[space].UAVs[reg]; BindpointMap key(space, reg); BoundResource val; diff --git a/qrenderdoc/Code/CommonPipelineState.h b/qrenderdoc/Code/CommonPipelineState.h index a1e74f9ea..86e5c8575 100644 --- a/qrenderdoc/Code/CommonPipelineState.h +++ b/qrenderdoc/Code/CommonPipelineState.h @@ -81,7 +81,7 @@ class CommonPipelineState { public: CommonPipelineState() {} - void SetStates(APIProperties props, D3D11Pipe::State *d3d11, D3D12PipelineState *d3d12, + void SetStates(APIProperties props, D3D11Pipe::State *d3d11, D3D12Pipe::State *d3d12, GLPipe::State *gl, VKPipe::State *vk) { m_APIProps = props; @@ -172,7 +172,7 @@ public: private: D3D11Pipe::State *m_D3D11 = NULL; - D3D12PipelineState *m_D3D12 = NULL; + D3D12Pipe::State *m_D3D12 = NULL; GLPipe::State *m_GL = NULL; VKPipe::State *m_Vulkan = NULL; APIProperties m_APIProps; @@ -196,7 +196,7 @@ private: return m_D3D11->m_CS; } - const D3D12PipelineState::Shader &GetD3D12Stage(ShaderStage stage) + const D3D12Pipe::Shader &GetD3D12Stage(ShaderStage stage) { if(stage == ShaderStage::Vertex) return m_D3D12->m_VS; diff --git a/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp index dc18d84e6..491abbdd9 100644 --- a/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp @@ -87,14 +87,13 @@ struct ViewTag }; ViewTag() {} - ViewTag(ResType t, int s, int r, const D3D12PipelineState::ResourceView &rs) - : type(t), space(s), reg(r), res(rs) + ViewTag(ResType t, int s, int r, const D3D12Pipe::View &rs) : type(t), space(s), reg(r), res(rs) { } ResType type; int space, reg; - D3D12PipelineState::ResourceView res; + D3D12Pipe::View res; }; Q_DECLARE_METATYPE(ViewTag); @@ -421,8 +420,7 @@ void D3D12PipelineStateViewer::setEmptyRow(QTreeWidgetItem *node) node->setBackgroundColor(i, QColor(255, 70, 70)); } -bool D3D12PipelineStateViewer::HasImportantViewParams(const D3D12PipelineState::ResourceView &view, - FetchTexture *tex) +bool D3D12PipelineStateViewer::HasImportantViewParams(const D3D12Pipe::View &view, FetchTexture *tex) { // we don't count 'upgrade typeless to typed' as important, we just display the typed format // in the row since there's no real hidden important information there. The formats can't be @@ -442,8 +440,7 @@ bool D3D12PipelineStateViewer::HasImportantViewParams(const D3D12PipelineState:: return false; } -bool D3D12PipelineStateViewer::HasImportantViewParams(const D3D12PipelineState::ResourceView &view, - FetchBuffer *buf) +bool D3D12PipelineStateViewer::HasImportantViewParams(const D3D12Pipe::View &view, FetchBuffer *buf) { if(view.FirstElement > 0 || view.NumElements * view.ElementSize < buf->length) return true; @@ -459,11 +456,11 @@ void D3D12PipelineStateViewer::setViewDetails(QTreeWidgetItem *node, const ViewT QString text; - const D3D12PipelineState::ResourceView &res = view.res; + const D3D12Pipe::View &res = view.res; bool viewdetails = false; - for(const D3D12PipelineState::ResourceData &im : m_Ctx.CurD3D12PipelineState.Resources) + for(const D3D12Pipe::ResourceData &im : m_Ctx.CurD3D12PipelineState.Resources) { if(im.id == tex->ID) { @@ -540,9 +537,9 @@ void D3D12PipelineStateViewer::setViewDetails(QTreeWidgetItem *node, const ViewT QString text; - const D3D12PipelineState::ResourceView &res = view.res; + const D3D12Pipe::View &res = view.res; - for(const D3D12PipelineState::ResourceData &im : m_Ctx.CurD3D12PipelineState.Resources) + for(const D3D12Pipe::ResourceData &im : m_Ctx.CurD3D12PipelineState.Resources) { if(im.id == buf->ID) { @@ -580,14 +577,13 @@ void D3D12PipelineStateViewer::setViewDetails(QTreeWidgetItem *node, const ViewT } } -void D3D12PipelineStateViewer::addResourceRow(const ViewTag &view, - const D3D12PipelineState::Shader *stage, +void D3D12PipelineStateViewer::addResourceRow(const ViewTag &view, const D3D12Pipe::Shader *stage, RDTreeWidget *resources) { const QIcon &action = Icons::action(); const QIcon &action_hover = Icons::action_hover(); - const D3D12PipelineState::ResourceView &r = view.res; + const D3D12Pipe::View &r = view.res; bool uav = view.type == ViewTag::UAV; // consider this register to not exist - it's in a gap defined by sparse root signature elements @@ -775,7 +771,7 @@ bool D3D12PipelineStateViewer::showNode(bool usedSlot, bool filledSlot) return false; } -const D3D12PipelineState::Shader *D3D12PipelineStateViewer::stageForSender(QWidget *widget) +const D3D12Pipe::Shader *D3D12PipelineStateViewer::stageForSender(QWidget *widget) { if(!m_Ctx.LogLoaded()) return NULL; @@ -876,12 +872,12 @@ void D3D12PipelineStateViewer::clearState() ui->stencils->clear(); } -void D3D12PipelineStateViewer::setShaderState(const D3D12PipelineState::Shader &stage, QLabel *shader, +void D3D12PipelineStateViewer::setShaderState(const D3D12Pipe::Shader &stage, QLabel *shader, RDTreeWidget *resources, RDTreeWidget *samplers, RDTreeWidget *cbuffers, RDTreeWidget *uavs) { ShaderReflection *shaderDetails = stage.ShaderDetails; - const D3D12PipelineState &state = m_Ctx.CurD3D12PipelineState; + const D3D12Pipe::State &state = m_Ctx.CurD3D12PipelineState; if(stage.Object == ResourceId()) shader->setText(tr("Unbound Shader")); @@ -943,7 +939,7 @@ void D3D12PipelineStateViewer::setShaderState(const D3D12PipelineState::Shader & { for(int reg = 0; reg < stage.Spaces[space].Samplers.count; reg++) { - const D3D12PipelineState::Sampler &s = stage.Spaces[space].Samplers[reg]; + const D3D12Pipe::Sampler &s = stage.Spaces[space].Samplers[reg]; // consider this register to not exist - it's in a gap defined by sparse root signature // elements @@ -1059,7 +1055,7 @@ void D3D12PipelineStateViewer::setShaderState(const D3D12PipelineState::Shader & { for(int reg = 0; reg < stage.Spaces[space].ConstantBuffers.count; reg++) { - const D3D12PipelineState::CBuffer &b = stage.Spaces[space].ConstantBuffers[reg]; + const D3D12Pipe::CBuffer &b = stage.Spaces[space].ConstantBuffers[reg]; QVariant tag; @@ -1175,7 +1171,7 @@ void D3D12PipelineStateViewer::setState() return; } - const D3D12PipelineState &state = m_Ctx.CurD3D12PipelineState; + const D3D12Pipe::State &state = m_Ctx.CurD3D12PipelineState; const FetchDrawcall *draw = m_Ctx.CurDrawcall(); const QPixmap &tick = Pixmaps::tick(); @@ -1197,7 +1193,7 @@ void D3D12PipelineStateViewer::setState() ui->iaLayouts->clear(); { int i = 0; - for(const D3D12PipelineState::InputAssembler::LayoutInput &l : state.m_IA.layouts) + for(const D3D12Pipe::Layout &l : state.m_IA.layouts) { QString byteOffs = QString::number(l.ByteOffset); @@ -1351,7 +1347,7 @@ void D3D12PipelineStateViewer::setState() for(int i = 0; i < state.m_IA.vbuffers.count; i++) { - const D3D12PipelineState::InputAssembler::VertexBuffer &v = state.m_IA.vbuffers[i]; + const D3D12Pipe::VB &v = state.m_IA.vbuffers[i]; bool filledSlot = (v.Buffer != ResourceId()); bool usedSlot = (usedVBuffers[i]); @@ -1419,7 +1415,7 @@ void D3D12PipelineStateViewer::setState() ui->gsStreamOut->clear(); for(int i = 0; i < state.m_SO.Outputs.count; i++) { - const D3D12PipelineState::Streamout::Output &s = state.m_SO.Outputs[i]; + const D3D12Pipe::SOBind &s = state.m_SO.Outputs[i]; bool filledSlot = (s.Buffer != ResourceId()); bool usedSlot = (filledSlot); @@ -1473,7 +1469,7 @@ void D3D12PipelineStateViewer::setState() ui->viewports->clear(); for(int i = 0; i < state.m_RS.Viewports.count; i++) { - const D3D12PipelineState::Rasterizer::Viewport &v = state.m_RS.Viewports[i]; + const D3D12Pipe::Viewport &v = state.m_RS.Viewports[i]; QTreeWidgetItem *node = makeTreeNode({i, v.TopLeft[0], v.TopLeft[1], v.Width, v.Height, v.MinDepth, v.MaxDepth}); @@ -1492,7 +1488,7 @@ void D3D12PipelineStateViewer::setState() ui->scissors->clear(); for(int i = 0; i < state.m_RS.Scissors.count; i++) { - const D3D12PipelineState::Rasterizer::Scissor &s = state.m_RS.Scissors[i]; + const D3D12Pipe::Scissor &s = state.m_RS.Scissors[i]; QTreeWidgetItem *node = makeTreeNode({i, s.left, s.top, s.right - s.left, s.bottom - s.top}); @@ -1548,8 +1544,7 @@ void D3D12PipelineStateViewer::setState() ui->blends->clear(); { int i = 0; - for(const D3D12PipelineState::OutputMerger::BlendState::RTBlend &blend : - state.m_OM.m_BlendState.Blends) + for(const D3D12Pipe::Blend &blend : state.m_OM.m_BlendState.Blends) { bool filledSlot = (blend.Enabled || targets[i]); bool usedSlot = (targets[i]); @@ -1680,7 +1675,7 @@ QString D3D12PipelineStateViewer::formatMembers(int indent, const QString &namep void D3D12PipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int column) { - const D3D12PipelineState::Shader *stage = stageForSender(item->treeWidget()); + const D3D12Pipe::Shader *stage = stageForSender(item->treeWidget()); if(stage == NULL) return; @@ -1906,7 +1901,7 @@ void D3D12PipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int void D3D12PipelineStateViewer::cbuffer_itemActivated(QTreeWidgetItem *item, int column) { - const D3D12PipelineState::Shader *stage = stageForSender(item->treeWidget()); + const D3D12Pipe::Shader *stage = stageForSender(item->treeWidget()); if(stage == NULL) return; @@ -1923,7 +1918,7 @@ void D3D12PipelineStateViewer::cbuffer_itemActivated(QTreeWidgetItem *item, int // unused cbuffer, open regular buffer viewer BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx.mainWindow()); - const D3D12PipelineState::CBuffer &buf = stage->Spaces[cb.space].ConstantBuffers[cb.reg]; + const D3D12Pipe::CBuffer &buf = stage->Spaces[cb.space].ConstantBuffers[cb.reg]; viewer->ViewBuffer(buf.Offset, buf.ByteSize, buf.Buffer); @@ -1988,7 +1983,7 @@ void D3D12PipelineStateViewer::highlightIABind(int slot) { int idx = ((slot + 1) * 21) % 32; // space neighbouring colours reasonably distinctly - const D3D12PipelineState::InputAssembler &IA = m_Ctx.CurD3D12PipelineState.m_IA; + const D3D12Pipe::IA &IA = m_Ctx.CurD3D12PipelineState.m_IA; QColor col = QColor::fromHslF(float(idx) / 32.0f, 1.0f, 0.95f); @@ -2045,7 +2040,7 @@ void D3D12PipelineStateViewer::on_iaLayouts_mouseMove(QMouseEvent *e) vertex_leave(NULL); - const D3D12PipelineState::InputAssembler &IA = m_Ctx.CurD3D12PipelineState.m_IA; + const D3D12Pipe::IA &IA = m_Ctx.CurD3D12PipelineState.m_IA; if(idx.isValid()) { @@ -2148,7 +2143,7 @@ void D3D12PipelineStateViewer::on_pipeFlow_stageSelected(int index) void D3D12PipelineStateViewer::shaderView_clicked() { QWidget *sender = qobject_cast(QObject::sender()); - const D3D12PipelineState::Shader *stage = stageForSender(sender); + const D3D12Pipe::Shader *stage = stageForSender(sender); if(stage == NULL || stage->Object == ResourceId()) return; @@ -2167,7 +2162,7 @@ void D3D12PipelineStateViewer::shaderView_clicked() void D3D12PipelineStateViewer::shaderEdit_clicked() { QWidget *sender = qobject_cast(QObject::sender()); - const D3D12PipelineState::Shader *stage = stageForSender(sender); + const D3D12Pipe::Shader *stage = stageForSender(sender); if(!stage || stage->Object == ResourceId()) return; @@ -2202,8 +2197,7 @@ void D3D12PipelineStateViewer::shaderEdit_clicked() void D3D12PipelineStateViewer::shaderSave_clicked() { - const D3D12PipelineState::Shader *stage = - stageForSender(qobject_cast(QObject::sender())); + const D3D12Pipe::Shader *stage = stageForSender(qobject_cast(QObject::sender())); if(stage == NULL) return; diff --git a/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.h b/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.h index ffcf17ad3..1fb23129d 100644 --- a/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.h +++ b/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.h @@ -76,11 +76,10 @@ private: CaptureContext &m_Ctx; PipelineStateViewer &m_Common; - void setShaderState(const D3D12PipelineState::Shader &stage, QLabel *shader, RDTreeWidget *tex, + void setShaderState(const D3D12Pipe::Shader &stage, QLabel *shader, RDTreeWidget *tex, RDTreeWidget *samp, RDTreeWidget *cbuffer, RDTreeWidget *uavs); - void addResourceRow(const ViewTag &view, const D3D12PipelineState::Shader *stage, - RDTreeWidget *resources); + void addResourceRow(const ViewTag &view, const D3D12Pipe::Shader *stage, RDTreeWidget *resources); void clearShaderState(QLabel *shader, RDTreeWidget *tex, RDTreeWidget *samp, RDTreeWidget *cbuffer, RDTreeWidget *uavs); @@ -93,10 +92,10 @@ private: QString formatMembers(int indent, const QString &nameprefix, const rdctype::array &vars); - const D3D12PipelineState::Shader *stageForSender(QWidget *widget); + const D3D12Pipe::Shader *stageForSender(QWidget *widget); - bool HasImportantViewParams(const D3D12PipelineState::ResourceView &view, FetchTexture *tex); - bool HasImportantViewParams(const D3D12PipelineState::ResourceView &view, FetchBuffer *buf); + bool HasImportantViewParams(const D3D12Pipe::View &view, FetchTexture *tex); + bool HasImportantViewParams(const D3D12Pipe::View &view, FetchBuffer *buf); void setViewDetails(QTreeWidgetItem *node, const ViewTag &view, FetchTexture *tex); void setViewDetails(QTreeWidgetItem *node, const ViewTag &view, FetchBuffer *buf); diff --git a/renderdoc/api/replay/d3d12_pipestate.h b/renderdoc/api/replay/d3d12_pipestate.h index f340982c1..712b23986 100644 --- a/renderdoc/api/replay/d3d12_pipestate.h +++ b/renderdoc/api/replay/d3d12_pipestate.h @@ -26,346 +26,376 @@ #include "shader_types.h" -struct D3D12PipelineState +namespace D3D12Pipe { - D3D12PipelineState() : customName(false) {} +struct Layout +{ + Layout() + : SemanticIndex(0), InputSlot(0), ByteOffset(0), PerInstance(false), InstanceDataStepRate(0) + { + } + rdctype::str SemanticName; + uint32_t SemanticIndex; + ResourceFormat Format; + uint32_t InputSlot; + uint32_t ByteOffset; + bool32 PerInstance; + uint32_t InstanceDataStepRate; +}; + +struct VB +{ + VB() : Buffer(), Offset(0), Stride(0) {} + ResourceId Buffer; + uint64_t Offset; + uint32_t Size; + uint32_t Stride; +}; + +struct IB +{ + IB() : Buffer(), Offset(0) {} + ResourceId Buffer; + uint64_t Offset; + uint32_t Size; +}; + +struct IA +{ + IA() : indexStripCutValue(0) {} + rdctype::array layouts; + + rdctype::array vbuffers; + + IB ibuffer; + + uint32_t indexStripCutValue; +}; + +// 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 View +{ + View() + : Immediate(0), + RootElement(~0U), + TableIndex(~0U), + Resource(), + Format(), + BufferFlags(D3DBufferViewFlags::NoFlags), + BufferStructCount(0), + ElementSize(0), + FirstElement(0), + NumElements(1), + CounterByteOffset(0), + HighestMip(0), + NumMipLevels(1), + ArraySize(1), + FirstArraySlice(0), + MinLODClamp(0.0f) + { + swizzle[0] = TextureSwizzle::Red; + swizzle[1] = TextureSwizzle::Green; + swizzle[2] = TextureSwizzle::Blue; + swizzle[3] = TextureSwizzle::Alpha; + } + + // parameters from descriptor + bool32 Immediate; + uint32_t RootElement; + uint32_t TableIndex; + + // parameters from resource/view + ResourceId Resource; + rdctype::str Type; + ResourceFormat Format; + + TextureSwizzle swizzle[4]; + D3DBufferViewFlags BufferFlags; + uint32_t BufferStructCount; + uint32_t ElementSize; + uint64_t FirstElement; + uint32_t NumElements; + + ResourceId CounterResource; + uint64_t CounterByteOffset; + + // Texture + uint32_t HighestMip; + uint32_t NumMipLevels; + + // Texture Array + uint32_t ArraySize; + uint32_t FirstArraySlice; + + float MinLODClamp; +}; + +struct Sampler +{ + Sampler() + : Immediate(0), + RootElement(~0U), + TableIndex(~0U), + UseBorder(false), + UseComparison(false), + MaxAniso(0), + MaxLOD(0.0f), + MinLOD(0.0f), + MipLODBias(0.0f) + { + BorderColor[0] = BorderColor[1] = BorderColor[2] = BorderColor[3] = 0.0f; + } + + // parameters from descriptor + bool32 Immediate; + uint32_t RootElement; + uint32_t TableIndex; + + // parameters from resource/view + rdctype::str AddressU, AddressV, AddressW; + float BorderColor[4]; + rdctype::str Comparison; + rdctype::str Filter; + bool32 UseBorder; + bool32 UseComparison; + uint32_t MaxAniso; + float MaxLOD; + float MinLOD; + float MipLODBias; +}; + +struct CBuffer +{ + CBuffer() : Immediate(0), RootElement(~0U), TableIndex(~0U), Buffer(), Offset(0), ByteSize(0) {} + // parameters from descriptor + bool32 Immediate; + uint32_t RootElement; + uint32_t TableIndex; + + // parameters from resource/view + ResourceId Buffer; + uint64_t Offset; + uint32_t ByteSize; + + rdctype::array RootValues; +}; + +struct RegisterSpace +{ + rdctype::array ConstantBuffers; + rdctype::array Samplers; + rdctype::array SRVs; + rdctype::array UAVs; +}; + +struct Shader +{ + Shader() : ShaderDetails(NULL), stage(ShaderStage::Vertex) {} + ResourceId Object; + ShaderReflection *ShaderDetails; + ShaderBindpointMapping BindpointMapping; + + ShaderStage stage; + + rdctype::array Spaces; +}; + +struct SOBind +{ + SOBind() : Buffer(), Offset(0), Size(0), WrittenCountBuffer(), WrittenCountOffset(0) {} + ResourceId Buffer; + uint64_t Offset; + uint64_t Size; + + ResourceId WrittenCountBuffer; + uint64_t WrittenCountOffset; +}; + +struct Streamout +{ + rdctype::array Outputs; +}; + +struct Viewport +{ + Viewport() : Width(0.0f), Height(0.0f), MinDepth(0.0f), MaxDepth(0.0f) + { + TopLeft[0] = 0.0f; + TopLeft[1] = 0.0f; + } + Viewport(float TX, float TY, float W, float H, float MN, float MX) + : Width(W), Height(H), MinDepth(MN), MaxDepth(MX) + { + TopLeft[0] = TX; + TopLeft[1] = TY; + } + float TopLeft[2]; + float Width, Height; + float MinDepth, MaxDepth; +}; + +struct Scissor +{ + Scissor() : left(0), top(0), right(0), bottom(0) {} + Scissor(int l, int t, int r, int b) : left(l), top(t), right(r), bottom(b) {} + int32_t left, top, right, bottom; +}; + +struct RasterizerState +{ + RasterizerState() + : fillMode(FillMode::Solid), + cullMode(CullMode::NoCull), + FrontCCW(false), + DepthBias(0), + DepthBiasClamp(0.0f), + SlopeScaledDepthBias(0.0f), + DepthClip(false), + MultisampleEnable(false), + AntialiasedLineEnable(false), + ForcedSampleCount(0), + ConservativeRasterization(false) + { + } + FillMode fillMode; + CullMode cullMode; + bool32 FrontCCW; + int32_t DepthBias; + float DepthBiasClamp; + float SlopeScaledDepthBias; + bool32 DepthClip; + bool32 MultisampleEnable; + bool32 AntialiasedLineEnable; + uint32_t ForcedSampleCount; + bool32 ConservativeRasterization; +}; + +struct Rasterizer +{ + Rasterizer() : SampleMask(~0U) {} + uint32_t SampleMask; + + rdctype::array Viewports; + + rdctype::array Scissors; + + RasterizerState m_State; +}; + +struct StencilOp +{ + rdctype::str FailOp; + rdctype::str DepthFailOp; + rdctype::str PassOp; + rdctype::str Func; +}; + +struct DepthStencilState +{ + DepthStencilState() + : DepthEnable(false), + DepthWrites(false), + StencilEnable(false), + StencilReadMask(0), + StencilWriteMask(0), + StencilRef(0) + { + } + bool32 DepthEnable; + bool32 DepthWrites; + rdctype::str DepthFunc; + bool32 StencilEnable; + byte StencilReadMask; + byte StencilWriteMask; + + StencilOp m_FrontFace, m_BackFace; + + uint32_t StencilRef; +}; + +struct BlendOp +{ + rdctype::str Source; + rdctype::str Destination; + rdctype::str Operation; +}; + +struct Blend +{ + Blend() : Enabled(false), LogicEnabled(false), WriteMask(0) {} + BlendOp m_Blend, m_AlphaBlend; + + rdctype::str LogicOp; + + bool32 Enabled; + bool32 LogicEnabled; + byte WriteMask; +}; + +struct BlendState +{ + BlendState() : AlphaToCoverage(false), IndependentBlend(false) + { + BlendFactor[0] = BlendFactor[1] = BlendFactor[2] = BlendFactor[3] = 0.0f; + } + + bool32 AlphaToCoverage; + bool32 IndependentBlend; + rdctype::array Blends; + + float BlendFactor[4]; +}; + +struct OM +{ + OM() : DepthReadOnly(false), StencilReadOnly(false), multiSampleCount(1), multiSampleQuality(0) {} + DepthStencilState m_State; + BlendState m_BlendState; + + rdctype::array RenderTargets; + + View DepthTarget; + bool32 DepthReadOnly; + bool32 StencilReadOnly; + + uint32_t multiSampleCount; + uint32_t multiSampleQuality; +}; + +struct ResourceState +{ + rdctype::str name; +}; + +struct ResourceData +{ + ResourceId id; + + rdctype::array states; +}; + +struct State +{ + State() : customName(false) {} ResourceId pipeline; bool32 customName; rdctype::str PipelineName; ResourceId rootSig; - struct InputAssembler - { - InputAssembler() : indexStripCutValue(0) {} - struct LayoutInput - { - LayoutInput() - : SemanticIndex(0), InputSlot(0), ByteOffset(0), PerInstance(false), InstanceDataStepRate(0) - { - } - rdctype::str SemanticName; - uint32_t SemanticIndex; - ResourceFormat Format; - uint32_t InputSlot; - uint32_t ByteOffset; - bool32 PerInstance; - uint32_t InstanceDataStepRate; - }; - rdctype::array layouts; + IA m_IA; - struct VertexBuffer - { - VertexBuffer() : Buffer(), Offset(0), Stride(0) {} - ResourceId Buffer; - uint64_t Offset; - uint32_t Size; - uint32_t Stride; - }; - rdctype::array vbuffers; + Shader m_VS, m_HS, m_DS, m_GS, m_PS, m_CS; - struct IndexBuffer - { - IndexBuffer() : Buffer(), Offset(0) {} - ResourceId Buffer; - uint64_t Offset; - uint32_t Size; - } ibuffer; + Streamout m_SO; - uint32_t indexStripCutValue; - } m_IA; + Rasterizer m_RS; - // 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. + OM m_OM; - struct ResourceView - { - ResourceView() - : Immediate(0), - RootElement(~0U), - TableIndex(~0U), - Resource(), - Format(), - BufferFlags(D3DBufferViewFlags::NoFlags), - BufferStructCount(0), - ElementSize(0), - FirstElement(0), - NumElements(1), - CounterByteOffset(0), - HighestMip(0), - NumMipLevels(1), - ArraySize(1), - FirstArraySlice(0), - MinLODClamp(0.0f) - { - swizzle[0] = TextureSwizzle::Red; - swizzle[1] = TextureSwizzle::Green; - swizzle[2] = TextureSwizzle::Blue; - swizzle[3] = TextureSwizzle::Alpha; - } - - // parameters from descriptor - bool32 Immediate; - uint32_t RootElement; - uint32_t TableIndex; - - // parameters from resource/view - ResourceId Resource; - rdctype::str Type; - ResourceFormat Format; - - TextureSwizzle swizzle[4]; - D3DBufferViewFlags BufferFlags; - uint32_t BufferStructCount; - uint32_t ElementSize; - uint64_t FirstElement; - uint32_t NumElements; - - ResourceId CounterResource; - uint64_t CounterByteOffset; - - // Texture - uint32_t HighestMip; - uint32_t NumMipLevels; - - // Texture Array - uint32_t ArraySize; - uint32_t FirstArraySlice; - - float MinLODClamp; - }; - - struct Sampler - { - Sampler() - : Immediate(0), - RootElement(~0U), - TableIndex(~0U), - UseBorder(false), - UseComparison(false), - MaxAniso(0), - MaxLOD(0.0f), - MinLOD(0.0f), - MipLODBias(0.0f) - { - BorderColor[0] = BorderColor[1] = BorderColor[2] = BorderColor[3] = 0.0f; - } - - // parameters from descriptor - bool32 Immediate; - uint32_t RootElement; - uint32_t TableIndex; - - // parameters from resource/view - rdctype::str AddressU, AddressV, AddressW; - float BorderColor[4]; - rdctype::str Comparison; - rdctype::str Filter; - bool32 UseBorder; - bool32 UseComparison; - uint32_t MaxAniso; - float MaxLOD; - float MinLOD; - float MipLODBias; - }; - - struct CBuffer - { - CBuffer() : Immediate(0), RootElement(~0U), TableIndex(~0U), Buffer(), Offset(0), ByteSize(0) {} - // parameters from descriptor - bool32 Immediate; - uint32_t RootElement; - uint32_t TableIndex; - - // parameters from resource/view - ResourceId Buffer; - uint64_t Offset; - uint32_t ByteSize; - - rdctype::array RootValues; - }; - - struct Shader - { - Shader() : ShaderDetails(NULL), stage(ShaderStage::Vertex) {} - ResourceId Object; - ShaderReflection *ShaderDetails; - ShaderBindpointMapping BindpointMapping; - - ShaderStage stage; - - struct RegisterSpace - { - rdctype::array ConstantBuffers; - rdctype::array Samplers; - rdctype::array SRVs; - rdctype::array UAVs; - }; - rdctype::array Spaces; - } m_VS, m_HS, m_DS, m_GS, m_PS, m_CS; - - struct Streamout - { - struct Output - { - Output() : Buffer(), Offset(0), Size(0), WrittenCountBuffer(), WrittenCountOffset(0) {} - ResourceId Buffer; - uint64_t Offset; - uint64_t Size; - - ResourceId WrittenCountBuffer; - uint64_t WrittenCountOffset; - }; - rdctype::array Outputs; - } m_SO; - - struct Rasterizer - { - Rasterizer() : SampleMask(~0U) {} - uint32_t SampleMask; - - struct Viewport - { - Viewport() : Width(0.0f), Height(0.0f), MinDepth(0.0f), MaxDepth(0.0f) - { - TopLeft[0] = 0.0f; - TopLeft[1] = 0.0f; - } - Viewport(float TX, float TY, float W, float H, float MN, float MX) - : Width(W), Height(H), MinDepth(MN), MaxDepth(MX) - { - TopLeft[0] = TX; - TopLeft[1] = TY; - } - float TopLeft[2]; - float Width, Height; - float MinDepth, MaxDepth; - }; - rdctype::array Viewports; - - struct Scissor - { - Scissor() : left(0), top(0), right(0), bottom(0) {} - Scissor(int l, int t, int r, int b) : left(l), top(t), right(r), bottom(b) {} - int32_t left, top, right, bottom; - }; - rdctype::array Scissors; - - struct RasterizerState - { - RasterizerState() - : fillMode(FillMode::Solid), - cullMode(CullMode::NoCull), - FrontCCW(false), - DepthBias(0), - DepthBiasClamp(0.0f), - SlopeScaledDepthBias(0.0f), - DepthClip(false), - MultisampleEnable(false), - AntialiasedLineEnable(false), - ForcedSampleCount(0), - ConservativeRasterization(false) - { - } - FillMode fillMode; - CullMode cullMode; - bool32 FrontCCW; - int32_t DepthBias; - float DepthBiasClamp; - float SlopeScaledDepthBias; - bool32 DepthClip; - bool32 MultisampleEnable; - bool32 AntialiasedLineEnable; - uint32_t ForcedSampleCount; - bool32 ConservativeRasterization; - } m_State; - } m_RS; - - struct OutputMerger - { - OutputMerger() - : DepthReadOnly(false), StencilReadOnly(false), multiSampleCount(1), multiSampleQuality(0) - { - } - struct DepthStencilState - { - DepthStencilState() - : DepthEnable(false), - DepthWrites(false), - StencilEnable(false), - StencilReadMask(0), - StencilWriteMask(0), - StencilRef(0) - { - } - bool32 DepthEnable; - bool32 DepthWrites; - rdctype::str DepthFunc; - bool32 StencilEnable; - byte StencilReadMask; - byte StencilWriteMask; - - struct StencilOp - { - rdctype::str FailOp; - rdctype::str DepthFailOp; - rdctype::str PassOp; - rdctype::str Func; - } m_FrontFace, m_BackFace; - - uint32_t StencilRef; - } m_State; - - struct BlendState - { - BlendState() : AlphaToCoverage(false), IndependentBlend(false) - { - BlendFactor[0] = BlendFactor[1] = BlendFactor[2] = BlendFactor[3] = 0.0f; - } - - bool32 AlphaToCoverage; - bool32 IndependentBlend; - - struct RTBlend - { - RTBlend() : Enabled(false), LogicEnabled(false), WriteMask(0) {} - struct BlendOp - { - rdctype::str Source; - rdctype::str Destination; - rdctype::str Operation; - } m_Blend, m_AlphaBlend; - - rdctype::str LogicOp; - - bool32 Enabled; - bool32 LogicEnabled; - byte WriteMask; - }; - rdctype::array Blends; - - float BlendFactor[4]; - } m_BlendState; - - rdctype::array RenderTargets; - - ResourceView DepthTarget; - bool32 DepthReadOnly; - bool32 StencilReadOnly; - - uint32_t multiSampleCount; - uint32_t multiSampleQuality; - } m_OM; - - struct ResourceData - { - ResourceId id; - - struct ResourceState - { - rdctype::str name; - }; - rdctype::array states; - }; rdctype::array Resources; }; + +}; // namespace D3D12Pipe diff --git a/renderdoc/api/replay/renderdoc_replay.h b/renderdoc/api/replay/renderdoc_replay.h index fb7490a2f..869ccba56 100644 --- a/renderdoc/api/replay/renderdoc_replay.h +++ b/renderdoc/api/replay/renderdoc_replay.h @@ -223,7 +223,7 @@ struct IReplayRenderer virtual bool SetFrameEvent(uint32_t eventID, bool force) = 0; virtual bool GetD3D11PipelineState(D3D11Pipe::State *state) = 0; - virtual bool GetD3D12PipelineState(D3D12PipelineState *state) = 0; + virtual bool GetD3D12PipelineState(D3D12Pipe::State *state) = 0; virtual bool GetGLPipelineState(GLPipe::State *state) = 0; virtual bool GetVulkanPipelineState(VKPipe::State *state) = 0; @@ -300,7 +300,7 @@ extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_SetFrameEvent(IRepla extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_GetD3D11PipelineState(IReplayRenderer *rend, D3D11Pipe::State *state); extern "C" RENDERDOC_API bool32 RENDERDOC_CC -ReplayRenderer_GetD3D12PipelineState(IReplayRenderer *rend, D3D12PipelineState *state); +ReplayRenderer_GetD3D12PipelineState(IReplayRenderer *rend, D3D12Pipe::State *state); extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_GetGLPipelineState(IReplayRenderer *rend, GLPipe::State *state); extern "C" RENDERDOC_API bool32 RENDERDOC_CC diff --git a/renderdoc/core/image_viewer.cpp b/renderdoc/core/image_viewer.cpp index b6395a54a..185e3d9ac 100644 --- a/renderdoc/core/image_viewer.cpp +++ b/renderdoc/core/image_viewer.cpp @@ -162,7 +162,7 @@ public: return ret; } void SavePipelineState() {} - D3D12PipelineState GetD3D12PipelineState() { return D3D12PipelineState(); } + D3D12Pipe::State GetD3D12PipelineState() { return D3D12Pipe::State(); } GLPipe::State GetGLPipelineState() { return GLPipe::State(); } VKPipe::State GetVulkanPipelineState() { return VKPipe::State(); } void ReplayLog(uint32_t endEventID, ReplayLogType replayType) {} diff --git a/renderdoc/core/replay_proxy.cpp b/renderdoc/core/replay_proxy.cpp index d1f868912..9c50fdf02 100644 --- a/renderdoc/core/replay_proxy.cpp +++ b/renderdoc/core/replay_proxy.cpp @@ -496,7 +496,7 @@ void Serialiser::Serialise(const char *name, D3D11Pipe::State &el) #pragma region D3D12 pipeline state template <> -void Serialiser::Serialise(const char *name, D3D12PipelineState::InputAssembler::LayoutInput &el) +void Serialiser::Serialise(const char *name, D3D12Pipe::Layout &el) { Serialise("", el.SemanticName); Serialise("", el.SemanticIndex); @@ -510,7 +510,7 @@ void Serialiser::Serialise(const char *name, D3D12PipelineState::InputAssembler: } template <> -void Serialiser::Serialise(const char *name, D3D12PipelineState::InputAssembler &el) +void Serialiser::Serialise(const char *name, D3D12Pipe::IA &el) { Serialise("", el.ibuffer.Buffer); Serialise("", el.ibuffer.Offset); @@ -525,7 +525,7 @@ void Serialiser::Serialise(const char *name, D3D12PipelineState::InputAssembler } template <> -void Serialiser::Serialise(const char *name, D3D12PipelineState::CBuffer &el) +void Serialiser::Serialise(const char *name, D3D12Pipe::CBuffer &el) { Serialise("", el.Immediate); Serialise("", el.RootElement); @@ -539,7 +539,7 @@ void Serialiser::Serialise(const char *name, D3D12PipelineState::CBuffer &el) } template <> -void Serialiser::Serialise(const char *name, D3D12PipelineState::Sampler &el) +void Serialiser::Serialise(const char *name, D3D12Pipe::Sampler &el) { Serialise("", el.Immediate); Serialise("", el.RootElement); @@ -561,7 +561,7 @@ void Serialiser::Serialise(const char *name, D3D12PipelineState::Sampler &el) } template <> -void Serialiser::Serialise(const char *name, D3D12PipelineState::ResourceView &el) +void Serialiser::Serialise(const char *name, D3D12Pipe::View &el) { Serialise("", el.Immediate); Serialise("", el.RootElement); @@ -592,7 +592,7 @@ void Serialiser::Serialise(const char *name, D3D12PipelineState::ResourceView &e } template <> -void Serialiser::Serialise(const char *name, D3D12PipelineState::Shader::RegisterSpace &el) +void Serialiser::Serialise(const char *name, D3D12Pipe::RegisterSpace &el) { Serialise("", el.ConstantBuffers); Serialise("", el.Samplers); @@ -603,7 +603,7 @@ void Serialiser::Serialise(const char *name, D3D12PipelineState::Shader::Registe } template <> -void Serialiser::Serialise(const char *name, D3D12PipelineState::Shader &el) +void Serialiser::Serialise(const char *name, D3D12Pipe::Shader &el) { Serialise("", el.Object); Serialise("", el.BindpointMapping); @@ -614,7 +614,7 @@ void Serialiser::Serialise(const char *name, D3D12PipelineState::Shader &el) } template <> -void Serialiser::Serialise(const char *name, D3D12PipelineState::Rasterizer &el) +void Serialiser::Serialise(const char *name, D3D12Pipe::Rasterizer &el) { Serialise("", el.SampleMask); Serialise("", el.Scissors); @@ -625,7 +625,7 @@ void Serialiser::Serialise(const char *name, D3D12PipelineState::Rasterizer &el) } template <> -void Serialiser::Serialise(const char *name, D3D12PipelineState::OutputMerger::BlendState::RTBlend &el) +void Serialiser::Serialise(const char *name, D3D12Pipe::Blend &el) { Serialise("", el.m_Blend.Source); Serialise("", el.m_Blend.Destination); @@ -645,7 +645,7 @@ void Serialiser::Serialise(const char *name, D3D12PipelineState::OutputMerger::B } template <> -void Serialiser::Serialise(const char *name, D3D12PipelineState::OutputMerger &el) +void Serialiser::Serialise(const char *name, D3D12Pipe::OM &el) { { Serialise("", el.m_State.DepthEnable); @@ -687,7 +687,7 @@ void Serialiser::Serialise(const char *name, D3D12PipelineState::OutputMerger &e } template <> -void Serialiser::Serialise(const char *name, D3D12PipelineState::ResourceData::ResourceState &el) +void Serialiser::Serialise(const char *name, D3D12Pipe::ResourceState &el) { Serialise("", el.name); @@ -695,7 +695,7 @@ void Serialiser::Serialise(const char *name, D3D12PipelineState::ResourceData::R } template <> -void Serialiser::Serialise(const char *name, D3D12PipelineState::ResourceData &el) +void Serialiser::Serialise(const char *name, D3D12Pipe::ResourceData &el) { Serialise("", el.id); Serialise("", el.states); @@ -704,7 +704,7 @@ void Serialiser::Serialise(const char *name, D3D12PipelineState::ResourceData &e } template <> -void Serialiser::Serialise(const char *name, D3D12PipelineState &el) +void Serialiser::Serialise(const char *name, D3D12Pipe::State &el) { Serialise("", el.pipeline); Serialise("", el.customName); @@ -1804,32 +1804,27 @@ string ToStrHelper::Get(const D3D11Pipe::SOBind &el) return "<...>"; } template <> -string ToStrHelper::Get( - const D3D12PipelineState::InputAssembler::VertexBuffer &el) +string ToStrHelper::Get(const D3D12Pipe::VB &el) { return "<...>"; } template <> -string ToStrHelper::Get( - const D3D12PipelineState::Streamout::Output &el) +string ToStrHelper::Get(const D3D12Pipe::SOBind &el) { return "<...>"; } template <> -string ToStrHelper::Get( - const D3D12PipelineState::Rasterizer::Scissor &el) +string ToStrHelper::Get(const D3D12Pipe::Scissor &el) { return "<...>"; } template <> -string ToStrHelper::Get( - const D3D12PipelineState::Rasterizer::Viewport &el) +string ToStrHelper::Get(const D3D12Pipe::Viewport &el) { return "<...>"; } template <> -string ToStrHelper::Get( - const D3D12PipelineState::Rasterizer::RasterizerState &el) +string ToStrHelper::Get(const D3D12Pipe::RasterizerState &el) { return "<...>"; } @@ -2376,7 +2371,7 @@ void ReplayProxy::SavePipelineState() return; m_D3D11PipelineState = D3D11Pipe::State(); - m_D3D12PipelineState = D3D12PipelineState(); + m_D3D12PipelineState = D3D12Pipe::State(); m_GLPipelineState = GLPipe::State(); m_VulkanPipelineState = VKPipe::State(); } diff --git a/renderdoc/core/replay_proxy.h b/renderdoc/core/replay_proxy.h index 52fbc7ee1..2b3ca520f 100644 --- a/renderdoc/core/replay_proxy.h +++ b/renderdoc/core/replay_proxy.h @@ -398,7 +398,7 @@ public: void SavePipelineState(); D3D11Pipe::State GetD3D11PipelineState() { return m_D3D11PipelineState; } - D3D12PipelineState GetD3D12PipelineState() { return m_D3D12PipelineState; } + D3D12Pipe::State GetD3D12PipelineState() { return m_D3D12PipelineState; } GLPipe::State GetGLPipelineState() { return m_GLPipelineState; } VKPipe::State GetVulkanPipelineState() { return m_VulkanPipelineState; } void ReplayLog(uint32_t endEventID, ReplayLogType replayType); @@ -552,7 +552,7 @@ private: APIProperties m_APIProps; D3D11Pipe::State m_D3D11PipelineState; - D3D12PipelineState m_D3D12PipelineState; + D3D12Pipe::State m_D3D12PipelineState; GLPipe::State m_GLPipelineState; VKPipe::State m_VulkanPipelineState; }; diff --git a/renderdoc/driver/d3d11/d3d11_replay.h b/renderdoc/driver/d3d11/d3d11_replay.h index 70f77a551..a3cc5a01c 100644 --- a/renderdoc/driver/d3d11/d3d11_replay.h +++ b/renderdoc/driver/d3d11/d3d11_replay.h @@ -64,7 +64,7 @@ public: void SavePipelineState() { m_CurPipelineState = MakePipelineState(); } D3D11Pipe::State GetD3D11PipelineState() { return m_CurPipelineState; } - D3D12PipelineState GetD3D12PipelineState() { return D3D12PipelineState(); } + D3D12Pipe::State GetD3D12PipelineState() { return D3D12Pipe::State(); } GLPipe::State GetGLPipelineState() { return GLPipe::State(); } VKPipe::State GetVulkanPipelineState() { return VKPipe::State(); } void FreeTargetResource(ResourceId id); diff --git a/renderdoc/driver/d3d12/d3d12_replay.cpp b/renderdoc/driver/d3d12/d3d12_replay.cpp index 2e791acf7..eadb8c256 100644 --- a/renderdoc/driver/d3d12/d3d12_replay.cpp +++ b/renderdoc/driver/d3d12/d3d12_replay.cpp @@ -290,7 +290,7 @@ vector D3D12Replay::GetUsage(ResourceId id) return m_pDevice->GetQueue()->GetUsage(id); } -void D3D12Replay::FillResourceView(D3D12PipelineState::ResourceView &view, D3D12Descriptor *desc) +void D3D12Replay::FillResourceView(D3D12Pipe::View &view, D3D12Descriptor *desc) { D3D12ResourceManager *rm = m_pDevice->GetResourceManager(); @@ -524,7 +524,7 @@ void D3D12Replay::FillResourceView(D3D12PipelineState::ResourceView &view, D3D12 } void D3D12Replay::FillRegisterSpaces(const D3D12RenderState::RootSignature &rootSig, - rdctype::array &dstSpaces, + rdctype::array &dstSpaces, D3D12_SHADER_VISIBILITY visibility) { D3D12ResourceManager *rm = m_pDevice->GetResourceManager(); @@ -534,10 +534,10 @@ void D3D12Replay::FillRegisterSpaces(const D3D12RenderState::RootSignature &root struct Space { - vector cbuffers; - vector samplers; - vector srvs; - vector uavs; + vector cbuffers; + vector samplers; + vector srvs; + vector uavs; }; Space *spaces = new Space[sig->sig.numSpaces]; @@ -552,7 +552,7 @@ void D3D12Replay::FillRegisterSpaces(const D3D12RenderState::RootSignature &root if(p.ParameterType == D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS) { - D3D12PipelineState::CBuffer &cb = + D3D12Pipe::CBuffer &cb = resize_and_add(spaces[p.Constants.RegisterSpace].cbuffers, p.Constants.ShaderRegister); cb.Immediate = true; cb.RootElement = (uint32_t)rootEl; @@ -571,7 +571,7 @@ void D3D12Replay::FillRegisterSpaces(const D3D12RenderState::RootSignature &root } else if(p.ParameterType == D3D12_ROOT_PARAMETER_TYPE_CBV) { - D3D12PipelineState::CBuffer &cb = + D3D12Pipe::CBuffer &cb = resize_and_add(spaces[p.Descriptor.RegisterSpace].cbuffers, p.Descriptor.ShaderRegister); cb.Immediate = true; cb.RootElement = (uint32_t)rootEl; @@ -591,7 +591,7 @@ void D3D12Replay::FillRegisterSpaces(const D3D12RenderState::RootSignature &root } else if(p.ParameterType == D3D12_ROOT_PARAMETER_TYPE_SRV) { - D3D12PipelineState::ResourceView &view = + D3D12Pipe::View &view = resize_and_add(spaces[p.Descriptor.RegisterSpace].srvs, p.Descriptor.ShaderRegister); view.Immediate = true; view.RootElement = (uint32_t)rootEl; @@ -616,7 +616,7 @@ void D3D12Replay::FillRegisterSpaces(const D3D12RenderState::RootSignature &root } else if(p.ParameterType == D3D12_ROOT_PARAMETER_TYPE_UAV) { - D3D12PipelineState::ResourceView &view = + D3D12Pipe::View &view = resize_and_add(spaces[p.Descriptor.RegisterSpace].uavs, p.Descriptor.ShaderRegister); view.Immediate = true; view.RootElement = (uint32_t)rootEl; @@ -684,7 +684,7 @@ void D3D12Replay::FillRegisterSpaces(const D3D12RenderState::RootSignature &root for(UINT i = 0; i < range.NumDescriptors; i++, shaderReg++) { - D3D12PipelineState::Sampler &samp = spaces[regSpace].samplers[shaderReg]; + D3D12Pipe::Sampler &samp = spaces[regSpace].samplers[shaderReg]; samp.Immediate = false; samp.RootElement = (uint32_t)rootEl; samp.TableIndex = offset + i; @@ -728,7 +728,7 @@ void D3D12Replay::FillRegisterSpaces(const D3D12RenderState::RootSignature &root for(UINT i = 0; i < range.NumDescriptors; i++, shaderReg++) { - D3D12PipelineState::CBuffer &cb = spaces[regSpace].cbuffers[shaderReg]; + D3D12Pipe::CBuffer &cb = spaces[regSpace].cbuffers[shaderReg]; cb.Immediate = false; cb.RootElement = (uint32_t)rootEl; cb.TableIndex = offset + i; @@ -752,7 +752,7 @@ void D3D12Replay::FillRegisterSpaces(const D3D12RenderState::RootSignature &root for(UINT i = 0; i < range.NumDescriptors; i++, shaderReg++) { - D3D12PipelineState::ResourceView &view = spaces[regSpace].srvs[shaderReg]; + D3D12Pipe::View &view = spaces[regSpace].srvs[shaderReg]; view.Immediate = false; view.RootElement = (uint32_t)rootEl; view.TableIndex = offset + i; @@ -773,7 +773,7 @@ void D3D12Replay::FillRegisterSpaces(const D3D12RenderState::RootSignature &root for(UINT i = 0; i < range.NumDescriptors; i++, shaderReg++) { - D3D12PipelineState::ResourceView &view = spaces[regSpace].uavs[shaderReg]; + D3D12Pipe::View &view = spaces[regSpace].uavs[shaderReg]; view.Immediate = false; view.RootElement = (uint32_t)rootEl; view.TableIndex = offset + i; @@ -798,7 +798,7 @@ void D3D12Replay::FillRegisterSpaces(const D3D12RenderState::RootSignature &root sampDesc.ShaderVisibility != visibility) continue; - D3D12PipelineState::Sampler &samp = + D3D12Pipe::Sampler &samp = resize_and_add(spaces[sampDesc.RegisterSpace].samplers, sampDesc.ShaderRegister); samp.Immediate = true; samp.RootElement = (uint32_t)i; @@ -866,7 +866,7 @@ void D3D12Replay::MakePipelineState() { const D3D12RenderState &rs = m_pDevice->GetQueue()->GetCommandData()->m_RenderState; - D3D12PipelineState state; + D3D12Pipe::State state; ///////////////////////////////////////////////// // Input Assembler @@ -905,7 +905,7 @@ void D3D12Replay::MakePipelineState() create_array_uninit(state.m_IA.layouts, numInput); for(UINT i = 0; i < numInput; i++) { - D3D12PipelineState::InputAssembler::LayoutInput &l = state.m_IA.layouts[i]; + D3D12Pipe::Layout &l = state.m_IA.layouts[i]; l.ByteOffset = inputEl[i].AlignedByteOffset; l.Format = MakeResourceFormat(inputEl[i].Format); @@ -929,7 +929,7 @@ void D3D12Replay::MakePipelineState() create_array_uninit(state.m_IA.vbuffers, rs.vbuffers.size()); for(size_t i = 0; i < rs.vbuffers.size(); i++) { - D3D12PipelineState::InputAssembler::VertexBuffer &vb = state.m_IA.vbuffers[i]; + D3D12Pipe::VB &vb = state.m_IA.vbuffers[i]; vb.Buffer = rm->GetOriginalID(rs.vbuffers[i].buf); vb.Offset = rs.vbuffers[i].offs; @@ -961,8 +961,7 @@ void D3D12Replay::MakePipelineState() } else if(pipe) { - D3D12PipelineState::Shader *dstArr[] = {&state.m_VS, &state.m_HS, &state.m_DS, &state.m_GS, - &state.m_PS}; + D3D12Pipe::Shader *dstArr[] = {&state.m_VS, &state.m_HS, &state.m_DS, &state.m_GS, &state.m_PS}; D3D12_SHADER_BYTECODE *srcArr[] = {&pipe->graphics->VS, &pipe->graphics->HS, &pipe->graphics->DS, &pipe->graphics->GS, &pipe->graphics->PS}; @@ -973,7 +972,7 @@ void D3D12Replay::MakePipelineState() for(size_t stage = 0; stage < 5; stage++) { - D3D12PipelineState::Shader &dst = *dstArr[stage]; + D3D12Pipe::Shader &dst = *dstArr[stage]; D3D12_SHADER_BYTECODE &src = *srcArr[stage]; dst.stage = (ShaderStage)stage; @@ -1017,7 +1016,7 @@ void D3D12Replay::MakePipelineState() state.m_RS.SampleMask = pipe->graphics->SampleMask; { - D3D12PipelineState::Rasterizer::RasterizerState &dst = state.m_RS.m_State; + D3D12Pipe::RasterizerState &dst = state.m_RS.m_State; D3D12_RASTERIZER_DESC &src = pipe->graphics->RasterizerState; dst.AntialiasedLineEnable = src.AntialiasedLineEnable == TRUE; @@ -1045,14 +1044,14 @@ void D3D12Replay::MakePipelineState() create_array_uninit(state.m_RS.Scissors, rs.scissors.size()); for(size_t i = 0; i < rs.scissors.size(); i++) - state.m_RS.Scissors[i] = D3D12PipelineState::Rasterizer::Scissor( - rs.scissors[i].left, rs.scissors[i].top, rs.scissors[i].right, rs.scissors[i].bottom); + state.m_RS.Scissors[i] = D3D12Pipe::Scissor(rs.scissors[i].left, rs.scissors[i].top, + rs.scissors[i].right, rs.scissors[i].bottom); create_array_uninit(state.m_RS.Viewports, rs.views.size()); for(size_t i = 0; i < rs.views.size(); i++) - state.m_RS.Viewports[i] = D3D12PipelineState::Rasterizer::Viewport( - rs.views[i].TopLeftX, rs.views[i].TopLeftY, rs.views[i].Width, rs.views[i].Height, - rs.views[i].MinDepth, rs.views[i].MaxDepth); + state.m_RS.Viewports[i] = + D3D12Pipe::Viewport(rs.views[i].TopLeftX, rs.views[i].TopLeftY, rs.views[i].Width, + rs.views[i].Height, rs.views[i].MinDepth, rs.views[i].MaxDepth); ///////////////////////////////////////////////// // Output Merger @@ -1061,7 +1060,7 @@ void D3D12Replay::MakePipelineState() create_array(state.m_OM.RenderTargets, rs.rts.size()); for(size_t i = 0; i < rs.rts.size(); i++) { - D3D12PipelineState::ResourceView &view = state.m_OM.RenderTargets[i]; + D3D12Pipe::View &view = state.m_OM.RenderTargets[i]; PortableHandle h = rs.rtSingle ? rs.rts[0] : rs.rts[i]; @@ -1080,7 +1079,7 @@ void D3D12Replay::MakePipelineState() } { - D3D12PipelineState::ResourceView &view = state.m_OM.DepthTarget; + D3D12Pipe::View &view = state.m_OM.DepthTarget; if(rs.dsv.heap != ResourceId()) { @@ -1104,8 +1103,7 @@ void D3D12Replay::MakePipelineState() create_array_uninit(state.m_OM.m_BlendState.Blends, 8); for(size_t i = 0; i < 8; i++) { - D3D12PipelineState::OutputMerger::BlendState::RTBlend &blend = - state.m_OM.m_BlendState.Blends[i]; + D3D12Pipe::Blend &blend = state.m_OM.m_BlendState.Blends[i]; blend.Enabled = src.RenderTarget[i].BlendEnable == TRUE; @@ -1154,7 +1152,7 @@ void D3D12Replay::MakePipelineState() size_t i = 0; for(auto it = states.begin(); it != states.end(); ++it) { - D3D12PipelineState::ResourceData &res = state.Resources[i]; + D3D12Pipe::ResourceData &res = state.Resources[i]; res.id = rm->GetOriginalID(it->first); diff --git a/renderdoc/driver/d3d12/d3d12_replay.h b/renderdoc/driver/d3d12/d3d12_replay.h index e8bf66eb6..42bbed39f 100644 --- a/renderdoc/driver/d3d12/d3d12_replay.h +++ b/renderdoc/driver/d3d12/d3d12_replay.h @@ -62,7 +62,7 @@ public: void SavePipelineState() { MakePipelineState(); } D3D11Pipe::State GetD3D11PipelineState() { return D3D11Pipe::State(); } - D3D12PipelineState GetD3D12PipelineState() { return m_PipelineState; } + D3D12Pipe::State GetD3D12PipelineState() { return m_PipelineState; } GLPipe::State GetGLPipelineState() { return GLPipe::State(); } VKPipe::State GetVulkanPipelineState() { return VKPipe::State(); } void FreeTargetResource(ResourceId id); @@ -176,15 +176,15 @@ private: void MakePipelineState(); void FillRegisterSpaces(const D3D12RenderState::RootSignature &rootSig, - rdctype::array &spaces, + rdctype::array &spaces, D3D12_SHADER_VISIBILITY visibility); - void FillResourceView(D3D12PipelineState::ResourceView &view, D3D12Descriptor *desc); + void FillResourceView(D3D12Pipe::View &view, D3D12Descriptor *desc); bool m_Proxy; vector m_ProxyResources; - D3D12PipelineState m_PipelineState; + D3D12Pipe::State m_PipelineState; WrappedID3D12Device *m_pDevice; }; diff --git a/renderdoc/driver/gl/gl_replay.h b/renderdoc/driver/gl/gl_replay.h index 8796e3a46..9cb55e3d2 100644 --- a/renderdoc/driver/gl/gl_replay.h +++ b/renderdoc/driver/gl/gl_replay.h @@ -109,7 +109,7 @@ public: void SavePipelineState(); D3D11Pipe::State GetD3D11PipelineState() { return D3D11Pipe::State(); } - D3D12PipelineState GetD3D12PipelineState() { return D3D12PipelineState(); } + D3D12Pipe::State GetD3D12PipelineState() { return D3D12Pipe::State(); } GLPipe::State GetGLPipelineState() { return m_CurPipelineState; } VKPipe::State GetVulkanPipelineState() { return VKPipe::State(); } void FreeTargetResource(ResourceId id); diff --git a/renderdoc/driver/vulkan/vk_replay.h b/renderdoc/driver/vulkan/vk_replay.h index 11d021b3e..9e47d93eb 100644 --- a/renderdoc/driver/vulkan/vk_replay.h +++ b/renderdoc/driver/vulkan/vk_replay.h @@ -151,7 +151,7 @@ public: void SavePipelineState(); D3D11Pipe::State GetD3D11PipelineState() { return D3D11Pipe::State(); } - D3D12PipelineState GetD3D12PipelineState() { return D3D12PipelineState(); } + D3D12Pipe::State GetD3D12PipelineState() { return D3D12Pipe::State(); } GLPipe::State GetGLPipelineState() { return GLPipe::State(); } VKPipe::State GetVulkanPipelineState() { return m_VulkanPipelineState; } void FreeTargetResource(ResourceId id); diff --git a/renderdoc/replay/replay_driver.h b/renderdoc/replay/replay_driver.h index f06b72977..ab5405e34 100644 --- a/renderdoc/replay/replay_driver.h +++ b/renderdoc/replay/replay_driver.h @@ -97,7 +97,7 @@ public: virtual void SavePipelineState() = 0; virtual D3D11Pipe::State GetD3D11PipelineState() = 0; - virtual D3D12PipelineState GetD3D12PipelineState() = 0; + virtual D3D12Pipe::State GetD3D12PipelineState() = 0; virtual GLPipe::State GetGLPipelineState() = 0; virtual VKPipe::State GetVulkanPipelineState() = 0; diff --git a/renderdoc/replay/replay_renderer.cpp b/renderdoc/replay/replay_renderer.cpp index b3a754fe3..f7c55bde5 100644 --- a/renderdoc/replay/replay_renderer.cpp +++ b/renderdoc/replay/replay_renderer.cpp @@ -194,7 +194,7 @@ bool ReplayRenderer::GetD3D11PipelineState(D3D11Pipe::State *state) return false; } -bool ReplayRenderer::GetD3D12PipelineState(D3D12PipelineState *state) +bool ReplayRenderer::GetD3D12PipelineState(D3D12Pipe::State *state) { if(state) { @@ -1636,7 +1636,7 @@ void ReplayRenderer::FetchPipelineState() } { - D3D12PipelineState::Shader *stages[] = { + D3D12Pipe::Shader *stages[] = { &m_D3D12PipelineState.m_VS, &m_D3D12PipelineState.m_HS, &m_D3D12PipelineState.m_DS, &m_D3D12PipelineState.m_GS, &m_D3D12PipelineState.m_PS, &m_D3D12PipelineState.m_CS, }; @@ -1724,7 +1724,7 @@ ReplayRenderer_GetD3D11PipelineState(IReplayRenderer *rend, D3D11Pipe::State *st return rend->GetD3D11PipelineState(state); } extern "C" RENDERDOC_API bool32 RENDERDOC_CC -ReplayRenderer_GetD3D12PipelineState(IReplayRenderer *rend, D3D12PipelineState *state) +ReplayRenderer_GetD3D12PipelineState(IReplayRenderer *rend, D3D12Pipe::State *state) { return rend->GetD3D12PipelineState(state); } diff --git a/renderdoc/replay/replay_renderer.h b/renderdoc/replay/replay_renderer.h index 14c9d95b1..9b5d795d8 100644 --- a/renderdoc/replay/replay_renderer.h +++ b/renderdoc/replay/replay_renderer.h @@ -138,7 +138,7 @@ public: void FetchPipelineState(); bool GetD3D11PipelineState(D3D11Pipe::State *state); - bool GetD3D12PipelineState(D3D12PipelineState *state); + bool GetD3D12PipelineState(D3D12Pipe::State *state); bool GetGLPipelineState(GLPipe::State *state); bool GetVulkanPipelineState(VKPipe::State *state); @@ -210,7 +210,7 @@ private: uint32_t m_EventID; D3D11Pipe::State m_D3D11PipelineState; - D3D12PipelineState m_D3D12PipelineState; + D3D12Pipe::State m_D3D12PipelineState; GLPipe::State m_GLPipelineState; VKPipe::State m_VulkanPipelineState;