From 88276b569fbf01745e12542831e0bb6db0ae14b4 Mon Sep 17 00:00:00 2001 From: Larry Gritz Date: Sun, 18 Aug 2024 04:57:52 -0700 Subject: [PATCH] Adjust to OIIO change to IC/TS API (#1850) Didn't catch them all in #1848 -- missed the BatchedRendererServices side. Signed-off-by: Larry Gritz --- src/liboslexec/batched_rendservices.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/liboslexec/batched_rendservices.cpp b/src/liboslexec/batched_rendservices.cpp index fbff377b2..878d02f3f 100644 --- a/src/liboslexec/batched_rendservices.cpp +++ b/src/liboslexec/batched_rendservices.cpp @@ -14,6 +14,15 @@ using namespace OSL::pvt; OSL_NAMESPACE_ENTER +#ifdef OIIO_TEXTURESYSTEM_CREATE_SHARED +namespace { +std::mutex shared_texturesys_mutex; +std::shared_ptr shared_texturesys; +} // namespace +#endif + + + template BatchedRendererServices::BatchedRendererServices(TextureSystem* texsys) : m_texturesys(texsys) @@ -27,7 +36,17 @@ BatchedRendererServices::BatchedRendererServices(TextureSystem* texsys) OSL_ASSERT( 0 && "RendererServices was not passed a working TextureSystem*"); #else +# ifdef OIIO_TEXTURESYSTEM_CREATE_SHARED + { + std::lock_guard lock(shared_texturesys_mutex); + if (!shared_texturesys) { + shared_texturesys = TextureSystem::create(true /* shared */); + } + m_texturesys = shared_texturesys.get(); + } +# else m_texturesys = TextureSystem::create(true /* shared */); +# endif // Make some good guesses about default options m_texturesys->attribute("automip", 1); m_texturesys->attribute("autotile", 64);