7a6c2da9aa
GLSL and RelaxedPrecision are quite different in what they affect. RelaxedPrecision affects operations, while this is merely implied in GLSL based on inputs. This leads to situations where we have to promote mediump inputs to highp, and the simplest approach is to force highp temporaries for inputs which are consumed in a highp context. For completeness, we also demote RelaxedPrecision inputs to mediump variables. PHI is handled by copying the PHI into a temporary. We have to be very careful with hoisted temporaries, since the child temporary will not be analyzed up-front. We inherit the hoisted-ness state and emit the hoisted child temporary as necessary. When faking the temporaries with OpCopyObject, we make sure to block any variable hoisting. Hoisting children of PHI variables is fine, since PHIs are not hoisted with the same framework as other temporaries.
25 lines
1.1 KiB
Plaintext
25 lines
1.1 KiB
Plaintext
#version 310 es
|
|
precision mediump float;
|
|
precision highp int;
|
|
|
|
layout(set = 0, binding = 1) uniform mediump texture2D uTexture[4];
|
|
layout(set = 0, binding = 0) uniform mediump sampler uSampler;
|
|
layout(set = 0, binding = 4) uniform mediump texture2DArray uTextureArray[4];
|
|
layout(set = 0, binding = 3) uniform mediump textureCube uTextureCube[4];
|
|
layout(set = 0, binding = 2) uniform mediump texture3D uTexture3D[4];
|
|
|
|
layout(location = 0) in vec2 vTex;
|
|
layout(location = 1) in vec3 vTex3;
|
|
layout(location = 0) out vec4 FragColor;
|
|
|
|
void main()
|
|
{
|
|
highp vec2 _76 = vec2(1.0) / vec2(textureSize(sampler2D(uTexture[1], uSampler), 0));
|
|
vec2 mp_copy_76 = _76;
|
|
highp vec2 _86 = vec2(1.0) / vec2(textureSize(sampler2D(uTexture[2], uSampler), 1));
|
|
vec2 mp_copy_86 = _86;
|
|
vec2 _95 = (vTex + mp_copy_76) + mp_copy_86;
|
|
FragColor = ((((texture(sampler2D(uTexture[2], uSampler), _95) + texture(sampler2D(uTexture[1], uSampler), _95)) + texture(sampler2D(uTexture[1], uSampler), _95)) + texture(sampler2DArray(uTextureArray[3], uSampler), vTex3)) + texture(samplerCube(uTextureCube[1], uSampler), vTex3)) + texture(sampler3D(uTexture3D[2], uSampler), vTex3);
|
|
}
|
|
|