From bbb4762b772a2545730c3d0cbabcc8cd1231cb95 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Fri, 13 Sep 2013 07:17:31 +0200 Subject: [PATCH] Move shader description generation to it's own method. --HG-- branch : gsoc2013-dfighter --- code/nel/src/3d/driver/OpenGL3/driver_opengl.h | 1 + .../3d/driver/OpenGL3/driver_opengl_program.cpp | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/code/nel/src/3d/driver/OpenGL3/driver_opengl.h b/code/nel/src/3d/driver/OpenGL3/driver_opengl.h index a12d81a68..eae913fe7 100644 --- a/code/nel/src/3d/driver/OpenGL3/driver_opengl.h +++ b/code/nel/src/3d/driver/OpenGL3/driver_opengl.h @@ -379,6 +379,7 @@ public: static inline void setupCausticsSecondTex(uint stage);*/ virtual bool setupMaterial(CMaterial& mat); + void generateShaderDesc(CShaderDesc &desc, CMaterial &mat); bool setupProgram(CMaterial& mat); void setupUniforms(CMaterial& mat); void releaseProgram(); diff --git a/code/nel/src/3d/driver/OpenGL3/driver_opengl_program.cpp b/code/nel/src/3d/driver/OpenGL3/driver_opengl_program.cpp index 791fe8149..205c6110f 100644 --- a/code/nel/src/3d/driver/OpenGL3/driver_opengl_program.cpp +++ b/code/nel/src/3d/driver/OpenGL3/driver_opengl_program.cpp @@ -148,11 +148,8 @@ namespace NL3D static IProgramObject *p; - bool CDriverGL3::setupProgram( CMaterial &mat ) + void CDriverGL3::generateShaderDesc( CShaderDesc &desc, CMaterial &mat ) { - -#ifdef GLSL - CShaderDesc desc; desc.setShaderType( mat.getShader() ); desc.setVBFlags( _CurrentVertexBufferHard->VB->getVertexFormat() ); @@ -171,6 +168,16 @@ namespace NL3D desc.setAlphaTest( mat.getAlphaTest() ); desc.setAlphaTestThreshold( mat.getAlphaTestThreshold() ); + } + + + bool CDriverGL3::setupProgram( CMaterial &mat ) + { + +#ifdef GLSL + CShaderDesc desc; + + generateShaderDesc( desc, mat ); p = shaderCache.findShader( desc );