mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-29 21:30:53 +00:00
Fill out dynamic state with pipeline state values, if not set as dynamic
This commit is contained in:
@@ -308,8 +308,6 @@ private:
|
||||
}
|
||||
|
||||
// dynamic state
|
||||
// VKTODOHIGH this needs to come from the pipeline state
|
||||
// first, then get overridden by dynamic state.
|
||||
vector<VkViewport> views;
|
||||
vector<VkRect2D> scissors;
|
||||
float lineWidth;
|
||||
|
||||
@@ -65,12 +65,29 @@ void VulkanCreationInfo::Pipeline::Init(const VkGraphicsPipelineCreateInfo* pCre
|
||||
|
||||
viewportCount = pCreateInfo->pViewportState->viewportCount;
|
||||
|
||||
viewports.resize(viewportCount);
|
||||
scissors.resize(viewportCount);
|
||||
|
||||
for(size_t i=0; i < viewports.size(); i++)
|
||||
{
|
||||
if(pCreateInfo->pViewportState->pViewports)
|
||||
viewports[i] = pCreateInfo->pViewportState->pViewports[i];
|
||||
|
||||
if(pCreateInfo->pViewportState->pScissors)
|
||||
scissors[i] = pCreateInfo->pViewportState->pScissors[i];
|
||||
}
|
||||
|
||||
// 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;
|
||||
depthBiasEnable = pCreateInfo->pRasterState->depthBiasEnable ? true : false;
|
||||
depthBias = pCreateInfo->pRasterState->depthBias;
|
||||
depthBiasClamp = pCreateInfo->pRasterState->depthBiasClamp;
|
||||
slopeScaledDepthBias = pCreateInfo->pRasterState->slopeScaledDepthBias;
|
||||
lineWidth = pCreateInfo->pRasterState->lineWidth;
|
||||
|
||||
// VkPipelineMultisampleStateCreateInfo
|
||||
rasterSamples = pCreateInfo->pMultisampleState->rasterSamples;
|
||||
@@ -86,11 +103,15 @@ void VulkanCreationInfo::Pipeline::Init(const VkGraphicsPipelineCreateInfo* pCre
|
||||
stencilTestEnable = pCreateInfo->pDepthStencilState->stencilTestEnable ? true : false;
|
||||
front = pCreateInfo->pDepthStencilState->front;
|
||||
back = pCreateInfo->pDepthStencilState->back;
|
||||
minDepthBounds = pCreateInfo->pDepthStencilState->minDepthBounds;
|
||||
maxDepthBounds = pCreateInfo->pDepthStencilState->maxDepthBounds;
|
||||
|
||||
// VkPipelineColorBlendStateCreateInfo
|
||||
alphaToCoverageEnable = pCreateInfo->pColorBlendState->alphaToCoverageEnable ? true : false;
|
||||
alphaToOneEnable = pCreateInfo->pColorBlendState->alphaToOneEnable ? true : false;
|
||||
logicOpEnable = pCreateInfo->pColorBlendState->logicOpEnable ? true : false;
|
||||
logicOp = pCreateInfo->pColorBlendState->logicOp;
|
||||
memcpy(blendConst, pCreateInfo->pColorBlendState->blendConst, sizeof(blendConst));
|
||||
|
||||
attachments.resize(pCreateInfo->pColorBlendState->attachmentCount);
|
||||
|
||||
@@ -108,6 +129,13 @@ void VulkanCreationInfo::Pipeline::Init(const VkGraphicsPipelineCreateInfo* pCre
|
||||
|
||||
attachments[i].channelWriteMask = pCreateInfo->pColorBlendState->pAttachments[i].channelWriteMask;
|
||||
}
|
||||
|
||||
RDCEraseEl(dynamicStates);
|
||||
if(pCreateInfo->pDynamicState)
|
||||
{
|
||||
for(uint32_t i=0; i < pCreateInfo->pDynamicState->dynamicStateCount; i++)
|
||||
dynamicStates[ pCreateInfo->pDynamicState->pDynamicStates[i] ] = true;
|
||||
}
|
||||
}
|
||||
|
||||
void VulkanCreationInfo::Pipeline::Init(const VkComputePipelineCreateInfo* pCreateInfo)
|
||||
|
||||
@@ -67,6 +67,8 @@ struct VulkanCreationInfo
|
||||
|
||||
// VkPipelineViewportStateCreateInfo
|
||||
uint32_t viewportCount;
|
||||
vector<VkViewport> viewports;
|
||||
vector<VkRect2D> scissors;
|
||||
|
||||
// VkPipelineRasterStateCreateInfo
|
||||
bool depthClipEnable;
|
||||
@@ -74,6 +76,11 @@ struct VulkanCreationInfo
|
||||
VkFillMode fillMode;
|
||||
VkCullMode cullMode;
|
||||
VkFrontFace frontFace;
|
||||
bool depthBiasEnable;
|
||||
float depthBias;
|
||||
float depthBiasClamp;
|
||||
float slopeScaledDepthBias;
|
||||
float lineWidth;
|
||||
|
||||
// VkPipelineMultisampleStateCreateInfo
|
||||
uint32_t rasterSamples;
|
||||
@@ -89,11 +96,15 @@ struct VulkanCreationInfo
|
||||
bool stencilTestEnable;
|
||||
VkStencilOpState front;
|
||||
VkStencilOpState back;
|
||||
float minDepthBounds;
|
||||
float maxDepthBounds;
|
||||
|
||||
// VkPipelineColorBlendStateCreateInfo
|
||||
bool alphaToCoverageEnable;
|
||||
bool alphaToOneEnable;
|
||||
bool logicOpEnable;
|
||||
VkLogicOp logicOp;
|
||||
float blendConst[4];
|
||||
|
||||
struct Attachment
|
||||
{
|
||||
@@ -109,6 +120,9 @@ struct VulkanCreationInfo
|
||||
uint8_t channelWriteMask;
|
||||
};
|
||||
vector<Attachment> attachments;
|
||||
|
||||
// VkPipelineDynamicStateCreateInfo
|
||||
bool dynamicStates[VK_DYNAMIC_STATE_NUM];
|
||||
};
|
||||
map<ResourceId, Pipeline> m_Pipeline;
|
||||
|
||||
|
||||
@@ -771,6 +771,49 @@ bool WrappedVulkan::Serialise_vkCmdBindPipeline(
|
||||
m_PartialReplayData.state.graphics.pipeline = pipeid;
|
||||
else
|
||||
m_PartialReplayData.state.compute.pipeline = pipeid;
|
||||
|
||||
if(!m_CreationInfo.m_Pipeline[pipeid].dynamicStates[VK_DYNAMIC_STATE_VIEWPORT])
|
||||
{
|
||||
m_PartialReplayData.state.views = m_CreationInfo.m_Pipeline[pipeid].viewports;
|
||||
}
|
||||
if(!m_CreationInfo.m_Pipeline[pipeid].dynamicStates[VK_DYNAMIC_STATE_SCISSOR])
|
||||
{
|
||||
m_PartialReplayData.state.scissors = m_CreationInfo.m_Pipeline[pipeid].scissors;
|
||||
}
|
||||
if(!m_CreationInfo.m_Pipeline[pipeid].dynamicStates[VK_DYNAMIC_STATE_LINE_WIDTH])
|
||||
{
|
||||
m_PartialReplayData.state.lineWidth = m_CreationInfo.m_Pipeline[pipeid].lineWidth;
|
||||
}
|
||||
if(!m_CreationInfo.m_Pipeline[pipeid].dynamicStates[VK_DYNAMIC_STATE_DEPTH_BIAS])
|
||||
{
|
||||
m_PartialReplayData.state.bias.depth = m_CreationInfo.m_Pipeline[pipeid].depthBias;
|
||||
m_PartialReplayData.state.bias.biasclamp = m_CreationInfo.m_Pipeline[pipeid].depthBiasClamp;
|
||||
m_PartialReplayData.state.bias.slope = m_CreationInfo.m_Pipeline[pipeid].slopeScaledDepthBias;
|
||||
}
|
||||
if(!m_CreationInfo.m_Pipeline[pipeid].dynamicStates[VK_DYNAMIC_STATE_BLEND_CONSTANTS])
|
||||
{
|
||||
memcpy(m_PartialReplayData.state.blendConst, m_CreationInfo.m_Pipeline[pipeid].blendConst, sizeof(float)*4);
|
||||
}
|
||||
if(!m_CreationInfo.m_Pipeline[pipeid].dynamicStates[VK_DYNAMIC_STATE_DEPTH_BOUNDS])
|
||||
{
|
||||
m_PartialReplayData.state.mindepth = m_CreationInfo.m_Pipeline[pipeid].minDepthBounds;
|
||||
m_PartialReplayData.state.maxdepth = m_CreationInfo.m_Pipeline[pipeid].maxDepthBounds;
|
||||
}
|
||||
if(!m_CreationInfo.m_Pipeline[pipeid].dynamicStates[VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK])
|
||||
{
|
||||
m_PartialReplayData.state.front.compare = m_CreationInfo.m_Pipeline[pipeid].front.stencilCompareMask;
|
||||
m_PartialReplayData.state.back.compare = m_CreationInfo.m_Pipeline[pipeid].back.stencilCompareMask;
|
||||
}
|
||||
if(!m_CreationInfo.m_Pipeline[pipeid].dynamicStates[VK_DYNAMIC_STATE_STENCIL_WRITE_MASK])
|
||||
{
|
||||
m_PartialReplayData.state.front.write = m_CreationInfo.m_Pipeline[pipeid].front.stencilWriteMask;
|
||||
m_PartialReplayData.state.back.write = m_CreationInfo.m_Pipeline[pipeid].back.stencilWriteMask;
|
||||
}
|
||||
if(!m_CreationInfo.m_Pipeline[pipeid].dynamicStates[VK_DYNAMIC_STATE_STENCIL_REFERENCE])
|
||||
{
|
||||
m_PartialReplayData.state.front.ref = m_CreationInfo.m_Pipeline[pipeid].front.stencilReference;
|
||||
m_PartialReplayData.state.back.ref = m_CreationInfo.m_Pipeline[pipeid].back.stencilReference;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(m_State == READING)
|
||||
|
||||
Reference in New Issue
Block a user