Skip to content

Commit 9f4aa5e

Browse files
authored
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 <lg@larrygritz.com>
1 parent 5ee978d commit 9f4aa5e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/liboslexec/batched_rendservices.cpp

+19
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ using namespace OSL::pvt;
1414
OSL_NAMESPACE_ENTER
1515

1616

17+
#ifdef OIIO_TEXTURESYSTEM_CREATE_SHARED
18+
namespace {
19+
std::mutex shared_texturesys_mutex;
20+
std::shared_ptr<TextureSystem> shared_texturesys;
21+
} // namespace
22+
#endif
23+
24+
25+
1726
template<int WidthT>
1827
BatchedRendererServices<WidthT>::BatchedRendererServices(TextureSystem* texsys)
1928
: m_texturesys(texsys)
@@ -27,7 +36,17 @@ BatchedRendererServices<WidthT>::BatchedRendererServices(TextureSystem* texsys)
2736
OSL_ASSERT(
2837
0 && "RendererServices was not passed a working TextureSystem*");
2938
#else
39+
# ifdef OIIO_TEXTURESYSTEM_CREATE_SHARED
40+
{
41+
std::lock_guard<std::mutex> lock(shared_texturesys_mutex);
42+
if (!shared_texturesys) {
43+
shared_texturesys = TextureSystem::create(true /* shared */);
44+
}
45+
m_texturesys = shared_texturesys.get();
46+
}
47+
# else
3048
m_texturesys = TextureSystem::create(true /* shared */);
49+
# endif
3150
// Make some good guesses about default options
3251
m_texturesys->attribute("automip", 1);
3352
m_texturesys->attribute("autotile", 64);

0 commit comments

Comments
 (0)