mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-29 13:20:54 +00:00
Make vulkan pipeline state available for replay
* ResourceFormat is still TODO
This commit is contained in:
@@ -26,10 +26,13 @@
|
||||
|
||||
struct VulkanPipelineState
|
||||
{
|
||||
VulkanPipelineState() : pipelineFlags(0) {}
|
||||
struct Pipeline
|
||||
{
|
||||
Pipeline() : flags(0) {}
|
||||
|
||||
ResourceId computePipeline, graphicsPipeline;
|
||||
uint32_t pipelineFlags;
|
||||
ResourceId obj;
|
||||
uint32_t flags;
|
||||
} compute, graphics;
|
||||
|
||||
// VKTODOMED renderpass/subpass?
|
||||
|
||||
@@ -52,7 +55,8 @@ struct VulkanPipelineState
|
||||
{
|
||||
struct Attribute
|
||||
{
|
||||
Attribute() : binding(0), format(), byteoffset(0) {}
|
||||
Attribute() : location(0), binding(0), format(), byteoffset(0) {}
|
||||
uint32_t location;
|
||||
uint32_t binding;
|
||||
ResourceFormat format;
|
||||
uint32_t byteoffset;
|
||||
@@ -108,8 +112,8 @@ struct VulkanPipelineState
|
||||
{
|
||||
struct Viewport
|
||||
{
|
||||
Viewport() : x(0), y(0), width(0), height(0), mindepth(0), maxdepth(0) {}
|
||||
float x, y, width, height, mindepth, maxdepth;
|
||||
Viewport() : x(0), y(0), width(0), height(0), minDepth(0), maxDepth(0) {}
|
||||
float x, y, width, height, minDepth, maxDepth;
|
||||
} vp;
|
||||
|
||||
struct Scissor
|
||||
@@ -149,6 +153,7 @@ struct VulkanPipelineState
|
||||
struct ColorBlend
|
||||
{
|
||||
ColorBlend()
|
||||
: alphaToCoverageEnable(false), logicOpEnable(false)
|
||||
{
|
||||
blendConst[0] = blendConst[1] = blendConst[2] = blendConst[3] = 0.0f;
|
||||
}
|
||||
@@ -181,25 +186,25 @@ struct VulkanPipelineState
|
||||
{
|
||||
DepthStencil()
|
||||
: depthTestEnable(false), depthWriteEnable(false), depthBoundsEnable(false), stencilTestEnable(false)
|
||||
, minDepthBounds(0), maxDepthBounds(0) {}
|
||||
, minDepthBounds(0), maxDepthBounds(0), stencilReadMask(0), stencilWriteMask(0) {}
|
||||
|
||||
bool32 depthTestEnable, depthWriteEnable, depthBoundsEnable;
|
||||
rdctype::str compareOp;
|
||||
rdctype::str depthCompareOp;
|
||||
|
||||
bool32 stencilTestEnable;
|
||||
struct StencilOp
|
||||
{
|
||||
StencilOp() : mask(0), ref(0) {}
|
||||
StencilOp() : ref(0) {}
|
||||
rdctype::str failOp;
|
||||
rdctype::str depthFailOp;
|
||||
rdctype::str passOp;
|
||||
rdctype::str func;
|
||||
uint32_t mask;
|
||||
uint32_t ref;
|
||||
} front, back;
|
||||
|
||||
ResourceId state;
|
||||
float minDepthBounds, maxDepthBounds;
|
||||
uint32_t stencilReadMask, stencilWriteMask;
|
||||
} DS;
|
||||
|
||||
struct CurrentPass
|
||||
|
||||
@@ -2264,6 +2264,9 @@ bool WrappedVulkan::Serialise_vkCreateGraphicsPipelines(
|
||||
if(m_State == READING)
|
||||
{
|
||||
VkPipeline pipe = VK_NULL_HANDLE;
|
||||
|
||||
// use original ID
|
||||
m_CreationInfo.m_Pipeline[id].Init(GetResourceManager(), &info);
|
||||
|
||||
device = (VkDevice)GetResourceManager()->GetLiveResource(devId).handle;
|
||||
pipelineCache = (VkPipelineCache)GetResourceManager()->GetLiveResource(cacheId).handle;
|
||||
@@ -2682,6 +2685,9 @@ bool WrappedVulkan::Serialise_vkCreateFramebuffer(
|
||||
if(m_State == READING)
|
||||
{
|
||||
VkFramebuffer fb = VK_NULL_HANDLE;
|
||||
|
||||
// use original ID
|
||||
m_CreationInfo.m_Framebuffer[id].Init(GetResourceManager(), &info);
|
||||
|
||||
VkResult ret = m_Real.vkCreateFramebuffer((VkDevice)GetResourceManager()->GetLiveResource(devId).handle, &info, &fb);
|
||||
|
||||
@@ -2818,6 +2824,9 @@ bool WrappedVulkan::Serialise_vkCreateDynamicViewportState(
|
||||
{
|
||||
VkDynamicViewportState state = VK_NULL_HANDLE;
|
||||
|
||||
// use original ID
|
||||
m_CreationInfo.m_VPScissor[id].Init(GetResourceManager(), &info);
|
||||
|
||||
VkResult ret = m_Real.vkCreateDynamicViewportState((VkDevice)GetResourceManager()->GetLiveResource(devId).handle, &info, &state);
|
||||
|
||||
if(ret != VK_SUCCESS)
|
||||
@@ -2882,6 +2891,9 @@ bool WrappedVulkan::Serialise_vkCreateDynamicRasterState(
|
||||
{
|
||||
VkDynamicRasterState state = VK_NULL_HANDLE;
|
||||
|
||||
// use original ID
|
||||
m_CreationInfo.m_Raster[id].Init(GetResourceManager(), &info);
|
||||
|
||||
VkResult ret = m_Real.vkCreateDynamicRasterState((VkDevice)GetResourceManager()->GetLiveResource(devId).handle, &info, &state);
|
||||
|
||||
if(ret != VK_SUCCESS)
|
||||
@@ -2946,6 +2958,9 @@ bool WrappedVulkan::Serialise_vkCreateDynamicColorBlendState(
|
||||
{
|
||||
VkDynamicColorBlendState state = VK_NULL_HANDLE;
|
||||
|
||||
// use original ID
|
||||
m_CreationInfo.m_Blend[id].Init(GetResourceManager(), &info);
|
||||
|
||||
VkResult ret = m_Real.vkCreateDynamicColorBlendState((VkDevice)GetResourceManager()->GetLiveResource(devId).handle, &info, &state);
|
||||
|
||||
if(ret != VK_SUCCESS)
|
||||
@@ -3010,6 +3025,9 @@ bool WrappedVulkan::Serialise_vkCreateDynamicDepthStencilState(
|
||||
{
|
||||
VkDynamicDepthStencilState state = VK_NULL_HANDLE;
|
||||
|
||||
// use original ID
|
||||
m_CreationInfo.m_DepthStencil[id].Init(GetResourceManager(), &info);
|
||||
|
||||
VkResult ret = m_Real.vkCreateDynamicDepthStencilState((VkDevice)GetResourceManager()->GetLiveResource(devId).handle, &info, &state);
|
||||
|
||||
if(ret != VK_SUCCESS)
|
||||
|
||||
@@ -24,6 +24,135 @@
|
||||
|
||||
#include "vk_info.h"
|
||||
|
||||
void VulkanCreationInfo::Pipeline::Init(const VkGraphicsPipelineCreateInfo* pCreateInfo)
|
||||
void VulkanCreationInfo::Pipeline::Init(VulkanResourceManager *rm, const VkGraphicsPipelineCreateInfo* pCreateInfo)
|
||||
{
|
||||
flags = pCreateInfo->flags;
|
||||
|
||||
// need to figure out which states are valid to be NULL
|
||||
|
||||
// VkPipelineShaderStageCreateInfo
|
||||
RDCEraseEl(shaders);
|
||||
for(uint32_t i=0; i < pCreateInfo->stageCount; i++)
|
||||
shaders[ pCreateInfo->pStages[i].stage ] = rm->GetOriginalID(rm->GetID(MakeRes(pCreateInfo->pStages[i].shader)));
|
||||
|
||||
if(pCreateInfo->pVertexInputState)
|
||||
{
|
||||
vertexBindings.resize(pCreateInfo->pVertexInputState->bindingCount);
|
||||
for(uint32_t i=0; i < pCreateInfo->pVertexInputState->bindingCount; i++)
|
||||
{
|
||||
vertexBindings[i].vbufferBinding = pCreateInfo->pVertexInputState->pVertexBindingDescriptions[i].binding;
|
||||
vertexBindings[i].bytestride = pCreateInfo->pVertexInputState->pVertexBindingDescriptions[i].strideInBytes;
|
||||
vertexBindings[i].perInstance = pCreateInfo->pVertexInputState->pVertexBindingDescriptions[i].stepRate == VK_VERTEX_INPUT_STEP_RATE_INSTANCE;
|
||||
}
|
||||
|
||||
vertexAttrs.resize(pCreateInfo->pVertexInputState->attributeCount);
|
||||
for(uint32_t i=0; i < pCreateInfo->pVertexInputState->attributeCount; i++)
|
||||
{
|
||||
vertexAttrs[i].binding = pCreateInfo->pVertexInputState->pVertexAttributeDescriptions[i].binding;
|
||||
vertexAttrs[i].location = pCreateInfo->pVertexInputState->pVertexAttributeDescriptions[i].location;
|
||||
vertexAttrs[i].format = pCreateInfo->pVertexInputState->pVertexAttributeDescriptions[i].format;
|
||||
vertexAttrs[i].byteoffset = pCreateInfo->pVertexInputState->pVertexAttributeDescriptions[i].offsetInBytes;
|
||||
}
|
||||
}
|
||||
|
||||
topology = pCreateInfo->pInputAssemblyState->topology;
|
||||
primitiveRestartEnable = pCreateInfo->pInputAssemblyState->primitiveRestartEnable ? true : false;
|
||||
|
||||
if(pCreateInfo->pTessellationState)
|
||||
patchControlPoints = pCreateInfo->pTessellationState->patchControlPoints;
|
||||
else
|
||||
patchControlPoints = 0;
|
||||
|
||||
viewportCount = pCreateInfo->pViewportState->viewportCount;
|
||||
|
||||
// VkPipelineRasterStateCreateInfo
|
||||
depthClipEnable = pCreateInfo->pRasterState->depthClipEnable ? true : false;
|
||||
rasterizerDiscardEnable = pCreateInfo->pRasterState->rasterizerDiscardEnable ? true : false;
|
||||
fillMode = pCreateInfo->pRasterState->fillMode;
|
||||
cullMode = pCreateInfo->pRasterState->cullMode;
|
||||
frontFace = pCreateInfo->pRasterState->frontFace;
|
||||
|
||||
// VkPipelineMultisampleStateCreateInfo
|
||||
rasterSamples = pCreateInfo->pMultisampleState->rasterSamples;
|
||||
sampleShadingEnable = pCreateInfo->pMultisampleState->sampleShadingEnable ? true : false;
|
||||
minSampleShading = pCreateInfo->pMultisampleState->minSampleShading;
|
||||
sampleMask = pCreateInfo->pMultisampleState->sampleMask;
|
||||
|
||||
// VkPipelineDepthStencilStateCreateInfo
|
||||
depthTestEnable = pCreateInfo->pDepthStencilState->depthTestEnable ? true : false;
|
||||
depthWriteEnable = pCreateInfo->pDepthStencilState->depthWriteEnable ? true : false;
|
||||
depthCompareOp = pCreateInfo->pDepthStencilState->depthCompareOp;
|
||||
depthBoundsEnable = pCreateInfo->pDepthStencilState->depthBoundsEnable ? true : false;
|
||||
stencilTestEnable = pCreateInfo->pDepthStencilState->stencilTestEnable ? true : false;
|
||||
front = pCreateInfo->pDepthStencilState->front;
|
||||
back = pCreateInfo->pDepthStencilState->back;
|
||||
|
||||
// VkPipelineColorBlendStateCreateInfo
|
||||
alphaToCoverageEnable = pCreateInfo->pColorBlendState->alphaToCoverageEnable ? true : false;
|
||||
logicOpEnable = pCreateInfo->pColorBlendState->logicOpEnable ? true : false;
|
||||
logicOp = pCreateInfo->pColorBlendState->logicOp;
|
||||
|
||||
attachments.resize(pCreateInfo->pColorBlendState->attachmentCount);
|
||||
|
||||
for(uint32_t i=0; i < pCreateInfo->pColorBlendState->attachmentCount; i++)
|
||||
{
|
||||
attachments[i].blendEnable = pCreateInfo->pColorBlendState->pAttachments[i].blendEnable ? true : false;
|
||||
|
||||
attachments[i].blend.Source = pCreateInfo->pColorBlendState->pAttachments[i].srcBlendColor;
|
||||
attachments[i].blend.Destination = pCreateInfo->pColorBlendState->pAttachments[i].destBlendColor;
|
||||
attachments[i].blend.Operation = pCreateInfo->pColorBlendState->pAttachments[i].blendOpColor;
|
||||
|
||||
attachments[i].alphaBlend.Source = pCreateInfo->pColorBlendState->pAttachments[i].srcBlendAlpha;
|
||||
attachments[i].alphaBlend.Destination = pCreateInfo->pColorBlendState->pAttachments[i].destBlendAlpha;
|
||||
attachments[i].alphaBlend.Operation = pCreateInfo->pColorBlendState->pAttachments[i].blendOpAlpha;
|
||||
|
||||
attachments[i].channelWriteMask = pCreateInfo->pColorBlendState->pAttachments[i].channelWriteMask;
|
||||
}
|
||||
}
|
||||
|
||||
void VulkanCreationInfo::ViewportScissor::Init(VulkanResourceManager *rm, const VkDynamicViewportStateCreateInfo* pCreateInfo)
|
||||
{
|
||||
viewports.resize(pCreateInfo->viewportAndScissorCount);
|
||||
scissors.resize(pCreateInfo->viewportAndScissorCount);
|
||||
|
||||
for(uint32_t i=0; i < pCreateInfo->viewportAndScissorCount; i++)
|
||||
{
|
||||
viewports[i] = pCreateInfo->pViewports[i];
|
||||
scissors[i] = pCreateInfo->pScissors[i];
|
||||
}
|
||||
}
|
||||
|
||||
void VulkanCreationInfo::Raster::Init(VulkanResourceManager *rm, const VkDynamicRasterStateCreateInfo* pCreateInfo)
|
||||
{
|
||||
depthBias = pCreateInfo->depthBias;
|
||||
depthBiasClamp = pCreateInfo->depthBiasClamp;
|
||||
slopeScaledDepthBias = pCreateInfo->slopeScaledDepthBias;
|
||||
lineWidth = pCreateInfo->lineWidth;
|
||||
}
|
||||
|
||||
void VulkanCreationInfo::Blend::Init(VulkanResourceManager *rm, const VkDynamicColorBlendStateCreateInfo* pCreateInfo)
|
||||
{
|
||||
RDCCOMPILE_ASSERT(sizeof(blendConst) == sizeof(pCreateInfo->blendConst), "blend constant size mismatch!");
|
||||
memcpy(blendConst, pCreateInfo->blendConst, sizeof(blendConst));
|
||||
}
|
||||
|
||||
void VulkanCreationInfo::DepthStencil::Init(VulkanResourceManager *rm, const VkDynamicDepthStencilStateCreateInfo* pCreateInfo)
|
||||
{
|
||||
minDepthBounds = pCreateInfo->minDepthBounds;
|
||||
maxDepthBounds = pCreateInfo->maxDepthBounds;
|
||||
stencilReadMask = pCreateInfo->stencilReadMask;
|
||||
stencilWriteMask = pCreateInfo->stencilWriteMask;
|
||||
stencilFrontRef = pCreateInfo->stencilFrontRef;
|
||||
stencilBackRef = pCreateInfo->stencilBackRef;
|
||||
}
|
||||
|
||||
void VulkanCreationInfo::Framebuffer::Init(VulkanResourceManager *rm, const VkFramebufferCreateInfo* pCreateInfo)
|
||||
{
|
||||
width = pCreateInfo->width;
|
||||
height = pCreateInfo->height;
|
||||
layers = pCreateInfo->layers;
|
||||
|
||||
attachments.resize(pCreateInfo->attachmentCount);
|
||||
for(uint32_t i=0; i < pCreateInfo->attachmentCount; i++)
|
||||
attachments[i].view = rm->GetOriginalID(rm->GetID(MakeRes(pCreateInfo->pAttachments[i].view)));
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ struct VulkanCreationInfo
|
||||
{
|
||||
struct Pipeline
|
||||
{
|
||||
void Init(const VkGraphicsPipelineCreateInfo* pCreateInfo);
|
||||
void Init(VulkanResourceManager *rm, const VkGraphicsPipelineCreateInfo* pCreateInfo);
|
||||
|
||||
// VkGraphicsPipelineCreateInfo
|
||||
VkPipelineCreateFlags flags;
|
||||
@@ -50,6 +50,7 @@ struct VulkanCreationInfo
|
||||
|
||||
struct Attribute
|
||||
{
|
||||
uint32_t location;
|
||||
uint32_t binding;
|
||||
VkFormat format;
|
||||
uint32_t byteoffset;
|
||||
@@ -92,7 +93,6 @@ struct VulkanCreationInfo
|
||||
bool alphaToCoverageEnable;
|
||||
bool logicOpEnable;
|
||||
VkLogicOp logicOp;
|
||||
uint32_t attachmentCount;
|
||||
|
||||
struct Attachment
|
||||
{
|
||||
@@ -113,6 +113,8 @@ struct VulkanCreationInfo
|
||||
|
||||
struct ViewportScissor
|
||||
{
|
||||
void Init(VulkanResourceManager *rm, const VkDynamicViewportStateCreateInfo* pCreateInfo);
|
||||
|
||||
vector<VkViewport> viewports;
|
||||
vector<VkRect2D> scissors;
|
||||
};
|
||||
@@ -120,6 +122,8 @@ struct VulkanCreationInfo
|
||||
|
||||
struct Raster
|
||||
{
|
||||
void Init(VulkanResourceManager *rm, const VkDynamicRasterStateCreateInfo* pCreateInfo);
|
||||
|
||||
float depthBias;
|
||||
float depthBiasClamp;
|
||||
float slopeScaledDepthBias;
|
||||
@@ -129,12 +133,16 @@ struct VulkanCreationInfo
|
||||
|
||||
struct Blend
|
||||
{
|
||||
void Init(VulkanResourceManager *rm, const VkDynamicColorBlendStateCreateInfo* pCreateInfo);
|
||||
|
||||
float blendConst[4];
|
||||
};
|
||||
map<ResourceId, Blend> m_Blend;
|
||||
|
||||
struct DepthStencil
|
||||
{
|
||||
void Init(VulkanResourceManager *rm, const VkDynamicDepthStencilStateCreateInfo* pCreateInfo);
|
||||
|
||||
float minDepthBounds;
|
||||
float maxDepthBounds;
|
||||
uint32_t stencilReadMask;
|
||||
@@ -143,4 +151,18 @@ struct VulkanCreationInfo
|
||||
uint32_t stencilBackRef;
|
||||
};
|
||||
map<ResourceId, DepthStencil> m_DepthStencil;
|
||||
|
||||
struct Framebuffer
|
||||
{
|
||||
void Init(VulkanResourceManager *rm, const VkFramebufferCreateInfo* pCreateInfo);
|
||||
|
||||
struct Attachment
|
||||
{
|
||||
ResourceId view;
|
||||
};
|
||||
vector<Attachment> attachments;
|
||||
|
||||
uint32_t width, height, layers;
|
||||
};
|
||||
map<ResourceId, Framebuffer> m_Framebuffer;
|
||||
};
|
||||
@@ -707,36 +707,204 @@ void VulkanReplay::SavePipelineState()
|
||||
|
||||
{
|
||||
const WrappedVulkan::PartialReplayData::StateVector &state = m_pDriver->m_PartialReplayData.state;
|
||||
VulkanCreationInfo &c = m_pDriver->m_CreationInfo;
|
||||
|
||||
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 = VulkanPipelineState();
|
||||
|
||||
// General pipeline properties
|
||||
m_VulkanPipelineState.compute.obj = state.compute.pipeline;
|
||||
m_VulkanPipelineState.graphics.obj = state.graphics.pipeline;
|
||||
|
||||
if(state.compute.pipeline != ResourceId())
|
||||
m_VulkanPipelineState.compute.flags = c.m_Pipeline[state.compute.pipeline].flags;
|
||||
|
||||
if(state.graphics.pipeline != ResourceId())
|
||||
{
|
||||
const VulkanCreationInfo::Pipeline &p = c.m_Pipeline[state.graphics.pipeline];
|
||||
|
||||
m_VulkanPipelineState.graphics.flags = p.flags;
|
||||
|
||||
// Input Assembly
|
||||
m_VulkanPipelineState.IA.ibuffer.buf = state.ibuffer.buf;
|
||||
m_VulkanPipelineState.IA.ibuffer.offs = state.ibuffer.offs;
|
||||
m_VulkanPipelineState.IA.primitiveRestartEnable = p.primitiveRestartEnable;
|
||||
|
||||
// Vertex Input
|
||||
create_array_uninit(m_VulkanPipelineState.VI.attrs, p.vertexAttrs.size());
|
||||
for(size_t i=0; i < p.vertexAttrs.size(); i++)
|
||||
{
|
||||
m_VulkanPipelineState.VI.attrs[i].location = p.vertexAttrs[i].location;
|
||||
m_VulkanPipelineState.VI.attrs[i].binding = p.vertexAttrs[i].binding;
|
||||
m_VulkanPipelineState.VI.attrs[i].byteoffset = p.vertexAttrs[i].byteoffset;
|
||||
m_VulkanPipelineState.VI.attrs[i].format = MakeResourceFormat(p.vertexAttrs[i].format);
|
||||
}
|
||||
|
||||
create_array_uninit(m_VulkanPipelineState.VI.binds, p.vertexBindings.size());
|
||||
for(size_t i=0; i < p.vertexBindings.size(); i++)
|
||||
{
|
||||
m_VulkanPipelineState.VI.binds[i].bytestride = p.vertexBindings[i].bytestride;
|
||||
m_VulkanPipelineState.VI.binds[i].vbufferBinding = p.vertexBindings[i].vbufferBinding;
|
||||
m_VulkanPipelineState.VI.binds[i].perInstance = p.vertexBindings[i].perInstance;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// Shader Stages
|
||||
VulkanPipelineState::ShaderStage *stages[] = {
|
||||
&m_VulkanPipelineState.VS,
|
||||
&m_VulkanPipelineState.TCS,
|
||||
&m_VulkanPipelineState.TES,
|
||||
&m_VulkanPipelineState.GS,
|
||||
&m_VulkanPipelineState.FS,
|
||||
&m_VulkanPipelineState.CS,
|
||||
};
|
||||
|
||||
for(size_t i=0; i < ARRAY_COUNT(stages); i++)
|
||||
{
|
||||
stages[i]->Shader = p.shaders[i];
|
||||
stages[i]->ShaderDetails = NULL;
|
||||
stages[i]->customName = false;
|
||||
stages[i]->ShaderName = StringFormat::Fmt("Shader %llu", p.shaders[i]);
|
||||
stages[i]->stage = ShaderStageType(eShaderStage_Vertex + i);
|
||||
}
|
||||
|
||||
// Tessellation
|
||||
m_VulkanPipelineState.Tess.numControlPoints = p.patchControlPoints;
|
||||
|
||||
// Viewport/Scissors
|
||||
m_VulkanPipelineState.VP.state = state.dynamicVP;
|
||||
create_array_uninit(m_VulkanPipelineState.VP.viewportScissors, c.m_VPScissor[state.dynamicVP].viewports.size());
|
||||
for(size_t i=0; i < c.m_VPScissor[state.dynamicVP].viewports.size(); i++)
|
||||
{
|
||||
m_VulkanPipelineState.VP.viewportScissors[i].vp.x = c.m_VPScissor[state.dynamicVP].viewports[i].originX;
|
||||
m_VulkanPipelineState.VP.viewportScissors[i].vp.y = c.m_VPScissor[state.dynamicVP].viewports[i].originY;
|
||||
m_VulkanPipelineState.VP.viewportScissors[i].vp.width = c.m_VPScissor[state.dynamicVP].viewports[i].width;
|
||||
m_VulkanPipelineState.VP.viewportScissors[i].vp.height = c.m_VPScissor[state.dynamicVP].viewports[i].height;
|
||||
m_VulkanPipelineState.VP.viewportScissors[i].vp.minDepth = c.m_VPScissor[state.dynamicVP].viewports[i].minDepth;
|
||||
m_VulkanPipelineState.VP.viewportScissors[i].vp.maxDepth = c.m_VPScissor[state.dynamicVP].viewports[i].maxDepth;
|
||||
|
||||
m_VulkanPipelineState.VP.viewportScissors[i].scissor.x = c.m_VPScissor[state.dynamicVP].scissors[i].offset.x;
|
||||
m_VulkanPipelineState.VP.viewportScissors[i].scissor.y = c.m_VPScissor[state.dynamicVP].scissors[i].offset.y;
|
||||
m_VulkanPipelineState.VP.viewportScissors[i].scissor.width = c.m_VPScissor[state.dynamicVP].scissors[i].extent.width;
|
||||
m_VulkanPipelineState.VP.viewportScissors[i].scissor.height = c.m_VPScissor[state.dynamicVP].scissors[i].extent.height;
|
||||
}
|
||||
|
||||
// Rasterizer
|
||||
m_VulkanPipelineState.RS.depthClipEnable = p.depthClipEnable;
|
||||
m_VulkanPipelineState.RS.rasterizerDiscardEnable = p.rasterizerDiscardEnable;
|
||||
m_VulkanPipelineState.RS.FrontCCW = p.frontFace == VK_FRONT_FACE_CCW;
|
||||
|
||||
switch(p.fillMode)
|
||||
{
|
||||
case VK_FILL_MODE_POINTS: m_VulkanPipelineState.RS.FillMode = eFill_Point; break;
|
||||
case VK_FILL_MODE_WIREFRAME: m_VulkanPipelineState.RS.FillMode = eFill_Wireframe; break;
|
||||
case VK_FILL_MODE_SOLID: m_VulkanPipelineState.RS.FillMode = eFill_Solid; break;
|
||||
default:
|
||||
m_VulkanPipelineState.RS.FillMode = eFill_Solid;
|
||||
RDCERR("Unexpected value for FillMode %x", p.fillMode);
|
||||
break;
|
||||
}
|
||||
|
||||
switch(p.cullMode)
|
||||
{
|
||||
case VK_CULL_MODE_NONE: m_VulkanPipelineState.RS.CullMode = eCull_None; break;
|
||||
case VK_CULL_MODE_FRONT: m_VulkanPipelineState.RS.CullMode = eCull_Front; break;
|
||||
case VK_CULL_MODE_BACK: m_VulkanPipelineState.RS.CullMode = eCull_Back; break;
|
||||
case VK_CULL_MODE_FRONT_AND_BACK: m_VulkanPipelineState.RS.CullMode = eCull_FrontAndBack; break;
|
||||
default:
|
||||
m_VulkanPipelineState.RS.CullMode = eCull_None;
|
||||
RDCERR("Unexpected value for CullMode %x", p.cullMode);
|
||||
break;
|
||||
}
|
||||
|
||||
m_VulkanPipelineState.RS.state = state.dynamicRS;
|
||||
m_VulkanPipelineState.RS.depthBias = c.m_Raster[state.dynamicRS].depthBias;
|
||||
m_VulkanPipelineState.RS.depthBiasClamp = c.m_Raster[state.dynamicRS].depthBiasClamp;
|
||||
m_VulkanPipelineState.RS.slopeScaledDepthBias = c.m_Raster[state.dynamicRS].slopeScaledDepthBias;
|
||||
m_VulkanPipelineState.RS.lineWidth = c.m_Raster[state.dynamicRS].lineWidth;
|
||||
|
||||
// MSAA
|
||||
m_VulkanPipelineState.MSAA.rasterSamples = p.rasterSamples;
|
||||
m_VulkanPipelineState.MSAA.sampleShadingEnable = p.sampleShadingEnable;
|
||||
m_VulkanPipelineState.MSAA.minSampleShading = p.minSampleShading;
|
||||
m_VulkanPipelineState.MSAA.sampleMask = p.sampleMask;
|
||||
|
||||
// Color Blend
|
||||
m_VulkanPipelineState.CB.logicOpEnable = p.logicOpEnable;
|
||||
m_VulkanPipelineState.CB.alphaToCoverageEnable = p.alphaToCoverageEnable;
|
||||
m_VulkanPipelineState.CB.logicOp = ToStr::Get(p.logicOp);
|
||||
|
||||
create_array_uninit(m_VulkanPipelineState.CB.attachments, p.attachments.size());
|
||||
for(size_t i=0; i < p.attachments.size(); i++)
|
||||
{
|
||||
m_VulkanPipelineState.CB.attachments[i].blendEnable = p.attachments[i].blendEnable;
|
||||
|
||||
m_VulkanPipelineState.CB.attachments[i].blend.Source = ToStr::Get(p.attachments[i].blend.Source);
|
||||
m_VulkanPipelineState.CB.attachments[i].blend.Destination = ToStr::Get(p.attachments[i].blend.Destination);
|
||||
m_VulkanPipelineState.CB.attachments[i].blend.Operation = ToStr::Get(p.attachments[i].blend.Operation);
|
||||
|
||||
m_VulkanPipelineState.CB.attachments[i].alphaBlend.Source = ToStr::Get(p.attachments[i].alphaBlend.Source);
|
||||
m_VulkanPipelineState.CB.attachments[i].alphaBlend.Destination = ToStr::Get(p.attachments[i].alphaBlend.Destination);
|
||||
m_VulkanPipelineState.CB.attachments[i].alphaBlend.Operation = ToStr::Get(p.attachments[i].alphaBlend.Operation);
|
||||
|
||||
m_VulkanPipelineState.CB.attachments[i].writeMask = p.attachments[i].channelWriteMask;
|
||||
}
|
||||
|
||||
m_VulkanPipelineState.CB.state = state.dynamicCB;
|
||||
memcpy(m_VulkanPipelineState.CB.blendConst, c.m_Blend[state.dynamicCB].blendConst, sizeof(float)*4);
|
||||
|
||||
// Depth Stencil
|
||||
m_VulkanPipelineState.DS.depthTestEnable = p.depthTestEnable;
|
||||
m_VulkanPipelineState.DS.depthWriteEnable = p.depthWriteEnable;
|
||||
m_VulkanPipelineState.DS.depthBoundsEnable = p.depthBoundsEnable;
|
||||
m_VulkanPipelineState.DS.depthCompareOp = ToStr::Get(p.depthCompareOp);
|
||||
m_VulkanPipelineState.DS.stencilTestEnable = p.stencilTestEnable;
|
||||
|
||||
m_VulkanPipelineState.DS.front.passOp = ToStr::Get(p.front.stencilPassOp);
|
||||
m_VulkanPipelineState.DS.front.failOp = ToStr::Get(p.front.stencilFailOp);
|
||||
m_VulkanPipelineState.DS.front.depthFailOp = ToStr::Get(p.front.stencilDepthFailOp);
|
||||
m_VulkanPipelineState.DS.front.func = ToStr::Get(p.front.stencilCompareOp);
|
||||
|
||||
m_VulkanPipelineState.DS.back.passOp = ToStr::Get(p.back.stencilPassOp);
|
||||
m_VulkanPipelineState.DS.back.failOp = ToStr::Get(p.back.stencilFailOp);
|
||||
m_VulkanPipelineState.DS.back.depthFailOp = ToStr::Get(p.back.stencilDepthFailOp);
|
||||
m_VulkanPipelineState.DS.back.func = ToStr::Get(p.back.stencilCompareOp);
|
||||
|
||||
m_VulkanPipelineState.DS.state = state.dynamicDS;
|
||||
m_VulkanPipelineState.DS.minDepthBounds = c.m_DepthStencil[state.dynamicDS].minDepthBounds;
|
||||
m_VulkanPipelineState.DS.maxDepthBounds = c.m_DepthStencil[state.dynamicDS].maxDepthBounds;
|
||||
|
||||
m_VulkanPipelineState.DS.front.ref = c.m_DepthStencil[state.dynamicDS].stencilFrontRef;
|
||||
m_VulkanPipelineState.DS.back.ref = c.m_DepthStencil[state.dynamicDS].stencilBackRef;
|
||||
|
||||
m_VulkanPipelineState.DS.stencilReadMask = c.m_DepthStencil[state.dynamicDS].stencilReadMask;
|
||||
m_VulkanPipelineState.DS.stencilWriteMask = c.m_DepthStencil[state.dynamicDS].stencilWriteMask;
|
||||
|
||||
// Renderpass
|
||||
m_VulkanPipelineState.Pass.renderpass.obj = state.renderPass;
|
||||
m_VulkanPipelineState.Pass.framebuffer.obj = state.framebuffer;
|
||||
|
||||
m_VulkanPipelineState.Pass.framebuffer.width = c.m_Framebuffer[state.framebuffer].width;
|
||||
m_VulkanPipelineState.Pass.framebuffer.height = c.m_Framebuffer[state.framebuffer].height;
|
||||
m_VulkanPipelineState.Pass.framebuffer.layers = c.m_Framebuffer[state.framebuffer].layers;
|
||||
|
||||
create_array_uninit(m_VulkanPipelineState.Pass.framebuffer.attachments, c.m_Framebuffer[state.framebuffer].attachments.size());
|
||||
for(size_t i=0; i < c.m_Framebuffer[state.framebuffer].attachments.size(); i++)
|
||||
{
|
||||
m_VulkanPipelineState.Pass.framebuffer.attachments[i].view =
|
||||
c.m_Framebuffer[state.framebuffer].attachments[i].view;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -108,3 +108,21 @@ bool IsDepthStencilFormat(VkFormat f)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
ResourceFormat MakeResourceFormat(VkFormat fmt)
|
||||
{
|
||||
ResourceFormat ret;
|
||||
|
||||
ret.rawType = (uint32_t)fmt;
|
||||
ret.special = false;
|
||||
ret.specialFormat = eSpecial_Unknown;
|
||||
ret.strname = ToStr::Get(fmt).substr(10); // 3 == strlen("VK_FORMAT_")
|
||||
|
||||
|
||||
// VKTODOHIGH generate resource format
|
||||
ret.compByteWidth = 1;
|
||||
ret.compCount = 4;
|
||||
ret.compType = eCompType_UNorm;
|
||||
ret.srgbCorrected = false;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -237,3 +237,5 @@ enum DescriptorSlotType
|
||||
|
||||
bool IsBlockFormat(VkFormat f);
|
||||
bool IsDepthStencilFormat(VkFormat f);
|
||||
|
||||
ResourceFormat MakeResourceFormat(VkFormat fmt);
|
||||
|
||||
@@ -237,6 +237,7 @@
|
||||
<ClInclude Include="api\replay\renderdoc_replay.h" />
|
||||
<ClInclude Include="api\replay\replay_enums.h" />
|
||||
<ClInclude Include="api\replay\shader_types.h" />
|
||||
<ClInclude Include="api\replay\vk_pipestate.h" />
|
||||
<ClInclude Include="common\common.h" />
|
||||
<ClInclude Include="common\dds_readwrite.h" />
|
||||
<ClInclude Include="common\globalconfig.h" />
|
||||
|
||||
@@ -222,6 +222,9 @@
|
||||
<ClInclude Include="api\replay\capture_options.h">
|
||||
<Filter>API\Replay</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="api\replay\vk_pipestate.h">
|
||||
<Filter>API\Replay</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="maths\camera.cpp">
|
||||
|
||||
Reference in New Issue
Block a user