diff options
author | Patrick Mours <pmours@nvidia.com> | 2022-06-01 16:26:55 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-06-03 19:56:30 +0300 |
commit | 34f94a02f37005210f629f04635c457d98ff5f91 (patch) | |
tree | 4339231acf82070c1e8c6f1c71f52640eb069dd8 /intern/cycles/hydra/render_buffer.h | |
parent | 7f7ed8e0989d3c6a3078404567e7da419d6f92f5 (diff) |
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
Diffstat (limited to 'intern/cycles/hydra/render_buffer.h')
-rw-r--r-- | intern/cycles/hydra/render_buffer.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/intern/cycles/hydra/render_buffer.h b/intern/cycles/hydra/render_buffer.h index 8eb874f0068..90629d4aee0 100644 --- a/intern/cycles/hydra/render_buffer.h +++ b/intern/cycles/hydra/render_buffer.h @@ -58,6 +58,8 @@ class HdCyclesRenderBuffer final : public PXR_NS::HdRenderBuffer { void SetConverged(bool converged); + bool IsResourceUsed() const; + PXR_NS::VtValue GetResource(bool multiSampled = false) const override; void SetResource(const PXR_NS::VtValue &resource); @@ -74,9 +76,11 @@ class HdCyclesRenderBuffer final : public PXR_NS::HdRenderBuffer { unsigned int _width = 0u; unsigned int _height = 0u; PXR_NS::HdFormat _format = PXR_NS::HdFormatInvalid; + size_t _dataSize = 0; std::vector<uint8_t> _data; PXR_NS::VtValue _resource; + mutable std::atomic_bool _resourceUsed = false; std::atomic_int _mapped = 0; std::atomic_bool _converged = false; |