Merge pull request #475 from KhronosGroup/fix-convert-cast

Fix implicit conversion bug.
This commit is contained in:
Hans-Kristian Arntzen 2018-02-26 09:36:43 +01:00 committed by GitHub
commit cae17224a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2544,7 +2544,7 @@ string CompilerGLSL::convert_float_to_string(const SPIRConstant &c, uint32_t col
string res; string res;
float float_value = c.scalar_f32(col, row); float float_value = c.scalar_f32(col, row);
if (isnan(float_value) || isinf(float_value)) if (std::isnan(float_value) || std::isinf(float_value))
{ {
// Use special representation. // Use special representation.
if (!is_legacy()) if (!is_legacy())
@ -2578,7 +2578,7 @@ string CompilerGLSL::convert_float_to_string(const SPIRConstant &c, uint32_t col
else else
res = "(-1.0 / 0.0)"; res = "(-1.0 / 0.0)";
} }
else if (isnan(float_value)) else if (std::isnan(float_value))
{ {
if (backend.float_literal_suffix) if (backend.float_literal_suffix)
res = "(0.0f / 0.0f)"; res = "(0.0f / 0.0f)";
@ -2602,9 +2602,9 @@ string CompilerGLSL::convert_float_to_string(const SPIRConstant &c, uint32_t col
std::string CompilerGLSL::convert_double_to_string(const SPIRConstant &c, uint32_t col, uint32_t row) std::string CompilerGLSL::convert_double_to_string(const SPIRConstant &c, uint32_t col, uint32_t row)
{ {
string res; string res;
float double_value = c.scalar_f64(col, row); double double_value = c.scalar_f64(col, row);
if (isnan(double_value) || isinf(double_value)) if (std::isnan(double_value) || std::isinf(double_value))
{ {
// Use special representation. // Use special representation.
if (!is_legacy()) if (!is_legacy())
@ -2650,7 +2650,7 @@ std::string CompilerGLSL::convert_double_to_string(const SPIRConstant &c, uint32
else else
res = "(-1.0 / 0.0)"; res = "(-1.0 / 0.0)";
} }
else if (isnan(double_value)) else if (std::isnan(double_value))
{ {
if (backend.double_literal_suffix) if (backend.double_literal_suffix)
res = "(0.0lf / 0.0lf)"; res = "(0.0lf / 0.0lf)";