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