Add a test for floating point exponent overflow

This adds a test with a floating point exponent that can't fit into a
32-bit int.
This commit is contained in:
“jimihe” 2024-03-25 16:10:18 +08:00 committed by arcady-lunarg
parent d24cda64d1
commit ac5341fe91
3 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,51 @@
positive_infinity.frag
Shader version: 300
0:? Sequence
0:4 Function Definition: main( ( global void)
0:4 Function Parameters:
0:9 Sequence
0:9 Sequence
0:9 move second child to first child ( temp highp float)
0:9 'correct' ( temp highp float)
0:9 Constant:
0:9 1.000000
0:10 move second child to first child ( temp highp 4-component vector of float)
0:10 'my_FragColor' ( out highp 4-component vector of float)
0:10 Construct vec4 ( temp highp 4-component vector of float)
0:10 Constant:
0:10 0.000000
0:10 'correct' ( temp highp float)
0:10 Constant:
0:10 0.000000
0:10 Constant:
0:10 1.000000
0:? Linker Objects
0:? 'my_FragColor' ( out highp 4-component vector of float)
Linked fragment stage:
Shader version: 300
0:? Sequence
0:4 Function Definition: main( ( global void)
0:4 Function Parameters:
0:9 Sequence
0:9 Sequence
0:9 move second child to first child ( temp highp float)
0:9 'correct' ( temp highp float)
0:9 Constant:
0:9 1.000000
0:10 move second child to first child ( temp highp 4-component vector of float)
0:10 'my_FragColor' ( out highp 4-component vector of float)
0:10 Construct vec4 ( temp highp 4-component vector of float)
0:10 Constant:
0:10 0.000000
0:10 'correct' ( temp highp float)
0:10 Constant:
0:10 0.000000
0:10 Constant:
0:10 1.000000
0:? Linker Objects
0:? 'my_FragColor' ( out highp 4-component vector of float)

View File

@ -0,0 +1,11 @@
#version 300 es
precision highp float;
out vec4 my_FragColor;
void main()
{
// Out-of-range floats should overflow to infinity
// GLSL ES 3.00.6 section 4.1.4 Floats:
// "If the value of the floating point number is too large (small) to be stored as a single precision value, it is converted to positive (negative) infinity"
float correct = isinf(1.0e2147483649) ? 1.0 : 0.0;
my_FragColor = vec4(0.0, correct, 0.0, 1.0);
}

View File

@ -309,6 +309,7 @@ INSTANTIATE_TEST_SUITE_P(
"GL_EXT_draw_instanced.vert",
"overflow_underflow_toinf_0.frag",
"GL_EXT_texture_array.frag",
"positive_infinity.frag",
})),
FileNameAsCustomTestSuffix
);