File: fs-isinf-dvec.shader_test

package info (click to toggle)
piglit 0~git20200212-f4710c51b-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 106,972 kB
  • sloc: ansic: 263,763; xml: 48,941; python: 29,918; lisp: 19,789; cpp: 12,142; sh: 22; makefile: 20; pascal: 5
file content (66 lines) | stat: -rw-r--r-- 1,734 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Test proper behavior of the isinf(vec4) function.
#
# Note: testing behavior if isinf() is challenging because the GLSL
# 1.50 spec does not explicitly define any circumstances under which
# infinite values are required to be generated.  This test assumes
# that the expressions 1.0*exp(1000.0) and -1.0*exp(1000.0) produce
# infinite values when evaluated in the shader.

[require]
GLSL >= 1.50
GL_ARB_gpu_shader_fp64

[vertex shader passthrough]

[fragment shader]
#version 150
#extension GL_ARB_gpu_shader_fp64 : require

uniform double tolerance;
uniform dvec4 multiplier;
uniform vec4 exponent;
uniform dvec4 expected;

void main()
{
	gl_FragColor = vec4(0.0);

	dvec4 r4 = multiplier*exp(exponent);
	dvec4 bl4 = dvec4(isinf(r4));
	if (distance(bl4, expected) > tolerance)
		gl_FragColor.x = 1.0;

	dvec3 r3 = multiplier.xyz*exp(exponent.xyz);
	dvec3 bl3 = dvec3(isinf(r3));
	if (distance(bl3, expected.xyz) > tolerance)
		gl_FragColor.y = 1.0;

	dvec2 r2 = multiplier.zw*exp(exponent.zw);
	dvec2 bl2 = dvec2(isinf(r2));
	if (distance(bl2, expected.zw) > tolerance)
		gl_FragColor.z = 1.0;

	double r1 = multiplier.x*exp(exponent.x);
	double bl1 = double(isinf(r1));
	if (distance(bl1, expected.x) > tolerance)
		gl_FragColor.w = 1.0;
}

[test]
clear color 0.0 0.0 1.0 0.0

clear
uniform double tolerance 0.0
uniform dvec4 multiplier 1.0 1.0   -1.0   -1.0
uniform vec4 exponent    1.0 1000.0 1000.0 1.0
uniform dvec4 expected   0.0 1.0    1.0    0.0
draw rect -1 -1 2 2
probe rgba 0 0 0.0 0.0 0.0 0.0

clear
uniform double tolerance  0.0
uniform dvec4 multiplier -1.0   -1.0 1.0 1.0
uniform vec4 exponent     1000.0 1.0 1.0 1000.0
uniform dvec4 expected    1.0    0.0 0.0 1.0
draw rect -1 -1 2 2
probe rgba 1 0 0.0 0.0 0.0 0.0