File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,15 @@ using namespace OSL::pvt;
1414OSL_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+
1726template <int WidthT>
1827BatchedRendererServices<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 );
You can’t perform that action at this time.
0 commit comments