Skip to content

Commit

Permalink
Add support for binding shader object state in replay.
Browse files Browse the repository at this point in the history
Co-authored-by: James Sumihiro <james.sumihiro@ntd.nintendo.com>
  • Loading branch information
2 people authored and baldurk committed May 22, 2024
1 parent 4725b73 commit 0dcd19c
Show file tree
Hide file tree
Showing 7 changed files with 513 additions and 336 deletions.
3 changes: 3 additions & 0 deletions renderdoc/api/replay/vk_pipestate.h
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,9 @@ and size into specializationData can be obtained from the reflection info.
:type: List[int]
)")
rdcarray<uint32_t> specializationIds;

DOCUMENT("Whether the shader is a shader object or shader module.");
bool shaderObject = false;
};

DOCUMENT("Describes the state of the fixed-function tessellator.");
Expand Down
21 changes: 19 additions & 2 deletions renderdoc/driver/vulkan/vk_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4303,7 +4303,19 @@ void WrappedVulkan::ReplayLog(uint32_t startEventID, uint32_t endEventID, Replay
else
{
// even outside of render passes, we need to restore the state
m_RenderState.BindPipeline(this, cmd, VulkanRenderState::BindInitial, false);
if(m_RenderState.compute.shaderObject || m_RenderState.graphics.shaderObject)
{
m_RenderState.BindShaderObjects(this, cmd, VulkanRenderState::BindInitial);

if(m_RenderState.compute.pipeline != ResourceId())
m_RenderState.BindPipeline(this, cmd, VulkanRenderState::BindCompute, false);
if(m_RenderState.graphics.pipeline != ResourceId())
m_RenderState.BindPipeline(this, cmd, VulkanRenderState::BindGraphics, false);
}
else
{
m_RenderState.BindPipeline(this, cmd, VulkanRenderState::BindInitial, false);
}
}

m_RenderState.subpassContents = subpassContents;
Expand Down Expand Up @@ -5169,7 +5181,12 @@ void WrappedVulkan::AddUsage(VulkanActionTreeNode &actionNode, rdcarray<DebugMes
{
bool compute = (shad == 5);
ResourceId pipe = (compute ? state.compute.pipeline : state.graphics.pipeline);
VulkanCreationInfo::ShaderEntry &sh = c.m_Pipeline[pipe].shaders[shad];

bool shaderObject = (compute ? state.compute.shaderObject : state.graphics.shaderObject);

VulkanCreationInfo::ShaderEntry &sh = shaderObject
? c.m_ShaderObject[state.shaderObjects[shad]].shad
: c.m_Pipeline[pipe].shaders[shad];
if(sh.module == ResourceId())
continue;

Expand Down
1 change: 1 addition & 0 deletions renderdoc/driver/vulkan/vk_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -1348,6 +1348,7 @@ class WrappedVulkan : public IFrameCapturer
bool MeshShaders() const { return m_MeshShaders; }
bool ListRestart() const { return m_ListRestart; }
bool AccelerationStructures() const { return m_AccelerationStructures; }
bool ShaderObject() const { return m_ShaderObject; }
VulkanRenderState &GetRenderState() { return m_RenderState; }
void SetActionCB(VulkanActionCallback *cb) { m_ActionCallback = cb; }
void SetSubmitChain(void *submitChain) { m_SubmitChain = submitChain; }
Expand Down
Loading

0 comments on commit 0dcd19c

Please sign in to comment.