Add a couple of asserts (to make things error out earlier)

This commit is contained in:
Henrik Rydgård 2024-10-17 21:01:58 +02:00
parent 649d28e34e
commit 858f37b8fc
4 changed files with 15 additions and 1 deletions

View file

@ -290,6 +290,10 @@ public:
compileMutex_.unlock();
}
void AssertInRenderPass() const {
_dbg_assert_(curRenderStep_ && curRenderStep_->stepType == VKRStepType::RENDER);
}
// This is the first call in a draw operation. Instead of asserting like we used to, you can now check the
// return value and skip the draw if we're in a bad state. In that case, call ReportBadState.
// The old assert wasn't very helpful in figuring out what caused it anyway...

View file

@ -984,7 +984,7 @@ namespace SaveState
break;
case SAVESTATE_SAVE:
INFO_LOG(Log::SaveState, "Saving state to %s", op.filename.c_str());
INFO_LOG(Log::SaveState, "Saving state to '%s'", op.filename.c_str());
title = g_paramSFO.GetValueString("TITLE");
if (title.empty()) {
// Homebrew title

View file

@ -147,6 +147,10 @@ public:
virtual void ClearTrackedVertexArrays() {}
void AssertEmpty() {
_dbg_assert_(numDrawVerts_ == 0 && numDrawInds_ == 0);
}
protected:
virtual bool UpdateUseHWTessellation(bool enabled) const { return enabled; }
void UpdatePlanes();

View file

@ -174,11 +174,15 @@ void DrawEngineVulkan::BeginFrame() {
tessDataTransferVulkan->SetPushPool(pushUBO_);
DirtyAllUBOs();
AssertEmpty();
}
void DrawEngineVulkan::EndFrame() {
stats_.pushVertexSpaceUsed = (int)pushVertex_->GetUsedThisFrame();
stats_.pushIndexSpaceUsed = (int)pushIndex_->GetUsedThisFrame();
AssertEmpty();
}
void DrawEngineVulkan::DirtyAllUBOs() {
@ -212,6 +216,8 @@ void DrawEngineVulkan::Invalidate(InvalidationCallbackFlags flags) {
void DrawEngineVulkan::DoFlush() {
VulkanRenderManager *renderManager = (VulkanRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
renderManager->AssertInRenderPass();
PROFILE_THIS_SCOPE("Flush");
bool tess = gstate_c.submitType == SubmitType::HW_BEZIER || gstate_c.submitType == SubmitType::HW_SPLINE;