From a1138bacff8069c77bd9a303edd99b5f5712409d Mon Sep 17 00:00:00 2001 From: Arcady Goldmints-Orlov Date: Wed, 29 Nov 2023 19:22:10 -0500 Subject: [PATCH] Improve overflow_underflow_toinf_0 test somewhat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add test cases that will make explicit ±0.0 and ±INF appear in the AST output to make sure those cases are handled correctly. --- .../overflow_underflow_toinf_0.frag.out | 44 +++++++++++++------ Test/overflow_underflow_toinf_0.frag | 15 ++++--- 2 files changed, 38 insertions(+), 21 deletions(-) diff --git a/Test/baseResults/overflow_underflow_toinf_0.frag.out b/Test/baseResults/overflow_underflow_toinf_0.frag.out index c2551f8a..621d1978 100644 --- a/Test/baseResults/overflow_underflow_toinf_0.frag.out +++ b/Test/baseResults/overflow_underflow_toinf_0.frag.out @@ -14,15 +14,23 @@ Shader version: 320 0:10 'correct1' ( temp highp float) 0:10 Constant: 0:10 1.000000 -0:11 move second child to first child ( temp highp 4-component vector of float) -0:11 'my_FragColor' ( out highp 4-component vector of float) -0:11 Construct vec4 ( temp highp 4-component vector of float) +0:11 Sequence +0:11 move second child to first child ( temp highp 4-component vector of float) +0:11 'foo' ( temp highp 4-component vector of float) 0:11 Constant: 0:11 0.000000 -0:11 'correct' ( temp highp float) -0:11 'correct1' ( temp highp float) -0:11 Constant: -0:11 1.000000 +0:11 -0.000000 +0:11 +1.#INF +0:11 -1.#INF +0:12 move second child to first child ( temp highp 4-component vector of float) +0:12 'my_FragColor' ( out highp 4-component vector of float) +0:12 Construct vec4 ( temp highp 4-component vector of float) +0:12 Constant: +0:12 0.000000 +0:12 'correct' ( temp highp float) +0:12 'correct1' ( temp highp float) +0:12 Constant: +0:12 1.000000 0:? Linker Objects 0:? 'my_FragColor' ( out highp 4-component vector of float) @@ -45,15 +53,23 @@ Shader version: 320 0:10 'correct1' ( temp highp float) 0:10 Constant: 0:10 1.000000 -0:11 move second child to first child ( temp highp 4-component vector of float) -0:11 'my_FragColor' ( out highp 4-component vector of float) -0:11 Construct vec4 ( temp highp 4-component vector of float) +0:11 Sequence +0:11 move second child to first child ( temp highp 4-component vector of float) +0:11 'foo' ( temp highp 4-component vector of float) 0:11 Constant: 0:11 0.000000 -0:11 'correct' ( temp highp float) -0:11 'correct1' ( temp highp float) -0:11 Constant: -0:11 1.000000 +0:11 -0.000000 +0:11 +1.#INF +0:11 -1.#INF +0:12 move second child to first child ( temp highp 4-component vector of float) +0:12 'my_FragColor' ( out highp 4-component vector of float) +0:12 Construct vec4 ( temp highp 4-component vector of float) +0:12 Constant: +0:12 0.000000 +0:12 'correct' ( temp highp float) +0:12 'correct1' ( temp highp float) +0:12 Constant: +0:12 1.000000 0:? Linker Objects 0:? 'my_FragColor' ( out highp 4-component vector of float) diff --git a/Test/overflow_underflow_toinf_0.frag b/Test/overflow_underflow_toinf_0.frag index 2e557577..0b1d1b99 100644 --- a/Test/overflow_underflow_toinf_0.frag +++ b/Test/overflow_underflow_toinf_0.frag @@ -1,12 +1,13 @@ - #version 320 es - precision highp float; - out vec4 my_FragColor; - void main() - { +#version 320 es +precision highp float; +out vec4 my_FragColor; +void main() +{ // GLSL ES 3.00.6 section 4.1.4 Floats: // "A value with a magnitude too small to be represented as a mantissa and exponent is converted to zero." // 1.0e-50 is small enough that it can't even be stored as subnormal. float correct = (1.0e-50 == 0.0) ? 1.0 : 0.0; - float correct1 = isinf(1.0e40) ? 1.0 : 0.0; + float correct1 = isinf(1.0e40) ? 1.0 : 0.0; + vec4 foo = vec4(1.0e-50, -1.0e-50, 1.0e50, -1.0e50); my_FragColor = vec4(0.0, correct, correct1, 1.0); - } \ No newline at end of file +}