Skip to content

Commit

Permalink
More asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Jan 24, 2024
1 parent 1797764 commit 22e91c9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
8 changes: 8 additions & 0 deletions Common/GPU/Vulkan/VulkanRenderManager.cpp
Expand Up @@ -422,6 +422,14 @@ void VulkanRenderManager::DestroyBackbuffers() {
queueRunner_.DestroyBackBuffers();
}

void VulkanRenderManager::CheckNothingPending() {
_assert_(pipelinesToCheck_.empty());
{
std::unique_lock<std::mutex> lock(compileMutex_);
_assert_(compileQueue_.empty());
}
}

VulkanRenderManager::~VulkanRenderManager() {
INFO_LOG(G3D, "VulkanRenderManager destructor");

Expand Down
4 changes: 2 additions & 2 deletions Common/GPU/Vulkan/VulkanRenderManager.h
Expand Up @@ -115,13 +115,12 @@ class VKRGraphicsPipelineDesc : public Draw::RefCountedObject {
RPKey rpKey{};
};

// Wrapped pipeline. Doesn't own desc.
// Wrapped pipeline. Does own desc!
struct VKRGraphicsPipeline {
VKRGraphicsPipeline(PipelineFlags flags, const char *tag) : flags_(flags), tag_(tag) {}
~VKRGraphicsPipeline();

bool Create(VulkanContext *vulkan, VkRenderPass compatibleRenderPass, RenderPassType rpType, VkSampleCountFlagBits sampleCount, double scheduleTime, int countToCompile);

void DestroyVariants(VulkanContext *vulkan, bool msaaOnly);

// This deletes the whole VKRGraphicsPipeline, you must remove your last pointer to it when doing this.
Expand Down Expand Up @@ -237,6 +236,7 @@ class VulkanRenderManager {
// These can run on a different thread!
void Finish();
void Present();
void CheckNothingPending();

void SetInvalidationCallback(InvalidationCallback callback) {
invalidationCallback_ = callback;
Expand Down
1 change: 1 addition & 0 deletions GPU/Vulkan/GPU_Vulkan.cpp
Expand Up @@ -169,6 +169,7 @@ GPU_Vulkan::~GPU_Vulkan() {
VulkanRenderManager *rm = (VulkanRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
// This now also does a hard sync with the render thread, so that we can safely delete our pipeline layout below.
rm->StopThreads();
rm->CheckNothingPending();
}

SaveCache(shaderCachePath_);
Expand Down
1 change: 1 addition & 0 deletions android/src/org/ppsspp/ppsspp/NativeActivity.java
Expand Up @@ -820,6 +820,7 @@ protected void onDestroy() {
if (isVRDevice()) {
System.exit(0);
}
Log.i(TAG, "onDestroy");
}

@Override
Expand Down

0 comments on commit 22e91c9

Please sign in to comment.