Reverted back default GLSL version to 140

If supported, 110 if not


Former-commit-id: 65ae51fa9fa9c437d17de2e8b3158b8c2897dc80
This commit is contained in:
Lynix 2013-01-09 00:08:36 +01:00
parent abb806f27b
commit a6c109ca1d
1 changed files with 15 additions and 15 deletions

View File

@ -17,19 +17,19 @@ namespace
NzString BuildFragmentShaderSource(nzUInt32 flags) NzString BuildFragmentShaderSource(nzUInt32 flags)
{ {
bool glsl150 = (NzOpenGL::GetVersion() >= 320); bool glsl140 = (NzOpenGL::GetVersion() >= 310);
bool useMRT = (glsl150 && NzRenderer::HasCapability(nzRendererCap_MultipleRenderTargets)); bool useMRT = (glsl140 && NzRenderer::HasCapability(nzRendererCap_MultipleRenderTargets));
NzString inKW = (glsl150) ? "in" : "varying"; NzString inKW = (glsl140) ? "in" : "varying";
NzString fragmentColorKW = (glsl150) ? "RenderTarget0" : "gl_FragColor"; NzString fragmentColorKW = (glsl140) ? "RenderTarget0" : "gl_FragColor";
NzString sourceCode; NzString sourceCode;
sourceCode.Reserve(512); // Le shader peut faire plus, mais cela évite déjà beaucoup de petites allocations sourceCode.Reserve(512); // Le shader peut faire plus, mais cela évite déjà beaucoup de petites allocations
/********************Préprocesseur********************/ /********************Préprocesseur********************/
sourceCode = "#version "; sourceCode = "#version ";
if (glsl150) if (glsl140)
sourceCode += "150 core\n"; sourceCode += "140\n";
else else
sourceCode += "110\n"; sourceCode += "110\n";
@ -121,7 +121,7 @@ namespace
"for (int i = 0; i < LightCount; ++i)\n" "for (int i = 0; i < LightCount; ++i)\n"
"{\n"; "{\n";
if (glsl150) if (glsl140)
{ {
sourceCode += "switch (Lights[i].type)\n" sourceCode += "switch (Lights[i].type)\n"
"{\n" "{\n"
@ -148,7 +148,7 @@ namespace
"light += specular * Lights[i].specular * MaterialSpecular;\n" "light += specular * Lights[i].specular * MaterialSpecular;\n"
"}\n"; "}\n";
if (glsl150) if (glsl140)
{ {
sourceCode += "break;\n" sourceCode += "break;\n"
"}\n" "}\n"
@ -180,7 +180,7 @@ namespace
"light += att * specular * Lights[i].specular * MaterialSpecular;\n" "light += att * specular * Lights[i].specular * MaterialSpecular;\n"
"}\n"; "}\n";
if (glsl150) if (glsl140)
{ {
sourceCode += "break;\n" sourceCode += "break;\n"
"}\n" "}\n"
@ -219,7 +219,7 @@ namespace
"light += att * specular * spot * Lights[i].specular * MaterialSpecular;\n" "light += att * specular * spot * Lights[i].specular * MaterialSpecular;\n"
"}\n"; "}\n";
if (glsl150) if (glsl140)
{ {
sourceCode += "break;\n" sourceCode += "break;\n"
"}\n" "}\n"
@ -252,18 +252,18 @@ namespace
NzString BuildVertexShaderSource(nzUInt32 flags) NzString BuildVertexShaderSource(nzUInt32 flags)
{ {
bool glsl150 = (NzOpenGL::GetVersion() >= 300); bool glsl140 = (NzOpenGL::GetVersion() >= 310);
NzString inKW = (glsl150) ? "in" : "attribute"; NzString inKW = (glsl140) ? "in" : "attribute";
NzString outKW = (glsl150) ? "out" : "varying"; NzString outKW = (glsl140) ? "out" : "varying";
NzString sourceCode; NzString sourceCode;
sourceCode.Reserve(256); // Le shader peut faire plus, mais cela évite déjà beaucoup de petites allocations sourceCode.Reserve(256); // Le shader peut faire plus, mais cela évite déjà beaucoup de petites allocations
/********************Version de GLSL********************/ /********************Version de GLSL********************/
sourceCode = "#version "; sourceCode = "#version ";
if (glsl150) if (glsl140)
sourceCode += "150 core\n"; sourceCode += "140\n";
else else
sourceCode += "110\n"; sourceCode += "110\n";