Add constant folding for the exp*(), log*(), *sqrt(), round*(), floor(), fract(), ceil(), abs(), and sign() built in functions.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21927 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
@@ -13,7 +13,14 @@ const vec2 pytho = vec2(3.0, 4.0);
|
||||
in vec4 inv;
|
||||
out vec4 FragColor;
|
||||
out vec2 out2;
|
||||
|
||||
out vec4 out3;
|
||||
out vec4 out4;
|
||||
out ivec4 out5;
|
||||
out vec3 out6;
|
||||
out vec4 out7;
|
||||
out vec4 out8;
|
||||
out vec4 out9;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 dx = dFdx(inv);
|
||||
@@ -30,4 +37,11 @@ void main()
|
||||
vec4 arrayMin[int(min(float(array2.length()), float(array3.length())))];
|
||||
FragColor = vec4(arrayMax.length(), arrayMin.length(), sin(3.14), cos(3.14)); // 3, 2, .00159, -.999
|
||||
out2 = length(pytho) + normalize(pytho) + dFdx(pytho) + dFdy(pytho) + fwidth(pytho); // 5+3/5, 5+4/5
|
||||
out3 = vec4(exp(3.0), log(10.0), exp2(4.0), log2(256.0)); // 20.08, 2.3, 16, 8
|
||||
out4 = vec4(sqrt(100.0), inversesqrt(100.0), abs(-4.7), abs(10.9)); // 10, .1, 4.7, 10.9
|
||||
out5 = ivec4(abs(-8) + sign(0), abs(17), sign(-12), sign(9)); // 8, 17, -1, 1
|
||||
out6 = vec3(sign(-8.8), sign(18.0), sign(0.0)); // -1.0, 1.0, 0.0
|
||||
out7 = vec4(floor(4.2), ceil(-4.1), trunc(5.9), trunc(-5.9)); // 4, -4, 5, -5
|
||||
out8 = vec4(round(4.4), round(4.6), roundEven(4.5), roundEven(-5.5)); // 4, 5, 4, -6
|
||||
out9 = vec4(roundEven(7.5), roundEven(-4.5), fract(2.345), fract(-2.6)); // 8, -4, .345, 0.4
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user