ShaderGen: Fix accidental locale-dependence in output

This commit is contained in:
Tony Wasserka 2024-09-19 21:52:08 +02:00
parent f859b5e94f
commit 1bf27b6fd9
2 changed files with 2 additions and 2 deletions

View file

@ -274,7 +274,7 @@ EmuDisplay::EmuDisplay(spdlog::logger& logger, vk::PhysicalDevice physical_devic
"\n"
"void main() {\n"
// NOTE: Alpha channel is set to 1.0 here because the Qt frontend requires this for overlay effects (blur, ...) to work
" out_color = vec4(texture(sampler0, -gl_FragCoord.yx * vec2(" + std::to_string(1.0 / height) + ", " + std::to_string(1.0 / width) + ")).rgb, 1.0);\n"
" out_color = vec4(texture(sampler0, -gl_FragCoord.yx * vec2(" + fmt::format("{}", 1.0 / height) + ", " + fmt::format("{}", 1.0 / width) + ")).rgb, 1.0);\n"
"}\n";
auto shader_spv = CompileShader(EShLangFragment, code.c_str(), "main");

View file

@ -1485,7 +1485,7 @@ uvec4 i[4];
glsl += "vec4 non_ieee_mul(vec4 a, vec4 b) { return vec4(non_ieee_mul(a.x, b.x), non_ieee_mul(a.y, b.y), non_ieee_mul(a.z, b.z), non_ieee_mul(a.w, b.w)); } \n\n";
} else {
// Fallback: convert INF to FLT32_MAX before multiplication
auto max_float = std::to_string(std::numeric_limits<float>::max());
auto max_float = fmt::format("{}", std::numeric_limits<float>::max());
glsl += "float non_ieee_mul(float a, float b) { return min(a, " + max_float + ") * min(b, " + max_float + "); } \n\n";
glsl += "vec2 non_ieee_mul(vec2 a, vec2 b) { return min(a, vec2(" + max_float + ")) * min(b, vec2(" + max_float + ")); } \n\n";
glsl += "vec3 non_ieee_mul(vec3 a, vec3 b) { return min(a, vec3(" + max_float + ")) * min(b, vec3(" + max_float + ")); } \n\n";