From b2c4018466a10b3a0c3b4f95c3ef3d31dae22a4f Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 12 Aug 2009 10:32:58 +0000 Subject: [PATCH] Very very very minor optimization --- panda/src/glstuff/glGraphicsStateGuardian_src.cxx | 8 +++++++- panda/src/glstuff/glGraphicsStateGuardian_src.h | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index f50fdb548c..17d94719dd 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -75,6 +75,10 @@ PStatCollector CLP(GraphicsStateGuardian)::_primitive_batches_display_list_pcoll PStatCollector CLP(GraphicsStateGuardian)::_vertices_display_list_pcollector("Vertices:Display lists"); PStatCollector CLP(GraphicsStateGuardian)::_vertices_immediate_pcollector("Vertices:Immediate mode"); +#ifdef OPENGLES_2 +PT(Shader) CLP(GraphicsStateGuardian)::_default_shader = NULL; +#endif + // The following noop functions are assigned to the corresponding // glext function pointers in the class, in case the functions are not // defined by the GL, just so it will always be safe to call the @@ -973,7 +977,9 @@ reset() { // something didn't happen to have a shader applied, or // if it failed to compile. This default shader just outputs // a red color, indicating that something went wrong. - _default_shader = new Shader(default_shader_name, default_shader_body, Shader::SL_GLSL); + if (_default_shader == NULL) { + _default_shader = new Shader(default_shader_name, default_shader_body, Shader::SL_GLSL); + } #endif #ifdef OPENGLES_2 diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.h b/panda/src/glstuff/glGraphicsStateGuardian_src.h index 0050797299..35ccddd6d2 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.h +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.h @@ -448,7 +448,7 @@ protected: CLP(ShaderContext) *_texture_binding_shader_context; #endif #ifdef OPENGLES_2 - PT(Shader) _default_shader; + static PT(Shader) _default_shader; #endif #ifdef SUPPORT_IMMEDIATE_MODE