From 34f94a02f37005210f629f04635c457d98ff5f91 Mon Sep 17 00:00:00 2001 From: Patrick Mours Date: Wed, 1 Jun 2022 15:26:55 +0200 Subject: Fix use of OpenGL interop breaking in Hydra viewports that do not support it Rendering directly to a resource using OpenGL interop and Hgi doesn't work in Houdini, since it never uses the resulting resource (it does not call `HdRenderBuffer::GetResource`). But since doing that simultaneously disables mapping (`HdRenderBuffer::Map` is not implemented then), nothing was displayed. To fix this, keep track of whether a Hydra viewport does support displaying a Hgi resource directly, by checking whether `HdRenderBuffer::GetResource` is ever called and only enable use of OpenGL interop if that is the case. Differential Revision: https://developer.blender.org/D15090 --- intern/cycles/hydra/display_driver.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'intern/cycles/hydra/display_driver.h') diff --git a/intern/cycles/hydra/display_driver.h b/intern/cycles/hydra/display_driver.h index 20086830e6a..2a05397c325 100644 --- a/intern/cycles/hydra/display_driver.h +++ b/intern/cycles/hydra/display_driver.h @@ -19,9 +19,6 @@ class HdCyclesDisplayDriver final : public CCL_NS::DisplayDriver { ~HdCyclesDisplayDriver(); private: - void init(); - void deinit(); - void next_tile_begin() override; bool update_begin(const Params ¶ms, int texture_width, int texture_height) override; @@ -41,6 +38,11 @@ class HdCyclesDisplayDriver final : public CCL_NS::DisplayDriver { void draw(const Params ¶ms) override; + void gl_context_create(); + bool gl_context_enable(); + void gl_context_disable(); + void gl_context_dispose(); + HdCyclesSession *const _renderParam; Hgi *const _hgi; @@ -48,7 +50,6 @@ class HdCyclesDisplayDriver final : public CCL_NS::DisplayDriver { void *hdc_ = nullptr; void *gl_context_ = nullptr; #endif - CCL_NS::thread_mutex mutex_; PXR_NS::HgiTextureHandle texture_; -- cgit v1.2.3