diff --git a/renderdoc/api/replay/vk_pipestate.h b/renderdoc/api/replay/vk_pipestate.h index 17e6ad07c..b74875c40 100644 --- a/renderdoc/api/replay/vk_pipestate.h +++ b/renderdoc/api/replay/vk_pipestate.h @@ -28,7 +28,7 @@ struct VulkanPipelineState { VulkanPipelineState() : pipelineFlags(0) {} - ResourceId pipeline; + ResourceId computePipeline, graphicsPipeline; uint32_t pipelineFlags; // VKTODOMED renderpass/subpass? @@ -92,30 +92,35 @@ struct VulkanPipelineState // VKTODOMED specialization info } VS, TCS, TES, GS, FS, CS; + // VKTODOHIGH descriptor sets + struct Tessellation { Tessellation() : numControlPoints(0) { } uint32_t numControlPoints; } Tess; - struct ViewportScissor + struct ViewState { ResourceId state; - struct Viewport + struct ViewportScissor { - Viewport() : x(0), y(0), width(0), height(0), mindepth(0), maxdepth(0) {} - float x, y, width, height, mindepth, maxdepth; - } vp; + struct Viewport + { + Viewport() : x(0), y(0), width(0), height(0), mindepth(0), maxdepth(0) {} + float x, y, width, height, mindepth, maxdepth; + } vp; - struct Scissor - { - Scissor() : x(0), y(0), width(0), height(0) {} - int32_t x, y, width, height; - } scissor; - }; - - rdctype::array viewportScissors; + struct Scissor + { + Scissor() : x(0), y(0), width(0), height(0) {} + int32_t x, y, width, height; + } scissor; + }; + + rdctype::array viewportScissors; + } VP; struct Raster { @@ -143,15 +148,17 @@ struct VulkanPipelineState struct ColorBlend { + ColorBlend() + { + blendConst[0] = blendConst[1] = blendConst[2] = blendConst[3] = 0.0f; + } + bool32 alphaToCoverageEnable, logicOpEnable; rdctype::str logicOp; struct Attachment { - Attachment() : blendEnable(false), writeMask(0) - { - blendConst[0] = blendConst[1] = blendConst[2] = blendConst[3] = 0.0f; - } + Attachment() : blendEnable(false), writeMask(0) {} bool32 blendEnable; @@ -163,11 +170,11 @@ struct VulkanPipelineState } blend, alphaBlend; uint8_t writeMask; - - ResourceId state; - float blendConst[4]; }; rdctype::array attachments; + + ResourceId state; + float blendConst[4]; } CB; struct DepthStencil diff --git a/renderdoc/driver/vulkan/vk_replay.cpp b/renderdoc/driver/vulkan/vk_replay.cpp index 485496da9..afcc0813d 100644 --- a/renderdoc/driver/vulkan/vk_replay.cpp +++ b/renderdoc/driver/vulkan/vk_replay.cpp @@ -694,14 +694,50 @@ void VulkanReplay::SavePipelineState() { VULKANNOTIMP("SavePipelineState"); - create_array_uninit(m_D3D11PipelineState.m_OM.RenderTargets, 1); + { + create_array_uninit(m_D3D11PipelineState.m_OM.RenderTargets, 1); - ResourceId id; - VkImage fakeBBIm = VK_NULL_HANDLE; - VkExtent3D fakeBBext; - m_pDriver->GetFakeBB(id, fakeBBIm, fakeBBext); + ResourceId id; + VkImage fakeBBIm = VK_NULL_HANDLE; + VkExtent3D fakeBBext; + m_pDriver->GetFakeBB(id, fakeBBIm, fakeBBext); - m_D3D11PipelineState.m_OM.RenderTargets[0].Resource = id; + m_D3D11PipelineState.m_OM.RenderTargets[0].Resource = id; + } + + { + const WrappedVulkan::PartialReplayData::StateVector &state = m_pDriver->m_PartialReplayData.state; + + create_array_uninit(m_VulkanPipelineState.VI.vbuffers, state.vbuffers.size()); + for(size_t i=0; i < state.vbuffers.size(); i++) + { + m_VulkanPipelineState.VI.vbuffers[i].buffer = state.vbuffers[i].buf; + m_VulkanPipelineState.VI.vbuffers[i].offset = state.vbuffers[i].offs; + } + + { + m_VulkanPipelineState.IA.ibuffer.buf = state.ibuffer.buf; + m_VulkanPipelineState.IA.ibuffer.offs = state.ibuffer.offs; + } + + m_VulkanPipelineState.computePipeline = state.compute.pipeline; + m_VulkanPipelineState.graphicsPipeline = state.graphics.pipeline; + + m_VulkanPipelineState.VP.state = state.dynamicVP; + m_VulkanPipelineState.RS.state = state.dynamicVP; + m_VulkanPipelineState.DS.state = state.dynamicDS; + m_VulkanPipelineState.CB.state = state.dynamicCB; + + m_VulkanPipelineState.Pass.renderpass.obj = state.renderPass; + m_VulkanPipelineState.Pass.framebuffer.obj = state.framebuffer; + + // TODO split fine-grained state out of above objects + + m_VulkanPipelineState.Pass.renderArea.x = state.renderArea.offset.x; + m_VulkanPipelineState.Pass.renderArea.y = state.renderArea.offset.y; + m_VulkanPipelineState.Pass.renderArea.width = state.renderArea.extent.width; + m_VulkanPipelineState.Pass.renderArea.height = state.renderArea.extent.height; + } } void VulkanReplay::FillCBufferVariables(ResourceId shader, uint32_t cbufSlot, vector &outvars, const vector &data) diff --git a/renderdoc/driver/vulkan/vk_replay.h b/renderdoc/driver/vulkan/vk_replay.h index 17ed2395c..1881b9b4e 100644 --- a/renderdoc/driver/vulkan/vk_replay.h +++ b/renderdoc/driver/vulkan/vk_replay.h @@ -82,7 +82,7 @@ class VulkanReplay : public IReplayDriver void SavePipelineState(); D3D11PipelineState GetD3D11PipelineState() { return m_D3D11PipelineState; } GLPipelineState GetGLPipelineState() { return GLPipelineState(); } - VulkanPipelineState GetVulkanPipelineState() { return VulkanPipelineState(); } + VulkanPipelineState GetVulkanPipelineState() { return m_VulkanPipelineState; } void FreeTargetResource(ResourceId id); @@ -186,6 +186,7 @@ class VulkanReplay : public IReplayDriver VkImageMemoryBarrier stenciltrans; }; + VulkanPipelineState m_VulkanPipelineState; D3D11PipelineState m_D3D11PipelineState; map m_OutputWindows;