Cleanup: GPU: Move quad buffer stereo check to GPU module

This commit is contained in:
Clément Foucault 2020-07-16 03:01:07 +02:00
parent 8084b7e6e2
commit 71ac137662
3 changed files with 12 additions and 8 deletions

View File

@ -57,6 +57,8 @@ void GPU_mem_stats_get(int *totalmem, int *freemem);
void GPU_code_generate_glsl_lib(void);
bool GPU_stereo_quadbuffer_support(void);
#ifdef __cplusplus
}
#endif

View File

@ -437,3 +437,11 @@ void GPU_mem_stats_get(int *totalmem, int *freemem)
*freemem = 0;
}
}
/* Return support for the active context + window. */
bool GPU_stereo_quadbuffer_support(void)
{
GLboolean stereo = GL_FALSE;
glGetBooleanv(GL_STEREO, &stereo);
return stereo == GL_TRUE;
}

View File

@ -40,6 +40,7 @@
#include "ED_screen.h"
#include "GPU_extensions.h"
#include "GPU_immediate.h"
#include "GPU_texture.h"
#include "GPU_viewport.h"
@ -147,13 +148,6 @@ void wm_stereo3d_draw_topbottom(wmWindow *win, int view)
immUnbindProgram();
}
static bool wm_stereo3d_quadbuffer_supported(void)
{
GLboolean stereo = GL_FALSE;
glGetBooleanv(GL_STEREO, &stereo);
return stereo == GL_TRUE;
}
static bool wm_stereo3d_is_fullscreen_required(eStereoDisplayMode stereo_display)
{
return ELEM(stereo_display, S3D_DISPLAY_SIDEBYSIDE, S3D_DISPLAY_TOPBOTTOM);
@ -325,7 +319,7 @@ int wm_stereo3d_set_exec(bContext *C, wmOperator *op)
}
/* pageflip requires a new window to be created with the proper OS flags */
else if ((win_dst = wm_window_copy_test(C, win_src, false, false))) {
if (wm_stereo3d_quadbuffer_supported()) {
if (GPU_stereo_quadbuffer_support()) {
BKE_report(op->reports, RPT_INFO, "Quad-buffer window successfully created");
}
else {