@@ -50,6 +50,10 @@ static thread manager_thread;
50
50
51
51
static int adapterCount = 0 ;
52
52
53
+ #if EXPERIMENTAL_SHARED_TEXTURE_SUPPORT_ENABLED
54
+ bool hwaccel = false ;
55
+ #endif
56
+
53
57
/* ========================================================================= */
54
58
55
59
class BrowserTask : public CefTask {
@@ -86,9 +90,6 @@ static void browser_source_get_defaults(obs_data_t *settings)
86
90
obs_data_set_default_bool (settings, " shutdown" , false );
87
91
obs_data_set_default_bool (settings, " restart_when_active" , false );
88
92
obs_data_set_default_string (settings, " css" , default_css);
89
- #if EXPERIMENTAL_SHARED_TEXTURE_SUPPORT_ENABLED
90
- obs_data_set_default_bool (settings, " hwaccel" , adapterCount == 1 );
91
- #endif
92
93
}
93
94
94
95
static bool is_local_file_modified (obs_properties_t *props,
@@ -143,11 +144,6 @@ static obs_properties_t *browser_source_get_properties(void *data)
143
144
obs_properties_add_bool (props, " restart_when_active" ,
144
145
obs_module_text (" RefreshBrowserActive" ));
145
146
146
- #if EXPERIMENTAL_SHARED_TEXTURE_SUPPORT_ENABLED
147
- obs_properties_add_bool (props, " hwaccel" ,
148
- obs_module_text (" HardwareAcceleration" ));
149
- #endif
150
-
151
147
obs_properties_add_button (props, " refreshnocache" ,
152
148
obs_module_text (" RefreshNoCache" ),
153
149
[] (obs_properties_t *, obs_property_t *, void *data)
@@ -185,9 +181,11 @@ static void BrowserManagerThread(void)
185
181
bool tex_sharing_avail = false ;
186
182
187
183
#if EXPERIMENTAL_SHARED_TEXTURE_SUPPORT_ENABLED
188
- obs_enter_graphics ();
189
- tex_sharing_avail = gs_shared_texture_available ();
190
- obs_leave_graphics ();
184
+ if (hwaccel) {
185
+ obs_enter_graphics ();
186
+ tex_sharing_avail = gs_shared_texture_available ();
187
+ obs_leave_graphics ();
188
+ }
191
189
#endif
192
190
193
191
CefRefPtr<BrowserApp> app (new BrowserApp (tex_sharing_avail));
@@ -404,6 +402,12 @@ bool obs_module_load(void)
404
402
#endif
405
403
RegisterBrowserSource ();
406
404
obs_frontend_add_event_callback (handle_obs_frontend_event, nullptr );
405
+
406
+ #if EXPERIMENTAL_SHARED_TEXTURE_SUPPORT_ENABLED
407
+ obs_data_t *private_data = obs_get_private_data ();
408
+ hwaccel = obs_data_get_bool (private_data, " BrowserHWAccel" );
409
+ obs_data_release (private_data);
410
+ #endif
407
411
return true ;
408
412
}
409
413
0 commit comments