| @@ -104,6 +104,8 @@ struct GlobalUI { | |||||
| int placeholder_framecount; | int placeholder_framecount; | ||||
| } param_info; | } param_info; | ||||
| bool b_fbo; // usually true. set to false when using the VirtualBox GL driver. | |||||
| int pending_swap_interval; // -1=none, 1=vsync on, 0=vsync off | |||||
| void init(void) { | void init(void) { | ||||
| @@ -152,6 +154,9 @@ struct GlobalUI { | |||||
| param_info.tf_value = NULL; | param_info.tf_value = NULL; | ||||
| param_info.b_lock = false; | param_info.b_lock = false; | ||||
| param_info.placeholder_framecount = 0; | param_info.placeholder_framecount = 0; | ||||
| b_fbo = true; | |||||
| pending_swap_interval = -1; | |||||
| } | } | ||||
| }; | }; | ||||
| @@ -82,6 +82,10 @@ static json_t *settingsToJson() { | |||||
| json_t *vsyncJ = json_boolean(vsync); | json_t *vsyncJ = json_boolean(vsync); | ||||
| json_object_set_new(rootJ, "vsync", vsyncJ); | json_object_set_new(rootJ, "vsync", vsyncJ); | ||||
| // fbo | |||||
| json_t *fboJ = json_boolean(!global_ui->b_fbo); | |||||
| json_object_set_new(rootJ, "fbo", fboJ); | |||||
| // touchInput | // touchInput | ||||
| int touchInput = lglw_touchinput_get(global_ui->window.lglw); | int touchInput = lglw_touchinput_get(global_ui->window.lglw); | ||||
| json_t *touchInputJ = json_boolean(touchInput); | json_t *touchInputJ = json_boolean(touchInput); | ||||
| @@ -252,12 +256,23 @@ static void settingsFromJson(json_t *rootJ, bool bWindowSizeOnly) { | |||||
| json_t *vsyncJ = json_object_get(rootJ, "vsync"); | json_t *vsyncJ = json_object_get(rootJ, "vsync"); | ||||
| if (vsyncJ) | if (vsyncJ) | ||||
| { | { | ||||
| lglw_glcontext_push(global_ui->window.lglw); | |||||
| lglw_swap_interval_set(global_ui->window.lglw, json_is_true(vsyncJ)); | |||||
| lglw_glcontext_pop(global_ui->window.lglw); | |||||
| // lglw_glcontext_push(global_ui->window.lglw); | |||||
| // lglw_swap_interval_set(global_ui->window.lglw, json_is_true(vsyncJ); | |||||
| // lglw_glcontext_pop(global_ui->window.lglw); | |||||
| // postpone until first vst2_editor_redraw() call (see window.cpp) | |||||
| // (note) on Linux we need a drawable to set the swap interval | |||||
| global_ui->pending_swap_interval = json_is_true(vsyncJ); | |||||
| } | } | ||||
| } | } | ||||
| // fbo support (not working with VirtualBox GL driver!) | |||||
| json_t *fboJ = json_object_get(rootJ, "fbo"); | |||||
| if (fboJ) | |||||
| { | |||||
| global_ui->b_fbo = json_is_true(fboJ); | |||||
| } | |||||
| // allowCursorLock | // allowCursorLock | ||||
| json_t *allowCursorLockJ = json_object_get(rootJ, "allowCursorLock"); | json_t *allowCursorLockJ = json_object_get(rootJ, "allowCursorLock"); | ||||
| if (allowCursorLockJ) | if (allowCursorLockJ) | ||||
| @@ -36,12 +36,19 @@ FramebufferWidget::~FramebufferWidget() { | |||||
| void FramebufferWidget::draw(NVGcontext *vg) { | void FramebufferWidget::draw(NVGcontext *vg) { | ||||
| // Bypass framebuffer rendering entirely | // Bypass framebuffer rendering entirely | ||||
| // printf("xxx FramebufferWidget::draw\n"); | |||||
| #ifdef RACK_PLUGIN_SHARED | #ifdef RACK_PLUGIN_SHARED | ||||
| bool bFBO = false; | |||||
| #else | |||||
| bool bFBO = global_ui->b_fbo; | |||||
| #endif // RACK_PLUGIN_SHARED | |||||
| // (note) FBO path crashes when plugin is a DLL (!) | // (note) FBO path crashes when plugin is a DLL (!) | ||||
| // (the glGenFramebuffers() call in nvgluCreateFramebuffer() to be precise) | // (the glGenFramebuffers() call in nvgluCreateFramebuffer() to be precise) | ||||
| Widget::draw(vg); | |||||
| return; | |||||
| #endif // RACK_PLUGIN_SHARED | |||||
| if(!bFBO) | |||||
| { | |||||
| Widget::draw(vg); | |||||
| return; | |||||
| } | |||||
| // printf("xxx FramebufferWidget::draw: ENTER vg=%p\n", vg); | // printf("xxx FramebufferWidget::draw: ENTER vg=%p\n", vg); | ||||
| // printf("xxx FramebufferWidget::draw: GetCurrentThreadId=%d\n", GetCurrentThreadId()); | // printf("xxx FramebufferWidget::draw: GetCurrentThreadId=%d\n", GetCurrentThreadId()); | ||||
| @@ -13,6 +13,7 @@ | |||||
| "zoom": 1.0, | "zoom": 1.0, | ||||
| "refreshRate": 30, | "refreshRate": 30, | ||||
| "vsync": true, | "vsync": true, | ||||
| "fbo": true, | |||||
| "touchInput": false, | "touchInput": false, | ||||
| "touchKbd": false, | "touchKbd": false, | ||||
| "oversampleFactor": 1.0, | "oversampleFactor": 1.0, | ||||
| @@ -265,4 +266,4 @@ | |||||
| }, | }, | ||||
| "powerMeter": false, | "powerMeter": false, | ||||
| "checkVersion": true | "checkVersion": true | ||||
| } | |||||
| } | |||||