mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-26 01:30:51 +00:00
Fix LUT textures in GLES.
This commit is contained in:
parent
759a4c811d
commit
5365087311
24
gfx/image.c
24
gfx/image.c
@ -61,7 +61,11 @@ 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] = (b << 24) | (g << 16) | (r << 8) | a;
|
||||
#ifdef HAVE_OPENGLES2
|
||||
dst[x] = (a << 24) | (b << 16) | (g << 8) | r;
|
||||
#else
|
||||
dst[x] = (a << 24) | (r << 16) | (g << 8) | b;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -82,7 +86,11 @@ 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] = (b << 24) | (g << 16) | (r << 8) | 0xff;
|
||||
#ifdef HAVE_OPENGLES2
|
||||
dst[x] = (0xff << 24) | (b << 16) | (g << 8) | r;
|
||||
#else
|
||||
dst[x] = (0xff << 24) | (r << 16) | (g << 8) | b;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -151,7 +159,11 @@ bool texture_image_load(const char *path, struct texture_image *out_img)
|
||||
uint32_t r = tmp[i * 4 + 2];
|
||||
uint32_t a = tmp[i * 4 + 3];
|
||||
|
||||
out_img->pixels[i] = (b << 24) | (g << 16) | (r << 8) | a;
|
||||
#ifdef HAVE_OPENGLES2
|
||||
out_img->pixels[i] = (a << 24) | (b << 16) | (g << 8) | r;
|
||||
#else
|
||||
out_img->pixels[i] = (a << 24) | (r << 16) | (g << 8) | b;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (bits == 24)
|
||||
@ -163,7 +175,11 @@ bool texture_image_load(const char *path, struct texture_image *out_img)
|
||||
uint32_t r = tmp[i * 3 + 2];
|
||||
uint32_t a = 0xff;
|
||||
|
||||
out_img->pixels[i] = (b << 24) | (g << 16) | (r << 8) | a;
|
||||
#ifdef HAVE_OPENGLES2
|
||||
out_img->pixels[i] = (a << 24) | (b << 16) | (g << 8) | r;
|
||||
#else
|
||||
out_img->pixels[i] = (a << 24) | (r << 16) | (g << 8) | b;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -535,8 +535,8 @@ static void load_texture_data(GLuint *obj, const struct texture_image *img, bool
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
glTexImage2D(GL_TEXTURE_2D,
|
||||
0, GL_RGBA, img->width, img->height,
|
||||
0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, img->pixels);
|
||||
0, RARCH_GL_INTERNAL_FORMAT, img->width, img->height,
|
||||
0, RARCH_GL_TEXTURE_TYPE, RARCH_GL_FORMAT32, img->pixels);
|
||||
#endif
|
||||
|
||||
free(img->pixels);
|
||||
|
@ -433,7 +433,7 @@ static bool get_texture_image(const char *shader_path, xmlNodePtr ptr)
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
||||
glTexImage2D(GL_TEXTURE_2D,
|
||||
0, RARCH_GL_INTERNAL_FORMAT,
|
||||
img.width, img.height, 0, RARCH_GL_TEXTURE_TYPE, GL_UNSIGNED_INT, img.pixels);
|
||||
img.width, img.height, 0, RARCH_GL_TEXTURE_TYPE, RARCH_GL_FORMAT32, img.pixels);
|
||||
|
||||
pglActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user