[Bf-blender-cvs] [71ac1376627] master: Cleanup: GPU: Move quad buffer stereo check to GPU module

Clément Foucault noreply at git.blender.org
Thu Jul 16 17:17:57 CEST 2020


Commit: 71ac1376627b3abc7e2bda93fef42bc3b81f9b4e
Author: Clément Foucault
Date:   Thu Jul 16 03:01:07 2020 +0200
Branches: master
https://developer.blender.org/rB71ac1376627b3abc7e2bda93fef42bc3b81f9b4e

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

===================================================================

M	source/blender/gpu/GPU_extensions.h
M	source/blender/gpu/intern/gpu_extensions.c
M	source/blender/windowmanager/intern/wm_stereo.c

===================================================================

diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h
index ab54148a2ff..263deeaf28d 100644
--- a/source/blender/gpu/GPU_extensions.h
+++ b/source/blender/gpu/GPU_extensions.h
@@ -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
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index d1c7aba37df..1c533c80ab7 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -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;
+}
diff --git a/source/blender/windowmanager/intern/wm_stereo.c b/source/blender/windowmanager/intern/wm_stereo.c
index 8ae343d5eb5..245560d3795 100644
--- a/source/blender/windowmanager/intern/wm_stereo.c
+++ b/source/blender/windowmanager/intern/wm_stereo.c
@@ -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 {



More information about the Bf-blender-cvs mailing list