fix missing version GLSL compiler warnings on startup

happens (at least) on Intel drivers
This commit is contained in:
toxieainc 2022-07-23 00:18:02 +02:00 committed by trzy
parent 7052e8375e
commit d7041a83c9
2 changed files with 21 additions and 4 deletions

View file

@ -201,6 +201,8 @@ void R3DFrameBuffers::AllocShaderBase()
{
const char *vertexShader = R"glsl(
#version 120
// inputs
attribute vec3 inVertex;
attribute vec2 inTexCoord;
@ -218,6 +220,8 @@ void R3DFrameBuffers::AllocShaderBase()
const char *fragmentShader = R"glsl(
#version 120
uniform sampler2D tex1; // base tex
varying vec2 fsTexCoord;
@ -241,6 +245,8 @@ void R3DFrameBuffers::AllocShaderTrans()
{
const char *vertexShader = R"glsl(
#version 120
// inputs
attribute vec3 inVertex;
attribute vec2 inTexCoord;
@ -258,6 +264,8 @@ void R3DFrameBuffers::AllocShaderTrans()
const char *fragmentShader = R"glsl(
#version 120
uniform sampler2D tex1; // trans layer 1
uniform sampler2D tex2; // trans layer 2
@ -269,10 +277,11 @@ void R3DFrameBuffers::AllocShaderTrans()
vec4 colTrans2 = texture2D( tex2, fsTexCoord);
if(colTrans1.a+colTrans2.a > 0.0) {
vec3 col1 = (colTrans1.rgb * colTrans1.a) / ( colTrans1.a + colTrans2.a); // this is my best guess at the blending between the layers
vec3 col2 = (colTrans2.rgb * colTrans2.a) / ( colTrans1.a + colTrans2.a);
vec3 col1 = colTrans1.rgb * colTrans1.a;
vec3 col2 = colTrans2.rgb * colTrans2.a;
colTrans1 = vec4(col1+col2,colTrans1.a+colTrans2.a);
colTrans1 = vec4((col1+col2) / (colTrans1.a + colTrans2.a), // this is my best guess at the blending between the layers
colTrans1.a+colTrans2.a);
}
gl_FragColor = colTrans1;
@ -293,6 +302,8 @@ void R3DFrameBuffers::AllocShaderWipe()
{
const char *vertexShader = R"glsl(
#version 120
// inputs
attribute vec3 inVertex;
attribute vec2 inTexCoord;
@ -310,6 +321,8 @@ void R3DFrameBuffers::AllocShaderWipe()
const char *fragmentShader = R"glsl(
#version 120
uniform sampler2D texColor; // base colour layer
varying vec2 fsTexCoord;

View file

@ -6,6 +6,8 @@ namespace New3D {
static const char *vertexShaderFog = R"glsl(
#version 120
uniform mat4 mvp;
attribute vec3 inVertex;
@ -18,6 +20,8 @@ void main(void)
static const char *fragmentShaderFog = R"glsl(
#version 120
uniform float fogAttenuation;
uniform float fogAmbient;
uniform vec4 fogColour;