Store coarse objects in VulkanPipelineState

This commit is contained in:
baldurk
2015-09-03 21:52:13 +02:00
parent aed0d23ca6
commit 1e175fd858
3 changed files with 72 additions and 28 deletions
+28 -21
View File
@@ -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<ViewportScissor> viewportScissors;
struct Scissor
{
Scissor() : x(0), y(0), width(0), height(0) {}
int32_t x, y, width, height;
} scissor;
};
rdctype::array<ViewportScissor> 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<Attachment> attachments;
ResourceId state;
float blendConst[4];
} CB;
struct DepthStencil
+42 -6
View File
@@ -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<ShaderVariable> &outvars, const vector<byte> &data)
+2 -1
View File
@@ -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<uint64_t, OutputWindow> m_OutputWindows;