diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-07-04 16:24:19 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-07-04 16:24:19 +0400 |
commit | 90162cb0cb4ad432a7453c7d5ec7de832a058f16 (patch) | |
tree | a83e17623392d53b40604e64fb779975aa3d5107 /source/blender/gpu | |
parent | ace570cb1024f0b3affd48b2f2104af3048d1707 (diff) |
Fix #21894: backface selection wasn't working correct with < 24 bits colors,
e.g. thousands of colors on OS X, due to use of uninitialized value. Problem
tracked down and patch provided by Shane Ambler, thanks!
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/GPU_extensions.h | 2 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_extensions.c | 16 |
2 files changed, 10 insertions, 8 deletions
diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h index 6b98ffdede7..5275f8988a8 100644 --- a/source/blender/gpu/GPU_extensions.h +++ b/source/blender/gpu/GPU_extensions.h @@ -61,7 +61,7 @@ int GPU_print_error(char *str); int GPU_glsl_support(void); int GPU_non_power_of_two_support(void); -int GPU_24bit_color_support(void); +int GPU_color_depth(void); /* GPU Types */ diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index 4eaf969ee8a..0b7ea605ec8 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -71,7 +71,7 @@ static struct GPUGlobal { GLuint currentfb; int glslsupport; int extdisabled; - int color24bit; + int colordepth; GPUDeviceType device; GPUOSType os; GPUDriverType driver; @@ -93,7 +93,7 @@ void GPU_extensions_disable() void GPU_extensions_init() { - GLint bits; + GLint r, g, b; const char *vendor, *renderer; glewInit(); @@ -108,9 +108,11 @@ 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); - + glGetIntegerv(GL_RED_BITS, &r); + glGetIntegerv(GL_GREEN_BITS, &g); + glGetIntegerv(GL_BLUE_BITS, &b); + GG.colordepth = r+g+b; /* assumes same depth for RGB */ + vendor = (const char*)glGetString(GL_VENDOR); renderer = (const char*)glGetString(GL_RENDERER); @@ -178,9 +180,9 @@ int GPU_non_power_of_two_support() return GLEW_ARB_texture_non_power_of_two; } -int GPU_24bit_color_support() +int GPU_color_depth() { - return GG.color24bit; + return GG.colordepth; } int GPU_print_error(char *str) |