Vulkan: Ensure rendering ends when deleting attached framebuffer
When a frame buffer that is attached is being deleted the rendering end event will never happen which leads to inconsistent render graphs.
This commit is contained in:
@@ -215,7 +215,9 @@ void VKContext::deactivate_framebuffer()
|
||||
{
|
||||
VKFrameBuffer *framebuffer = active_framebuffer_get();
|
||||
BLI_assert(framebuffer != nullptr);
|
||||
framebuffer->rendering_end(*this);
|
||||
if (framebuffer->is_rendering()) {
|
||||
framebuffer->rendering_end(*this);
|
||||
}
|
||||
active_fb = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,14 @@ VKFrameBuffer::VKFrameBuffer(const char *name)
|
||||
enabled_srgb_ = false;
|
||||
}
|
||||
|
||||
VKFrameBuffer::~VKFrameBuffer()
|
||||
{
|
||||
VKContext &context = *VKContext::get();
|
||||
if (context.active_framebuffer_get() == this) {
|
||||
context.deactivate_framebuffer();
|
||||
}
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
void VKFrameBuffer::bind(bool enabled_srgb)
|
||||
|
||||
@@ -44,6 +44,7 @@ class VKFrameBuffer : public FrameBuffer {
|
||||
* Create a conventional frame-buffer to attach texture to.
|
||||
*/
|
||||
VKFrameBuffer(const char *name);
|
||||
virtual ~VKFrameBuffer();
|
||||
|
||||
void bind(bool enabled_srgb) override;
|
||||
bool check(char err_out[256]) override;
|
||||
|
||||
Reference in New Issue
Block a user