From 600efab1bd7500d2413dae418eecb46dbca8ae97 Mon Sep 17 00:00:00 2001 From: Themaister Date: Mon, 29 Aug 2011 17:19:38 +0200 Subject: [PATCH] Consistently use BGRA for possible performance gains. --- gfx/image.c | 4 ++-- gfx/shader_cg.c | 2 +- gfx/shader_glsl.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gfx/image.c b/gfx/image.c index b98b3541c2..3e4883b653 100644 --- a/gfx/image.c +++ b/gfx/image.c @@ -63,7 +63,7 @@ bool texture_image_load(const char *path, struct texture_image *out_img) uint32_t g = (src[x] & fmt->Gmask) >> fmt->Gshift; uint32_t b = (src[x] & fmt->Bmask) >> fmt->Bshift; uint32_t a = (src[x] & fmt->Amask) >> fmt->Ashift; - dst[x] = (r << 24) | (g << 16) | (b << 8) | a; + dst[x] = (b << 24) | (g << 16) | (r << 8) | a; } } } @@ -84,7 +84,7 @@ bool texture_image_load(const char *path, struct texture_image *out_img) uint32_t r = (color & fmt->Rmask) >> fmt->Rshift; uint32_t g = (color & fmt->Gmask) >> fmt->Gshift; uint32_t b = (color & fmt->Bmask) >> fmt->Bshift; - dst[x] = (r << 24) | (g << 16) | (b << 8) | 0xff; + dst[x] = (b << 24) | (g << 16) | (r << 8) | 0xff; } } } diff --git a/gfx/shader_cg.c b/gfx/shader_cg.c index b44d714168..8a12fdd680 100644 --- a/gfx/shader_cg.c +++ b/gfx/shader_cg.c @@ -398,7 +398,7 @@ static bool load_textures(const char *dir_path, config_file_t *conf) glPixelStorei(GL_UNPACK_ALIGNMENT, 4); glPixelStorei(GL_UNPACK_ROW_LENGTH, img.width); glTexImage2D(GL_TEXTURE_2D, - 0, GL_RGBA, img.width, img.height, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, img.pixels); + 0, GL_RGBA, img.width, img.height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, img.pixels); lut_textures_num++; diff --git a/gfx/shader_glsl.c b/gfx/shader_glsl.c index 0a5196ceee..027146102f 100644 --- a/gfx/shader_glsl.c +++ b/gfx/shader_glsl.c @@ -356,7 +356,7 @@ static bool get_texture_image(const char *shader_path, xmlNodePtr ptr) glPixelStorei(GL_UNPACK_ALIGNMENT, 4); glPixelStorei(GL_UNPACK_ROW_LENGTH, img.width); glTexImage2D(GL_TEXTURE_2D, - 0, GL_RGBA, img.width, img.height, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, img.pixels); + 0, GL_RGBA, img.width, img.height, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, img.pixels); pglActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, 0);