nv2a: Move numeric locale setup to main

This commit is contained in:
Matt Borgerson
2025-07-02 20:01:13 -07:00
committed by mborgerson
parent 4921607c90
commit 90a0187e9b
3 changed files with 3 additions and 27 deletions

View File

@ -22,7 +22,6 @@
#include "qemu/osdep.h"
#include "qemu/fast-hash.h"
#include "qemu/mstring.h"
#include <locale.h>
#include "xemu-version.h"
#include "ui/xemu-settings.h"
@ -195,13 +194,6 @@ static GLuint get_shader_module_for_key(PGRAPHGLState *r,
static void generate_shaders(PGRAPHGLState *r, ShaderBinding *binding)
{
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");
GLuint program = glCreateProgram();
ShaderState *state = &binding->state;
@ -260,11 +252,6 @@ static void generate_shaders(PGRAPHGLState *r, ShaderBinding *binding)
}
update_shader_uniform_locs(binding);
if (previous_numeric_locale) {
setlocale(LC_NUMERIC, previous_numeric_locale);
g_free(previous_numeric_locale);
}
}
static const char *shader_gl_vendor = NULL;

View File

@ -28,7 +28,6 @@
#include "qemu/fast-hash.h"
#include "qemu/mstring.h"
#include "renderer.h"
#include <locale.h>
#define VSH_UBO_BINDING 0
#define PSH_UBO_BINDING 1
@ -401,14 +400,6 @@ static ShaderBinding *gen_shaders(PGRAPHState *pg, ShaderState *state)
NV2A_VK_DPRINTF("cache miss");
nv2a_profile_inc_counter(NV2A_PROF_SHADER_GEN);
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");
ShaderModuleCacheKey key;
bool need_geometry_shader = pgraph_glsl_need_geom(&state->geom);
@ -441,11 +432,6 @@ static ShaderBinding *gen_shaders(PGRAPHState *pg, ShaderState *state)
key.psh.glsl_opts.tex_binding = PSH_TEX_BINDING;
snode->psh.module_info = get_and_ref_shader_module_for_key(r, &key);
if (previous_numeric_locale) {
setlocale(LC_NUMERIC, previous_numeric_locale);
g_free(previous_numeric_locale);
}
update_shader_uniform_locs(snode);
snode->initialized = true;

View File

@ -58,6 +58,7 @@
#include "ui/xemu-notifications.h"
#include <stb_image.h>
#include <locale.h>
#ifdef _WIN32
// Provide hint to prefer high-performance graphics for hybrid systems
@ -1268,6 +1269,8 @@ int main(int argc, char **argv)
{
QemuThread thread;
setlocale(LC_NUMERIC, "C");
#ifdef _WIN32
if (AttachConsole(ATTACH_PARENT_PROCESS)) {
// Launched with a console. If stdout and stderr are not associated with