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.
36 lines
640 B
GLSL
36 lines
640 B
GLSL
#version 310 es
|
|
precision mediump float;
|
|
precision highp int;
|
|
|
|
struct ResType
|
|
{
|
|
highp float _m0;
|
|
int _m1;
|
|
};
|
|
|
|
struct ResType_1
|
|
{
|
|
highp vec2 _m0;
|
|
ivec2 _m1;
|
|
};
|
|
|
|
layout(location = 0) in float v0;
|
|
layout(location = 1) in vec2 v1;
|
|
layout(location = 0) out float FragColor;
|
|
|
|
void main()
|
|
{
|
|
ResType _22;
|
|
_22._m0 = frexp(v0 + 1.0, _22._m1);
|
|
highp float _24 = _22._m0;
|
|
float mp_copy_24 = _24;
|
|
ResType_1 _35;
|
|
_35._m0 = frexp(v1, _35._m1);
|
|
float r0;
|
|
float _41 = modf(v0, r0);
|
|
vec2 r1;
|
|
vec2 _45 = modf(v1, r1);
|
|
FragColor = ((((mp_copy_24 + _35._m0.x) + _35._m0.y) + _41) + _45.x) + _45.y;
|
|
}
|
|
|