Skip to content

Commit e39363d

Browse files
committed
PlatformCore: Conditionally set texture format
sRGB texture format is needed for the output to look right with sRGB framebuffer enabled and no color correction shader applied.
1 parent d95a60c commit e39363d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/platform/core/src/device/ogl_video_device.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,14 @@ void OGLVideoDevice::ReloadConfig() {
8484
}
8585

8686
void OGLVideoDevice::UpdateTextures() {
87+
const auto texture_format =
88+
config->video.color == Video::Color::No ? GL_SRGB8_ALPHA8 : GL_RGBA8;
89+
8790
for(auto& texture_ref : texture) {
8891
glBindTexture(GL_TEXTURE_2D, texture_ref);
8992

90-
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, gba_screen_width, gba_screen_height,
91-
0, GL_BGRA, GL_UNSIGNED_BYTE, nullptr);
93+
glTexImage2D(GL_TEXTURE_2D, 0, texture_format, gba_screen_width,
94+
gba_screen_height, 0, GL_BGRA, GL_UNSIGNED_BYTE, nullptr);
9295

9396
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, texture_filter);
9497
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, texture_filter);

0 commit comments

Comments
 (0)