nv2a: Set C numeric locale before shader gen

This commit is contained in:
Matt Borgerson 2022-06-25 14:14:08 -07:00 committed by mborgerson
parent b3abb982e8
commit be8b612186
2 changed files with 16 additions and 2 deletions

View File

@ -21,6 +21,7 @@
#include "qemu/osdep.h"
#include "qemu-common.h"
#include <locale.h>
#include "shaders_common.h"
#include "shaders.h"
@ -941,11 +942,19 @@ static GLuint create_gl_shader(GLenum gl_shader_type,
return shader;
}
ShaderBinding* generate_shaders(const ShaderState *state)
ShaderBinding *generate_shaders(const ShaderState *state)
{
int i, j;
char tmp[64];
char *previous_numeric_locale = setlocale(LC_NUMERIC, NULL);
if (previous_numeric_locale) {
previous_numeric_locale = g_strdup(previous_numeric_locale);
}
/* Ensure numeric values are printed with '.' radix, no grouping */
setlocale(LC_NUMERIC, "C");
char vtx_prefix;
GLuint program = glCreateProgram();
@ -1092,5 +1101,10 @@ ShaderBinding* generate_shaders(const ShaderState *state)
ret->material_alpha_loc = -1;
}
if (previous_numeric_locale) {
setlocale(LC_NUMERIC, previous_numeric_locale);
g_free(previous_numeric_locale);
}
return ret;
}

View File

@ -134,6 +134,6 @@ typedef struct ShaderBinding {
GLint material_alpha_loc;
} ShaderBinding;
ShaderBinding* generate_shaders(const ShaderState *state);
ShaderBinding *generate_shaders(const ShaderState *state);
#endif