Merge pull request #2315 from MoritzBrueckner/fix-ppcomp-warnings

Fix "Uniform PPCompXX not found" warnings
This commit is contained in:
Lubos Lenco 2021-09-02 20:05:11 +02:00 committed by GitHub
commit e0cbf1b332
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 33 additions and 13 deletions

View file

@ -4,7 +4,9 @@
uniform sampler2D tex; uniform sampler2D tex;
#ifdef _CPostprocess
uniform vec3 PPComp10; uniform vec3 PPComp10;
#endif
in vec2 texCoord; in vec2 texCoord;
out vec4 fragColor; out vec4 fragColor;

View file

@ -8,7 +8,8 @@
"links": [ "links": [
{ {
"name": "PPComp10", "name": "PPComp10",
"link": "_PPComp10" "link": "_PPComp10",
"ifdef": ["_CPostprocess"]
} }
], ],
"texture_params": [], "texture_params": [],

View file

@ -7,7 +7,9 @@ uniform sampler2D tex;
uniform vec2 dir; uniform vec2 dir;
uniform vec2 screenSize; uniform vec2 screenSize;
#ifdef _CPostprocess
uniform vec3 PPComp11; uniform vec3 PPComp11;
#endif
in vec2 texCoord; in vec2 texCoord;
out vec4 fragColor; out vec4 fragColor;
@ -26,7 +28,7 @@ void main() {
fragColor.rgb += textureLod(tex, texCoord + s, 0.0).rgb * weight[i]; fragColor.rgb += textureLod(tex, texCoord + s, 0.0).rgb * weight[i];
fragColor.rgb += textureLod(tex, texCoord - s, 0.0).rgb * weight[i]; fragColor.rgb += textureLod(tex, texCoord - s, 0.0).rgb * weight[i];
} }
#ifdef _CPostprocess #ifdef _CPostprocess
fragColor.rgb *= PPComp11.x / 5; fragColor.rgb *= PPComp11.x / 5;
#else #else

View file

@ -16,7 +16,8 @@
}, },
{ {
"name": "PPComp11", "name": "PPComp11",
"link": "_PPComp11" "link": "_PPComp11",
"ifdef": ["_CPostprocess"]
} }
], ],
"texture_params": [], "texture_params": [],
@ -39,7 +40,8 @@
}, },
{ {
"name": "PPComp11", "name": "PPComp11",
"link": "_PPComp11" "link": "_PPComp11",
"ifdef": ["_CPostprocess"]
} }
], ],
"texture_params": [], "texture_params": [],
@ -65,7 +67,8 @@
}, },
{ {
"name": "PPComp11", "name": "PPComp11",
"link": "_PPComp11" "link": "_PPComp11",
"ifdef": ["_CPostprocess"]
} }
], ],
"texture_params": [], "texture_params": [],

View file

@ -3,7 +3,10 @@
#include "compiled.inc" #include "compiled.inc"
uniform sampler2D tex; uniform sampler2D tex;
#ifdef _CPostprocess
uniform vec3 PPComp13; uniform vec3 PPComp13;
#endif
in vec2 texCoord; in vec2 texCoord;
out vec4 fragColor; out vec4 fragColor;

View file

@ -9,7 +9,8 @@
"links": [ "links": [
{ {
"name": "PPComp13", "name": "PPComp13",
"link": "_PPComp13" "link": "_PPComp13",
"ifdef": ["_CPostprocess"]
} }
], ],
"texture_params": [], "texture_params": [],

View file

@ -12,8 +12,10 @@ uniform vec3 eyeLook;
uniform vec2 screenSize; uniform vec2 screenSize;
uniform mat4 invVP; uniform mat4 invVP;
#ifdef _CPostprocess
uniform vec3 PPComp11; uniform vec3 PPComp11;
uniform vec3 PPComp12; uniform vec3 PPComp12;
#endif
in vec2 texCoord; in vec2 texCoord;
in vec3 viewRay; in vec3 viewRay;
@ -23,12 +25,12 @@ void main() {
float depth = textureLod(gbufferD, texCoord, 0.0).r * 2.0 - 1.0; float depth = textureLod(gbufferD, texCoord, 0.0).r * 2.0 - 1.0;
if (depth == 1.0) { fragColor = 1.0; return; } if (depth == 1.0) { fragColor = 1.0; return; }
vec2 enc = textureLod(gbuffer0, texCoord, 0.0).rg; vec2 enc = textureLod(gbuffer0, texCoord, 0.0).rg;
vec3 n; vec3 n;
n.z = 1.0 - abs(enc.x) - abs(enc.y); n.z = 1.0 - abs(enc.x) - abs(enc.y);
n.xy = n.z >= 0.0 ? enc.xy : octahedronWrap(enc.xy); n.xy = n.z >= 0.0 ? enc.xy : octahedronWrap(enc.xy);
n = normalize(n); n = normalize(n);
vec3 vray = normalize(viewRay); vec3 vray = normalize(viewRay);
vec3 currentPos = getPosNoEye(eyeLook, vray, depth, cameraProj); vec3 currentPos = getPosNoEye(eyeLook, vray, depth, cameraProj);
// vec3 currentPos = getPos2NoEye(eye, invVP, depth, texCoord); // vec3 currentPos = getPos2NoEye(eye, invVP, depth, texCoord);
@ -53,7 +55,7 @@ void main() {
vec3 pos = getPos2NoEye(eye, invVP, depth, texCoord + k) - currentPos; vec3 pos = getPos2NoEye(eye, invVP, depth, texCoord + k) - currentPos;
fragColor += max(0, dot(pos, n) - currentDistanceB) / (dot(pos, pos) + 0.015); fragColor += max(0, dot(pos, n) - currentDistanceB) / (dot(pos, pos) + 0.015);
} }
#ifdef _CPostprocess #ifdef _CPostprocess
fragColor *= (PPComp12.x * 0.3) / samples; fragColor *= (PPComp12.x * 0.3) / samples;
#else #else

View file

@ -28,11 +28,13 @@
}, },
{ {
"name": "PPComp11", "name": "PPComp11",
"link": "_PPComp11" "link": "_PPComp11",
"ifdef": ["_CPostprocess"]
}, },
{ {
"name": "PPComp12", "name": "PPComp12",
"link": "_PPComp12" "link": "_PPComp12",
"ifdef": ["_CPostprocess"]
} }
], ],
"texture_params": [], "texture_params": [],

View file

@ -12,8 +12,10 @@ uniform mat4 P;
uniform mat3 V3; uniform mat3 V3;
uniform vec2 cameraProj; uniform vec2 cameraProj;
#ifdef _CPostprocess
uniform vec3 PPComp9; uniform vec3 PPComp9;
uniform vec3 PPComp10; uniform vec3 PPComp10;
#endif
in vec3 viewRay; in vec3 viewRay;
in vec2 texCoord; in vec2 texCoord;

View file

@ -24,11 +24,13 @@
}, },
{ {
"name": "PPComp9", "name": "PPComp9",
"link": "_PPComp9" "link": "_PPComp9",
"ifdef": ["_CPostprocess"]
}, },
{ {
"name": "PPComp10", "name": "PPComp10",
"link": "_PPComp10" "link": "_PPComp10",
"ifdef": ["_CPostprocess"]
} }
], ],
"texture_params": [], "texture_params": [],