Add callback for when non-Maxwell3D engines alter pipeline state

This is required so that Maxwell3D knows to restore all dynamic state before the next draw
This commit is contained in:
Billy Laws 2022-09-29 20:46:42 +01:00
parent 7133c5d6b3
commit d42814bdc1
4 changed files with 26 additions and 0 deletions

View File

@ -356,6 +356,15 @@ namespace skyline::gpu::interconnect {
flushCallbacks.emplace_back(std::forward<decltype(callback)>(callback));
}
void CommandExecutor::AddPipelineChangeCallback(std::function<void()> &&callback) {
pipelineChangeCallbacks.emplace_back(std::forward<decltype(callback)>(callback));
}
void CommandExecutor::NotifyPipelineChange() {
for (auto &callback : pipelineChangeCallbacks)
callback();
}
void CommandExecutor::SubmitInternal() {
if (renderPass)
FinishRenderPass();

View File

@ -122,6 +122,7 @@ namespace skyline::gpu::interconnect {
TextureView *lastSubpassDepthStencilAttachment{}; //!< The depth stencil attachment used in the last subpass
std::vector<std::function<void()>> flushCallbacks; //!< Set of persistent callbacks that will be called at the start of Execute in order to flush data required for recording
std::vector<std::function<void()>> pipelineChangeCallbacks; //!< Set of persistent callbacks that will be called after any non-Maxwell 3D engine changes the active pipeline
void RotateRecordSlot();
@ -243,6 +244,16 @@ namespace skyline::gpu::interconnect {
*/
void AddFlushCallback(std::function<void()> &&callback);
/**
* @brief Adds a persistent callback that will be called after any non-Maxwell 3D engine changes the active pipeline
*/
void AddPipelineChangeCallback(std::function<void()> &&callback);
/**
* @brief Calls all registered pipeline change callbacks
*/
void NotifyPipelineChange();
/**
* @brief Execute all the nodes and submit the resulting command buffer to the GPU
*/

View File

@ -147,6 +147,8 @@ namespace skyline::gpu::interconnect {
executor.AddSubpass(std::move(executionCallback), {{static_cast<i32>(dstRectX), static_cast<i32>(dstRectY)}, {dstRectWidth, dstRectHeight} }, {}, {dst});
}
);
executor.NotifyPipelineChange();
}
}

View File

@ -28,6 +28,10 @@ namespace skyline::gpu::interconnect::maxwell3d {
constantBuffers.MarkAllDirty();
samplers.MarkAllDirty();
});
executor.AddPipelineChangeCallback([this] {
activeState.MarkAllDirty();
});
}
vk::Rect2D Maxwell3D::GetClearScissor() {