Fix #21349: triple buffer drawing doesn't work well with thousands of
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 5 Apr 2010 10:25:40 +0000 (10:25 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 5 Apr 2010 10:25:40 +0000 (10:25 +0000)
colors setting on Mac, just disabled it in that case.

source/blender/gpu/GPU_extensions.h
source/blender/gpu/intern/gpu_extensions.c
source/blender/windowmanager/intern/wm_draw.c

index 686e89b8310c334a850512514a5edb7fb8e67bfa..6b98ffdede74317fe3df05f36acdae7aa601cf9b 100644 (file)
@@ -57,9 +57,11 @@ typedef struct GPUShader GPUShader;
 void GPU_extensions_disable(void);
 void GPU_extensions_init(void); /* call this before running any of the functions below */
 void GPU_extensions_exit(void);
+int GPU_print_error(char *str);
+
 int GPU_glsl_support(void);
 int GPU_non_power_of_two_support(void);
-int GPU_print_error(char *str);
+int GPU_24bit_color_support(void);
 
 /* GPU Types */
 
index 8e0a23ccfebdd741cf9a11bc4745bc6f97b7fae0..d53b8e67c560982ecb2a8de084cbfd08808b60ff 100644 (file)
@@ -71,6 +71,7 @@ static struct GPUGlobal {
        GLuint currentfb;
        int glslsupport;
        int extdisabled;
+       int color24bit;
        GPUDeviceType device;
        GPUOSType os;
        GPUDriverType driver;
@@ -92,6 +93,7 @@ void GPU_extensions_disable()
 
 void GPU_extensions_init()
 {
+       GLint bits;
        const char *vendor, *renderer;
 
        glewInit();
@@ -106,6 +108,9 @@ void GPU_extensions_init()
        if (!GLEW_ARB_vertex_shader) GG.glslsupport = 0;
        if (!GLEW_ARB_fragment_shader) GG.glslsupport = 0;
 
+       glGetIntegerv(GL_RED_BITS, &bits);
+       GG.color24bit = (bits >= 8);
+
        vendor = (const char*)glGetString(GL_VENDOR);
        renderer = (const char*)glGetString(GL_RENDERER);
 
@@ -170,6 +175,11 @@ int GPU_non_power_of_two_support()
        return GLEW_ARB_texture_non_power_of_two;
 }
 
+int GPU_24bit_color_support()
+{
+       return GG.color24bit;
+}
+
 int GPU_print_error(char *str)
 {
        GLenum errCode;
index fec46d32a08e8983aa1a9ec6c920316601cd382c..008abceba4c3555b55819848c011709ff8fab7e3 100644 (file)
@@ -674,6 +674,8 @@ static int wm_automatic_draw_method(wmWindow *win)
                /* Windows software driver darkens color on each redraw */
                else if(GPU_type_matches(GPU_DEVICE_SOFTWARE, GPU_OS_WIN, GPU_DRIVER_SOFTWARE))
                        return USER_DRAW_OVERLAP_FLIP;
+               else if(!GPU_24bit_color_support())
+                       return USER_DRAW_OVERLAP;
                else
                        return USER_DRAW_TRIPLE;
        }