Fix implicit conversion bug.

This commit is contained in:
Hans-Kristian Arntzen 2018-02-26 09:15:52 +01:00
parent b39c0630f3
commit e69b1aeed8

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)";