diff --git a/src/writer/glsl/generator_impl.cc b/src/writer/glsl/generator_impl.cc index 6fbc70fa99..32b4d94ae2 100644 --- a/src/writer/glsl/generator_impl.cc +++ b/src/writer/glsl/generator_impl.cc @@ -2081,9 +2081,10 @@ bool GeneratorImpl::EmitLiteral(std::ostream& out, out << (l->value ? "true" : "false"); } else if (auto* fl = lit->As()) { if (std::isinf(fl->value)) { - out << (fl->value >= 0 ? "asfloat(0x7f800000u)" : "asfloat(0xff800000u)"); + out << (fl->value >= 0 ? "uintBitsToFloat(0x7f800000u)" + : "uintBitsToFloat(0xff800000u)"); } else if (std::isnan(fl->value)) { - out << "asfloat(0x7fc00000u)"; + out << "uintBitsToFloat(0x7fc00000u)"; } else { out << FloatToString(fl->value) << "f"; } diff --git a/test/bug/tint/951.spvasm.expected.glsl b/test/bug/tint/951.spvasm.expected.glsl index 47667e8a22..d638979222 100644 --- a/test/bug/tint/951.spvasm.expected.glsl +++ b/test/bug/tint/951.spvasm.expected.glsl @@ -1,5 +1,3 @@ -SKIP: FAILED - #version 310 es precision mediump float; @@ -28,7 +26,7 @@ float getAAtOutCoords_() { float unaryOperation_f1_(inout float a) { float x_47 = a; if ((x_47 < 0.0f)) { - return asfloat(0x7f800000u); + return uintBitsToFloat(0x7f800000u); } float x_55 = a; return log(x_55); @@ -84,10 +82,3 @@ void main() { } -Error parsing GLSL shader: -ERROR: 0:29: 'asfloat' : no matching overloaded function found -ERROR: 0:29: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/expressions/literals/-inf.spvasm.expected.glsl b/test/expressions/literals/-inf.spvasm.expected.glsl index 6bad4d50eb..bf214c6250 100644 --- a/test/expressions/literals/-inf.spvasm.expected.glsl +++ b/test/expressions/literals/-inf.spvasm.expected.glsl @@ -1,12 +1,10 @@ -SKIP: FAILED - #version 310 es precision mediump float; vec4 out_var_SV_TARGET = vec4(0.0f, 0.0f, 0.0f, 0.0f); void main_1() { - out_var_SV_TARGET = vec4(asfloat(0xff800000u), asfloat(0xff800000u), asfloat(0xff800000u), asfloat(0xff800000u)); + out_var_SV_TARGET = vec4(uintBitsToFloat(0xff800000u), uintBitsToFloat(0xff800000u), uintBitsToFloat(0xff800000u), uintBitsToFloat(0xff800000u)); return; } @@ -37,10 +35,3 @@ void main() { } -Error parsing GLSL shader: -ERROR: 0:7: 'asfloat' : no matching overloaded function found -ERROR: 0:7: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/expressions/literals/inf.spvasm.expected.glsl b/test/expressions/literals/inf.spvasm.expected.glsl index 46738b07c4..b06b5f949b 100644 --- a/test/expressions/literals/inf.spvasm.expected.glsl +++ b/test/expressions/literals/inf.spvasm.expected.glsl @@ -1,12 +1,10 @@ -SKIP: FAILED - #version 310 es precision mediump float; vec4 out_var_SV_TARGET = vec4(0.0f, 0.0f, 0.0f, 0.0f); void main_1() { - out_var_SV_TARGET = vec4(asfloat(0x7f800000u), asfloat(0x7f800000u), asfloat(0x7f800000u), asfloat(0x7f800000u)); + out_var_SV_TARGET = vec4(uintBitsToFloat(0x7f800000u), uintBitsToFloat(0x7f800000u), uintBitsToFloat(0x7f800000u), uintBitsToFloat(0x7f800000u)); return; } @@ -37,10 +35,3 @@ void main() { } -Error parsing GLSL shader: -ERROR: 0:7: 'asfloat' : no matching overloaded function found -ERROR: 0:7: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - - diff --git a/test/expressions/literals/nan.spvasm.expected.glsl b/test/expressions/literals/nan.spvasm.expected.glsl index eff4ad4629..4ce65a816b 100644 --- a/test/expressions/literals/nan.spvasm.expected.glsl +++ b/test/expressions/literals/nan.spvasm.expected.glsl @@ -1,12 +1,10 @@ -SKIP: FAILED - #version 310 es precision mediump float; vec4 out_var_SV_TARGET = vec4(0.0f, 0.0f, 0.0f, 0.0f); void main_1() { - out_var_SV_TARGET = vec4(asfloat(0x7fc00000u), asfloat(0x7fc00000u), asfloat(0x7fc00000u), asfloat(0x7fc00000u)); + out_var_SV_TARGET = vec4(uintBitsToFloat(0x7fc00000u), uintBitsToFloat(0x7fc00000u), uintBitsToFloat(0x7fc00000u), uintBitsToFloat(0x7fc00000u)); return; } @@ -37,10 +35,3 @@ void main() { } -Error parsing GLSL shader: -ERROR: 0:7: 'asfloat' : no matching overloaded function found -ERROR: 0:7: '' : compilation terminated -ERROR: 2 compilation errors. No code generated. - - -