Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchell Stokes <mogurijin@gmail.com>2011-12-23 11:10:01 +0400
committerMitchell Stokes <mogurijin@gmail.com>2011-12-23 11:10:01 +0400
commitac498a6b64ea2f034aa0177894fb25d0401e327b (patch)
tree6329247e9ec72875eab97d1d5ca87b74bbea6c50 /source/blender/gpu/intern/gpu_extensions.c
parentb59d8c6ba35e43879437e197210bd3900eb56fc9 (diff)
Cleaning up the GPU_extensions_init/exit() code a bit to keep the Blenderplayer from crashing on exit and restart.
Diffstat (limited to 'source/blender/gpu/intern/gpu_extensions.c')
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index eaa661a9dcf..c4ed88635b7 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -45,6 +45,7 @@
#include "GPU_draw.h"
#include "GPU_extensions.h"
+#include "gpu_codegen.h"
#include <stdlib.h>
#include <stdio.h>
@@ -85,6 +86,8 @@ int GPU_type_matches(GPUDeviceType device, GPUOSType os, GPUDriverType driver)
/* GPU Extensions */
+static int gpu_extensions_init = 0;
+
void GPU_extensions_disable(void)
{
GG.extdisabled = 1;
@@ -96,11 +99,11 @@ void GPU_extensions_init(void)
const char *vendor, *renderer;
/* can't avoid calling this multiple times, see wm_window_add_ghostwindow */
- static char init= 0;
- if(init) return;
- init= 1;
+ if(gpu_extensions_init) return;
+ gpu_extensions_init= 1;
glewInit();
+ GPU_codegen_init();
/* glewIsSupported("GL_VERSION_2_0") */
@@ -112,8 +115,6 @@ void GPU_extensions_init(void)
if (!GLEW_ARB_vertex_shader) GG.glslsupport = 0;
if (!GLEW_ARB_fragment_shader) GG.glslsupport = 0;
- GPU_code_generate_glsl_lib();
-
glGetIntegerv(GL_RED_BITS, &r);
glGetIntegerv(GL_GREEN_BITS, &g);
glGetIntegerv(GL_BLUE_BITS, &b);
@@ -188,6 +189,12 @@ void GPU_extensions_init(void)
#endif
}
+void GPU_extensions_exit(void)
+{
+ gpu_extensions_init = 0;
+ GPU_codegen_exit();
+}
+
int GPU_glsl_support(void)
{
return !GG.extdisabled && GG.glslsupport;