glcommon: disable norm16 formats on nouveau

These seem to be broken
This commit is contained in:
Andrei Alexeyev 2023-08-31 00:49:43 +02:00
parent 4aba2a925b
commit 5d54618667
No known key found for this signature in database
GPG key ID: 72D26128040B9690
2 changed files with 25 additions and 1 deletions

View file

@ -329,6 +329,11 @@ static void glcommon_ext_clear_texture(void) {
static void glcommon_ext_texture_norm16(void) {
EXT_FLAG(texture_norm16);
if(glext.issues.disable_norm16) {
EXT_MISSING();
return;
}
CHECK_CORE(!glext.version.is_es);
/*
@ -796,12 +801,29 @@ static const char *detect_slow_sampler_update(void) {
return NULL;
}
static const char *detect_broken_norm16(void) {
const char *gl_vendor = get_unmasked_property(GL_VENDOR, true);
const char *gl_renderer = get_unmasked_property(GL_RENDERER, true);
if(!strcmp(gl_vendor, "Mesa") && !strncmp(gl_renderer, "NV", 2)) {
return "Normalized 16bpc pixel formats are broken on nouveau";
}
return NULL;
}
static void glcommon_check_issues(void) {
glext.issues.avoid_sampler_uniform_updates = glcommon_check_workaround(
"avoid sampler uniform updates",
"TAISEI_GL_WORKAROUND_AVOID_SAMPLER_UNIFORM_UPDATES",
detect_slow_sampler_update
);
glext.issues.disable_norm16 = glcommon_check_workaround(
"disable normalized 16bpc pixel formats",
"TAISEI_GL_WORKAROUND_DISABLE_NORM16",
detect_broken_norm16
);
}
static inline void (*load_gl_func(const char *name))(void);
@ -901,6 +923,8 @@ void glcommon_check_capabilities(void) {
SDL_RWclose(writer);
}
glcommon_check_issues();
glcommon_ext_clear_texture();
glcommon_ext_color_buffer_float();
glcommon_ext_debug_output();
@ -943,7 +967,6 @@ void glcommon_check_capabilities(void) {
glcommon_build_shader_lang_table();
glcommon_init_texture_formats();
glcommon_check_issues();
}
void glcommon_load_library(void) {

View file

@ -159,6 +159,7 @@ struct glext_s {
struct {
uchar avoid_sampler_uniform_updates : 1;
uchar disable_norm16 : 1;
} issues;
ext_flag_t clear_texture;