mirror of https://github.com/xemu-project/xemu.git
use texture swizzle mask for alpha textures
This commit is contained in:
parent
6ffb0ffbd0
commit
7509c1d444
hw/xbox
|
@ -944,6 +944,7 @@ typedef struct ColorFormatInfo {
|
|||
GLint gl_internal_format;
|
||||
GLenum gl_format;
|
||||
GLenum gl_type;
|
||||
GLenum swizzle_mask[4];
|
||||
} ColorFormatInfo;
|
||||
|
||||
static const ColorFormatInfo kelvin_color_format_map[66] = {
|
||||
|
@ -975,9 +976,9 @@ static const ColorFormatInfo kelvin_color_format_map[66] = {
|
|||
{2, true, GL_RGB5, GL_RGB, GL_UNSIGNED_SHORT_5_6_5},
|
||||
[NV097_SET_TEXTURE_FORMAT_COLOR_LU_IMAGE_A8R8G8B8] =
|
||||
{4, true, GL_RGBA8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV},
|
||||
/* TODO: how do opengl alpha textures work? */
|
||||
[NV097_SET_TEXTURE_FORMAT_COLOR_SZ_A8] =
|
||||
{2, false, GL_R8, GL_RED, GL_UNSIGNED_BYTE},
|
||||
{2, false, GL_R8, GL_RED, GL_UNSIGNED_BYTE,
|
||||
{GL_ZERO, GL_ZERO, GL_ZERO, GL_RED}},
|
||||
[NV097_SET_TEXTURE_FORMAT_COLOR_LU_IMAGE_X8R8G8B8] =
|
||||
{4, true, GL_RGB8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV},
|
||||
/* TODO: format conversion */
|
||||
|
@ -1894,6 +1895,12 @@ static TextureBinding* generate_texture(const TextureShape s,
|
|||
}
|
||||
}
|
||||
|
||||
if (f.swizzle_mask[0] != 0 || f.swizzle_mask[1] != 0
|
||||
|| f.swizzle_mask[2] != 0 || f.swizzle_mask[3] != 0) {
|
||||
glTexParameteriv(gl_target, GL_TEXTURE_SWIZZLE_RGBA,
|
||||
(const GLint *)f.swizzle_mask);
|
||||
}
|
||||
|
||||
TextureBinding* ret = g_malloc(sizeof(TextureBinding));
|
||||
ret->gl_target = gl_target;
|
||||
ret->gl_texture = gl_texture;
|
||||
|
|
Loading…
Reference in New Issue