Browse Source

add "fbo" config option (settings.json) (for VirtualBox VM)

pull/1639/head
bsp2 7 years ago
parent
commit
b410d8dc86
4 changed files with 35 additions and 7 deletions
  1. +5
    -0
      include/global_ui.hpp
  2. +18
    -3
      src/settings.cpp
  3. +10
    -3
      src/widgets/FramebufferWidget.cpp
  4. +2
    -1
      vst2_bin/settings.json

+ 5
- 0
include/global_ui.hpp View File

@@ -104,6 +104,8 @@ struct GlobalUI {
int placeholder_framecount;
} 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) {
@@ -152,6 +154,9 @@ struct GlobalUI {
param_info.tf_value = NULL;
param_info.b_lock = false;
param_info.placeholder_framecount = 0;

b_fbo = true;
pending_swap_interval = -1;
}

};


+ 18
- 3
src/settings.cpp View File

@@ -82,6 +82,10 @@ static json_t *settingsToJson() {
json_t *vsyncJ = json_boolean(vsync);
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
int touchInput = lglw_touchinput_get(global_ui->window.lglw);
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");
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
json_t *allowCursorLockJ = json_object_get(rootJ, "allowCursorLock");
if (allowCursorLockJ)


+ 10
- 3
src/widgets/FramebufferWidget.cpp View File

@@ -36,12 +36,19 @@ FramebufferWidget::~FramebufferWidget() {

void FramebufferWidget::draw(NVGcontext *vg) {
// Bypass framebuffer rendering entirely
// printf("xxx FramebufferWidget::draw\n");
#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 (!)
// (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: GetCurrentThreadId=%d\n", GetCurrentThreadId());



+ 2
- 1
vst2_bin/settings.json View File

@@ -13,6 +13,7 @@
"zoom": 1.0,
"refreshRate": 30,
"vsync": true,
"fbo": true,
"touchInput": false,
"touchKbd": false,
"oversampleFactor": 1.0,
@@ -265,4 +266,4 @@
},
"powerMeter": false,
"checkVersion": true
}
}

Loading…
Cancel
Save