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.
54 lines
1.7 KiB
GLSL
54 lines
1.7 KiB
GLSL
#version 320 es
|
|
precision mediump float;
|
|
precision highp int;
|
|
|
|
layout(binding = 0, std140) uniform UBO
|
|
{
|
|
float mediump_float;
|
|
highp float highp_float;
|
|
} ubo;
|
|
|
|
layout(location = 0) out vec4 FragColor0;
|
|
layout(location = 1) out vec4 FragColor1;
|
|
layout(location = 2) out vec4 FragColor2;
|
|
layout(location = 3) out vec4 FragColor3;
|
|
layout(location = 0) in vec4 V4;
|
|
|
|
void main()
|
|
{
|
|
vec4 V4_value0 = V4;
|
|
highp vec4 hp_copy_V4_value0 = V4_value0;
|
|
float V1_value0 = V4.x;
|
|
highp float hp_copy_V1_value0 = V1_value0;
|
|
float V1_value2 = V4_value0.z;
|
|
highp float hp_copy_V1_value2 = V1_value2;
|
|
float ubo_mp0 = ubo.mediump_float;
|
|
highp float hp_copy_ubo_mp0 = ubo_mp0;
|
|
highp float ubo_hp0 = ubo.highp_float;
|
|
float mp_copy_ubo_hp0 = ubo_hp0;
|
|
highp vec4 _48 = hp_copy_V4_value0 - vec4(3.0);
|
|
vec4 mp_copy_48 = _48;
|
|
FragColor0 = V4_value0 + vec4(3.0);
|
|
FragColor1 = _48;
|
|
FragColor2 = mp_copy_48 * vec4(3.0);
|
|
float _21 = V1_value0 + 3.0;
|
|
float float_0_weird = 3.0 - mp_copy_ubo_hp0;
|
|
highp float hp_copy_float_0_weird = float_0_weird;
|
|
highp float _49 = hp_copy_V1_value0 - hp_copy_float_0_weird;
|
|
float mp_copy_49 = _49;
|
|
FragColor3 = vec4(_21, _49, mp_copy_49 * mp_copy_ubo_hp0, 3.0);
|
|
highp float _51 = hp_copy_V1_value2 - hp_copy_ubo_mp0;
|
|
float mp_copy_51 = _51;
|
|
FragColor3 = vec4(V4_value0.z + ubo_mp0, _51, mp_copy_51 * mp_copy_ubo_hp0, 3.0);
|
|
FragColor0 = sin(hp_copy_V4_value0);
|
|
FragColor1 = sin(V4_value0);
|
|
float phi_mp;
|
|
highp float phi_hp;
|
|
phi_mp = _21;
|
|
phi_hp = _49;
|
|
highp float hp_copy_phi_mp = phi_mp;
|
|
float mp_copy_phi_hp = phi_hp;
|
|
FragColor2 = vec4(phi_mp + phi_mp, hp_copy_phi_mp + hp_copy_phi_mp, mp_copy_phi_hp + mp_copy_phi_hp, phi_hp + phi_hp);
|
|
}
|
|
|