add negative float conversions to test constantUnaryConversion.comp

Add conversions from negative float16_t and float32_t to bool, all
signed integer types (i.e., including those in
GL_EXT_shader_explicit_arithmetic_types), and all float types (from the
same extension) to extend coverage.

Note that converting negative float values to unsigned integers is
undefined behavior. Thus, we exclude them.
This commit is contained in:
Marius Hillenbrand
2021-11-15 16:30:15 +01:00
committed by Greg Fischer
parent 7141f89a89
commit 0d85595e33
2 changed files with 133 additions and 4 deletions

View File

@@ -15,9 +15,16 @@ const float16_t float16_t_init = float16_t(42.0);
const float32_t float32_t_init = float32_t(13.0);
const float64_t float64_t_init = float64_t(-4.0);
const float16_t neg_float16_t_init = float16_t(-42.0);
const float32_t neg_float32_t_init = float32_t(-13.0);
const float64_t neg_float64_t_init = float64_t(-4.0);
#define TYPE_TO_TYPE(x, y) \
const x y##_to_##x = x(y##_init)
#define TYPE_TO_TYPE_PREFIX(prefix, x, y) \
const x prefix##_##y##_to_##x = x(prefix##_##y##_init)
#define TYPE_TO(x) \
TYPE_TO_TYPE(x, bool); \
TYPE_TO_TYPE(x, int8_t); \
@@ -45,4 +52,18 @@ TYPE_TO(float16_t);
TYPE_TO(float32_t);
TYPE_TO(float64_t);
#define NEG_FLOAT_TO(x) \
TYPE_TO_TYPE_PREFIX(neg, x, float16_t); \
TYPE_TO_TYPE_PREFIX(neg, x, float32_t); \
TYPE_TO_TYPE_PREFIX(neg, x, float64_t)
NEG_FLOAT_TO(bool);
NEG_FLOAT_TO(int8_t);
NEG_FLOAT_TO(int16_t);
NEG_FLOAT_TO(int32_t);
NEG_FLOAT_TO(int64_t);
NEG_FLOAT_TO(float16_t);
NEG_FLOAT_TO(float32_t);
NEG_FLOAT_TO(float64_t);
void main() {}