@@ -93,11 +93,14 @@ void OGLVideoDevice::UpdateTextures() {
93
93
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
94
94
};
95
95
96
+ const bool color_correction_active = config->video .color != Video::Color::No;
97
+ const auto texture_format = color_correction_active ? GL_RGBA8 : GL_SRGB8_ALPHA8;
98
+
96
99
// Alternating input sampler and output framebuffer attachment.
97
100
for (const auto texture : {textures[input_index], textures[output_index]}) {
98
101
glBindTexture (GL_TEXTURE_2D, texture);
99
102
100
- glTexImage2D (GL_TEXTURE_2D, 0 , GL_RGBA8 , gba_screen_width,
103
+ glTexImage2D (GL_TEXTURE_2D, 0 , texture_format , gba_screen_width,
101
104
gba_screen_height, 0 , GL_BGRA, GL_UNSIGNED_BYTE, nullptr );
102
105
103
106
set_texture_params (texture_filter);
@@ -110,12 +113,13 @@ void OGLVideoDevice::UpdateTextures() {
110
113
const bool xbrz_ghosting =
111
114
config->video .filter == Video::Filter::xBRZ && config->video .lcd_ghosting ;
112
115
if (config->video .lcd_ghosting ) {
116
+ const GLint history_texture_format = (!color_correction_active || xbrz_ghosting) ? GL_SRGB8_ALPHA8 : GL_RGBA8;
113
117
const GLsizei texture_width = xbrz_ghosting ? view_width : gba_screen_width;
114
118
const GLsizei texture_height = xbrz_ghosting ? view_height : gba_screen_height;
115
119
116
120
glBindTexture (GL_TEXTURE_2D, textures[history_index]);
117
121
118
- glTexImage2D (GL_TEXTURE_2D, 0 , GL_RGBA8 , texture_width, texture_height, 0 ,
122
+ glTexImage2D (GL_TEXTURE_2D, 0 , history_texture_format , texture_width, texture_height, 0 ,
119
123
GL_BGRA, GL_UNSIGNED_BYTE, nullptr );
120
124
121
125
set_texture_params (GL_NEAREST);
@@ -124,7 +128,7 @@ void OGLVideoDevice::UpdateTextures() {
124
128
if (xbrz_ghosting) {
125
129
glBindTexture (GL_TEXTURE_2D, textures[xbrz_output_index]);
126
130
127
- glTexImage2D (GL_TEXTURE_2D, 0 , GL_RGBA8 , view_width, view_height, 0 ,
131
+ glTexImage2D (GL_TEXTURE_2D, 0 , texture_format , view_width, view_height, 0 ,
128
132
GL_BGRA, GL_UNSIGNED_BYTE, nullptr );
129
133
130
134
set_texture_params (GL_NEAREST);
0 commit comments