port from perforce
This commit is contained in:
4
hgplus/ShaderMinifier/tests/unit/1.simple.frag
Normal file
4
hgplus/ShaderMinifier/tests/unit/1.simple.frag
Normal file
@@ -0,0 +1,4 @@
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = vec4(0.2, 0.4, 0.6, 0.);
|
||||
}
|
||||
4
hgplus/ShaderMinifier/tests/unit/2.simple.frag
Normal file
4
hgplus/ShaderMinifier/tests/unit/2.simple.frag
Normal file
@@ -0,0 +1,4 @@
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = vec4(0.2, 0.4, 0.6, 0.);
|
||||
}
|
||||
1
hgplus/ShaderMinifier/tests/unit/2.simple.opt.frag
Normal file
1
hgplus/ShaderMinifier/tests/unit/2.simple.opt.frag
Normal file
@@ -0,0 +1 @@
|
||||
void main(){gl_FragColor=vec4(.2,.4,.6,0.);}
|
||||
36
hgplus/ShaderMinifier/tests/unit/blocks.frag
Normal file
36
hgplus/ShaderMinifier/tests/unit/blocks.frag
Normal file
@@ -0,0 +1,36 @@
|
||||
float test_if()
|
||||
{
|
||||
int foo = 2;
|
||||
float bar;
|
||||
if (foo == 2)
|
||||
foo++;
|
||||
if (foo < 5)
|
||||
if (foo == 3)
|
||||
bar = 0.2;
|
||||
else
|
||||
bar = 0.3;
|
||||
else
|
||||
bar = 0.4;
|
||||
}
|
||||
|
||||
float test_for()
|
||||
{
|
||||
int foo = 2;
|
||||
int n = 0;
|
||||
for (int i = 0; i < 4; i++)
|
||||
foo += i;
|
||||
for (foo++; n < 4 ; n++)
|
||||
{
|
||||
int k = n - 1;
|
||||
foo += k;
|
||||
}
|
||||
return 1. / float(k);
|
||||
}
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
float a = test_if();
|
||||
float b = test_for();
|
||||
gl_FragColor=vec4(.2,a,b,0.);
|
||||
}
|
||||
17
hgplus/ShaderMinifier/tests/unit/float.frag
Normal file
17
hgplus/ShaderMinifier/tests/unit/float.frag
Normal file
@@ -0,0 +1,17 @@
|
||||
void main()
|
||||
{
|
||||
float f1 = 1.5;
|
||||
float f2 = .0000003;
|
||||
float f3 = .42;
|
||||
float f4 = .0;
|
||||
float f5 = 0.;
|
||||
float f6 = -2e-3;
|
||||
float f7 = 2E-9;
|
||||
float f8 = 2E+6;
|
||||
float f9 = 2e10;
|
||||
|
||||
float n = 1. / (f1 + f2 + f3 + f4 + f5);
|
||||
float o = 1. / (f6 * f8 * f7 * f9);
|
||||
|
||||
gl_FragColor=vec4(n,o,n,0.);
|
||||
}
|
||||
5
hgplus/ShaderMinifier/tests/unit/functions.frag
Normal file
5
hgplus/ShaderMinifier/tests/unit/functions.frag
Normal file
@@ -0,0 +1,5 @@
|
||||
static float3 color;
|
||||
|
||||
void function(out int i, int j){
|
||||
i=j;
|
||||
}
|
||||
7
hgplus/ShaderMinifier/tests/unit/hexa.frag
Normal file
7
hgplus/ShaderMinifier/tests/unit/hexa.frag
Normal file
@@ -0,0 +1,7 @@
|
||||
void main()
|
||||
{
|
||||
float n = float(0xff) / 1000.;
|
||||
float o = float(-0XFF) / 1000.;
|
||||
float p = n - o + 4 * 0x0;
|
||||
gl_FragColor=vec4(.2,.4,n,0.);
|
||||
}
|
||||
9
hgplus/ShaderMinifier/tests/unit/numbers.frag
Normal file
9
hgplus/ShaderMinifier/tests/unit/numbers.frag
Normal file
@@ -0,0 +1,9 @@
|
||||
void main()
|
||||
{
|
||||
float oct = float(042) / 1000.;
|
||||
float oct2 = float(-071) / 1000.;
|
||||
int dec = 65535;
|
||||
int dec2 = -65536;
|
||||
float n = oct - oct2 + 4 * 0x0 + float(dec + dec2) / 20.;
|
||||
gl_FragColor=vec4(n,n,n,0.);
|
||||
}
|
||||
15
hgplus/ShaderMinifier/tests/unit/overload.frag
Normal file
15
hgplus/ShaderMinifier/tests/unit/overload.frag
Normal file
@@ -0,0 +1,15 @@
|
||||
float f1() { return 0.1; }
|
||||
float f2(void) { return 0.2; }
|
||||
float f1(int x) { return 0.3; }
|
||||
float f2(float y) { return 0.4; }
|
||||
float f3(bool b) { return 0.5; }
|
||||
float f3(int a, int b) { return 0.6; }
|
||||
float f3(int a, int b, int c, int d) { return 0.7; }
|
||||
|
||||
void main()
|
||||
{
|
||||
float a = f1() + 2. * f1(0);
|
||||
float b = 2. * f2(1) - f2();
|
||||
float c = f3(true) + f3(0, 1) - f3(0, 1, 2, 3);
|
||||
gl_FragColor=vec4(a,b,c,0.);
|
||||
}
|
||||
14
hgplus/ShaderMinifier/tests/unit/precedence.frag
Normal file
14
hgplus/ShaderMinifier/tests/unit/precedence.frag
Normal file
@@ -0,0 +1,14 @@
|
||||
void main()
|
||||
{
|
||||
float f1 = 2. * 3. / 4. - 5. / 6.;
|
||||
float f2 = (true ? false ? 1. : 2. : 3. * 4.) * 5.;
|
||||
float f3 = 4. * (false ? (true ? 1. : 2.) : 3.);
|
||||
float f4 = float((2+3) * (4+5*6) - (7-8));
|
||||
float f5 = (2.+f1) * (4.+f2*6.) - (7.-f3);
|
||||
float f6 = -------5.;
|
||||
|
||||
float n = 1. / (f1 + f2 + f3)
|
||||
float o = 1. / (f4 * f5 * f6);
|
||||
|
||||
gl_FragColor=vec4(n,o,n,0.);
|
||||
}
|
||||
16
hgplus/ShaderMinifier/tests/unit/rename_conflict.frag
Normal file
16
hgplus/ShaderMinifier/tests/unit/rename_conflict.frag
Normal file
@@ -0,0 +1,16 @@
|
||||
// test with --no-renaming-list i
|
||||
|
||||
int foo(int a, int d)
|
||||
{
|
||||
return a + 1;
|
||||
}
|
||||
|
||||
int i()
|
||||
{
|
||||
foo(0);
|
||||
}
|
||||
|
||||
int bar(int b, int c, int d)
|
||||
{
|
||||
return b + i();
|
||||
}
|
||||
4
hgplus/ShaderMinifier/tests/unit/simple.frag
Normal file
4
hgplus/ShaderMinifier/tests/unit/simple.frag
Normal file
@@ -0,0 +1,4 @@
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = vec4(0.2, 0.4, 0.6, 0.);
|
||||
}
|
||||
11
hgplus/ShaderMinifier/tests/unit/suffix.frag
Normal file
11
hgplus/ShaderMinifier/tests/unit/suffix.frag
Normal file
@@ -0,0 +1,11 @@
|
||||
void main()
|
||||
{
|
||||
int n1 = 41u;
|
||||
int n2 = 42U;
|
||||
float f1 = 1.20LF;
|
||||
float f2 = 3.F;
|
||||
float f3 = .0003lf;
|
||||
float f7 = 2E-9f;
|
||||
|
||||
float foo = - (- 2.f);
|
||||
}
|
||||
Reference in New Issue
Block a user