mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Support push constants, store in pipeline state & restore replaying draw
This commit is contained in:
@@ -33,7 +33,6 @@ On capture:
|
||||
* Unsupported or untested features:
|
||||
* Subpasses
|
||||
* Nested command buffer execution
|
||||
* Push constants
|
||||
* GPU-GPU synchronisation with events.
|
||||
* Sparse resources
|
||||
|
||||
|
||||
@@ -1770,6 +1770,12 @@ void WrappedVulkan::ReplayLog(uint32_t frameID, uint32_t startEventID, uint32_t
|
||||
ResourceId pipeLayoutId = m_CreationInfo.m_Pipeline[s.graphics.pipeline].layout;
|
||||
VkPipelineLayout layout = GetResourceManager()->GetCurrentHandle<VkPipelineLayout>(pipeLayoutId);
|
||||
|
||||
const vector<VulkanCreationInfo::PipelineLayout::PushConstantRange> &pushRanges = m_CreationInfo.m_PipelineLayout[pipeLayoutId].pushRanges;
|
||||
|
||||
// only set push constant ranges that the layout uses
|
||||
for(size_t i=0; i < pushRanges.size(); i++)
|
||||
ObjDisp(cmd)->CmdPushConstants(Unwrap(cmd), Unwrap(layout), pushRanges[i].stages, pushRanges[i].start, pushRanges[i].length, s.pushconsts+pushRanges[i].start);
|
||||
|
||||
const vector<ResourceId> &descSetLayouts = m_CreationInfo.m_PipelineLayout[pipeLayoutId].descSetLayouts;
|
||||
|
||||
// only iterate over the desc sets that this layout actually uses, not all that were bound
|
||||
|
||||
@@ -334,6 +334,9 @@ private:
|
||||
float mindepth, maxdepth;
|
||||
struct { uint32_t compare, write, ref; } front, back;
|
||||
|
||||
// this should be big enough for any implementation
|
||||
byte pushconsts[1024];
|
||||
|
||||
ResourceId renderPass;
|
||||
ResourceId framebuffer;
|
||||
VkRect2D renderArea;
|
||||
|
||||
@@ -229,6 +229,15 @@ void VulkanCreationInfo::PipelineLayout::Init(VulkanResourceManager *resourceMan
|
||||
descSetLayouts.resize(pCreateInfo->descriptorSetCount);
|
||||
for(uint32_t i=0; i < pCreateInfo->descriptorSetCount; i++)
|
||||
descSetLayouts[i] = resourceMan->GetNonDispWrapper(pCreateInfo->pSetLayouts[i])->id;
|
||||
|
||||
pushRanges.resize(pCreateInfo->pushConstantRangeCount);
|
||||
for(uint32_t i=0; i < pCreateInfo->pushConstantRangeCount; i++)
|
||||
{
|
||||
PushConstantRange &range = pushRanges[i];
|
||||
range.start = pCreateInfo->pPushConstantRanges[i].start;
|
||||
range.length = pCreateInfo->pPushConstantRanges[i].length;
|
||||
range.stages = pCreateInfo->pPushConstantRanges[i].stageFlags;
|
||||
}
|
||||
}
|
||||
|
||||
void VulkanCreationInfo::RenderPass::Init(VulkanResourceManager *resourceMan, const VkRenderPassCreateInfo* pCreateInfo)
|
||||
|
||||
@@ -156,6 +156,14 @@ struct VulkanCreationInfo
|
||||
{
|
||||
void Init(VulkanResourceManager *resourceMan, const VkPipelineLayoutCreateInfo* pCreateInfo);
|
||||
|
||||
struct PushConstantRange
|
||||
{
|
||||
uint32_t start;
|
||||
uint32_t length;
|
||||
VkShaderStageFlags stages;
|
||||
};
|
||||
vector<PushConstantRange> pushRanges;
|
||||
|
||||
vector<ResourceId> descSetLayouts;
|
||||
};
|
||||
map<ResourceId, PipelineLayout> m_PipelineLayout;
|
||||
|
||||
@@ -1500,7 +1500,9 @@ bool WrappedVulkan::Serialise_vkCmdPushConstants(
|
||||
cmdBuffer = PartialCmdBuf();
|
||||
ObjDisp(cmdBuffer)->CmdPushConstants(Unwrap(cmdBuffer), Unwrap(layout), flags, s, len, vals);
|
||||
|
||||
// VKTODOMED update pipeline state
|
||||
RDCASSERT(s+len < (uint32_t)ARRAY_COUNT(m_PartialReplayData.state.pushconsts));
|
||||
|
||||
memcpy(m_PartialReplayData.state.pushconsts + s, vals, len);
|
||||
}
|
||||
}
|
||||
else if(m_State == READING)
|
||||
@@ -1510,7 +1512,8 @@ bool WrappedVulkan::Serialise_vkCmdPushConstants(
|
||||
ObjDisp(cmdBuffer)->CmdPushConstants(Unwrap(cmdBuffer), Unwrap(layout), flags, s, len, vals);
|
||||
}
|
||||
|
||||
SAFE_DELETE_ARRAY(vals);
|
||||
if(m_State < WRITING)
|
||||
SAFE_DELETE_ARRAY(vals);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user