mirror of https://github.com/OpenRCT2/OpenRCT2.git
Improve shader compatibility with GLES (#14489)
This commit is contained in:
parent
7525f5d5da
commit
10bc3da9b9
|
@ -16,12 +16,12 @@ flat out uint fColour;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec2 pos = clamp(vVertMat * vBounds, vClip.xy, vClip.zw);
|
vec2 pos = clamp(vVertMat * vec4(vBounds), vec2(vClip.xy), vec2(vClip.zw));
|
||||||
|
|
||||||
// Transform screen coordinates to viewport coordinates
|
// Transform screen coordinates to viewport coordinates
|
||||||
pos = (pos * (2.0 / uScreenSize)) - 1.0;
|
pos = (pos * (2.0 / vec2(uScreenSize))) - 1.0;
|
||||||
pos.y *= -1;
|
pos.y *= -1.0;
|
||||||
float depth = 1.0 - (vDepth + 1) * DEPTH_INCREMENT;
|
float depth = 1.0 - (float(vDepth) + 1.0) * DEPTH_INCREMENT;
|
||||||
|
|
||||||
fColour = vColour;
|
fColour = vColour;
|
||||||
|
|
||||||
|
|
|
@ -30,16 +30,16 @@ flat out vec3 fPalettes;
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
// Clamp position by vClip, correcting interpolated values for the clipping
|
// Clamp position by vClip, correcting interpolated values for the clipping
|
||||||
vec2 m = clamp(((vVertMat * vClip) - (vVertMat * vBounds))/(vBounds.zw - vBounds.xy) + vVertVec, 0.0, 1.0);
|
vec2 m = clamp(((vVertMat * vec4(vClip)) - (vVertMat * vec4(vBounds)))/vec2(vBounds.zw - vBounds.xy) + vVertVec, 0.0, 1.0);
|
||||||
vec2 pos = mix(vBounds.xy, vBounds.zw, m);
|
vec2 pos = mix(vec2(vBounds.xy), vec2(vBounds.zw), m);
|
||||||
fTexColour = vec3(mix(vTexColourBounds.xy, vTexColourBounds.zw, m), vTexColourAtlas);
|
fTexColour = vec3(mix(vTexColourBounds.xy, vTexColourBounds.zw, m), vTexColourAtlas);
|
||||||
fTexMask = vec3(mix(vTexMaskBounds.xy, vTexMaskBounds.zw, m), vTexMaskAtlas);
|
fTexMask = vec3(mix(vTexMaskBounds.xy, vTexMaskBounds.zw, m), vTexMaskAtlas);
|
||||||
|
|
||||||
fPosition = pos;
|
fPosition = pos;
|
||||||
|
|
||||||
// Transform screen coordinates to texture coordinates
|
// Transform screen coordinates to texture coordinates
|
||||||
float depth = 1.0 - (vDepth + 1) * DEPTH_INCREMENT;
|
float depth = 1.0 - (float(vDepth) + 1.0) * DEPTH_INCREMENT;
|
||||||
pos = pos / uScreenSize;
|
pos = pos / vec2(uScreenSize);
|
||||||
pos.y = pos.y * -1.0 + 1.0;
|
pos.y = pos.y * -1.0 + 1.0;
|
||||||
fPeelPos = vec3(pos, depth * 0.5 + 0.5);
|
fPeelPos = vec3(pos, depth * 0.5 + 0.5);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue