add texture tagging in the FrameGraph

Also tag user texture "FTexture" if user doesn't provide a tag, this
is so that we can distinguish them from internal textures that might
not be tagged.
This commit is contained in:
Mathias Agopian
2024-08-30 16:24:25 -07:00
committed by Mathias Agopian
parent 2bbbb7f4d1
commit 2aa51db614
3 changed files with 11 additions and 10 deletions
+5 -2
View File
@@ -143,12 +143,14 @@ void ResourceAllocator::terminate() noexcept {
}
}
RenderTargetHandle ResourceAllocator::createRenderTarget(const char*,
RenderTargetHandle ResourceAllocator::createRenderTarget(const char* name,
TargetBufferFlags targetBufferFlags, uint32_t width, uint32_t height,
uint8_t samples, uint8_t layerCount, MRT color, TargetBufferInfo depth,
TargetBufferInfo stencil) noexcept {
return mBackend.createRenderTarget(targetBufferFlags,
auto handle = mBackend.createRenderTarget(targetBufferFlags,
width, height, samples ? samples : 1u, layerCount, color, depth, stencil);
mBackend.setDebugTag(handle.getId(), CString{ name });
return handle;
}
void ResourceAllocator::destroyRenderTarget(RenderTargetHandle h) noexcept {
@@ -201,6 +203,7 @@ backend::TextureHandle ResourceAllocator::createTexture(const char* name,
}
}
mDisposer->checkout(handle, key);
mBackend.setDebugTag(handle.getId(), CString{ name });
return handle;
}
+2
View File
@@ -245,6 +245,8 @@ FTexture::FTexture(FEngine& engine, const Builder& builder) {
}
if (auto name = builder.getName(); !name.empty()) {
driver.setDebugTag(mHandle.getId(), std::move(name));
} else {
driver.setDebugTag(mHandle.getId(), CString{"FTexture"});
}
}
+4 -8
View File
@@ -1040,10 +1040,8 @@ void FView::commitFrameHistory(FEngine& engine) noexcept {
auto& frameHistory = mFrameHistory;
FrameHistoryEntry& last = frameHistory.back();
disposer.destroy(last.taa.color.handle);
disposer.destroy(last.ssr.color.handle);
last.taa.color.handle.clear();
last.ssr.color.handle.clear();
disposer.destroy(std::move(last.taa.color.handle));
disposer.destroy(std::move(last.ssr.color.handle));
// and then push the new history entry to the history stack
frameHistory.commit();
@@ -1055,10 +1053,8 @@ void FView::clearFrameHistory(FEngine& engine) noexcept {
auto& frameHistory = mFrameHistory;
for (size_t i = 0; i < frameHistory.size(); ++i) {
FrameHistoryEntry& last = frameHistory[i];
disposer.destroy(last.taa.color.handle);
disposer.destroy(last.ssr.color.handle);
last.taa.color.handle.clear();
last.ssr.color.handle.clear();
disposer.destroy(std::move(last.taa.color.handle));
disposer.destroy(std::move(last.ssr.color.handle));
}
}