File tree 1 file changed +19
-0
lines changed
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;
14
14
OSL_NAMESPACE_ENTER
15
15
16
16
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
+
17
26
template <int WidthT>
18
27
BatchedRendererServices<WidthT>::BatchedRendererServices(TextureSystem* texsys)
19
28
: m_texturesys(texsys)
@@ -27,7 +36,17 @@ BatchedRendererServices<WidthT>::BatchedRendererServices(TextureSystem* texsys)
27
36
OSL_ASSERT (
28
37
0 && " RendererServices was not passed a working TextureSystem*" );
29
38
#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
30
48
m_texturesys = TextureSystem::create (true /* shared */ );
49
+ # endif
31
50
// Make some good guesses about default options
32
51
m_texturesys->attribute (" automip" , 1 );
33
52
m_texturesys->attribute (" autotile" , 64 );
You can’t perform that action at this time.
0 commit comments