wined3d: Start moving texture format fixups to the formats table.
This commit is contained in:
parent
a4559e761b
commit
d7e1b973c7
|
@ -2235,12 +2235,6 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
|
|||
}
|
||||
break;
|
||||
|
||||
case WINED3DFMT_R8G8_SNORM:
|
||||
if (gl_info->supported[NV_TEXTURE_SHADER]) break;
|
||||
*convert = CONVERT_V8U8;
|
||||
desc->conv_byte_count = 3;
|
||||
break;
|
||||
|
||||
case WINED3DFMT_R5G5_SNORM_L6_UNORM:
|
||||
*convert = CONVERT_L6V5U5;
|
||||
if (gl_info->supported[NV_TEXTURE_SHADER])
|
||||
|
@ -2273,12 +2267,6 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
|
|||
desc->conv_byte_count = 4;
|
||||
break;
|
||||
|
||||
case WINED3DFMT_R16G16_SNORM:
|
||||
if (gl_info->supported[NV_TEXTURE_SHADER]) break;
|
||||
*convert = CONVERT_V16U16;
|
||||
desc->conv_byte_count = 6;
|
||||
break;
|
||||
|
||||
case WINED3DFMT_L4A4_UNORM:
|
||||
/* WINED3DFMT_L4A4_UNORM exists as an internal gl format, but for some reason there is not
|
||||
* format+type combination to load it. Thus convert it to A8L8, then load it
|
||||
|
@ -2575,44 +2563,6 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
|
|||
}
|
||||
break;
|
||||
|
||||
case CONVERT_V8U8:
|
||||
{
|
||||
unsigned int x, y;
|
||||
const short *Source;
|
||||
unsigned char *Dest;
|
||||
for(y = 0; y < height; y++) {
|
||||
Source = (const short *)(src + y * pitch);
|
||||
Dest = dst + y * outpitch;
|
||||
for (x = 0; x < width; x++ ) {
|
||||
long color = (*Source++);
|
||||
/* B */ Dest[0] = 0xff;
|
||||
/* G */ Dest[1] = (color >> 8) + 128; /* V */
|
||||
/* R */ Dest[2] = (color) + 128; /* U */
|
||||
Dest += 3;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case CONVERT_V16U16:
|
||||
{
|
||||
unsigned int x, y;
|
||||
const DWORD *Source;
|
||||
unsigned short *Dest;
|
||||
for(y = 0; y < height; y++) {
|
||||
Source = (const DWORD *)(src + y * pitch);
|
||||
Dest = (unsigned short *) (dst + y * outpitch);
|
||||
for (x = 0; x < width; x++ ) {
|
||||
DWORD color = (*Source++);
|
||||
/* B */ Dest[0] = 0xffff;
|
||||
/* G */ Dest[1] = (color >> 16) + 32768; /* V */
|
||||
/* R */ Dest[2] = (color ) + 32768; /* U */
|
||||
Dest += 3;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case CONVERT_Q8W8V8U8:
|
||||
{
|
||||
unsigned int x, y;
|
||||
|
@ -4890,7 +4840,23 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadLocation(IWineD3DSurface *iface, D
|
|||
surface_remove_pbo(This, gl_info);
|
||||
}
|
||||
|
||||
if((convert != NO_CONVERSION) && This->resource.allocatedMemory) {
|
||||
if(desc.convert) {
|
||||
/* This code is entered for texture formats which need a fixup. */
|
||||
int height = This->currentDesc.Height;
|
||||
|
||||
/* Stick to the alignment for the converted surface too, makes it easier to load the surface */
|
||||
outpitch = width * desc.conv_byte_count;
|
||||
outpitch = (outpitch + device->surface_alignment - 1) & ~(device->surface_alignment - 1);
|
||||
|
||||
mem = HeapAlloc(GetProcessHeap(), 0, outpitch * height);
|
||||
if(!mem) {
|
||||
ERR("Out of memory %d, %d!\n", outpitch, height);
|
||||
if (context) context_release(context);
|
||||
return WINED3DERR_OUTOFVIDEOMEMORY;
|
||||
}
|
||||
desc.convert(This->resource.allocatedMemory, mem, pitch, width, height);
|
||||
} else if((convert != NO_CONVERSION) && This->resource.allocatedMemory) {
|
||||
/* This code is only entered for color keying fixups */
|
||||
int height = This->currentDesc.Height;
|
||||
|
||||
/* Stick to the alignment for the converted surface too, makes it easier to load the surface */
|
||||
|
|
|
@ -235,10 +235,56 @@ struct wined3d_format_texture_info
|
|||
GLint gl_rt_internal;
|
||||
GLint gl_format;
|
||||
GLint gl_type;
|
||||
unsigned int conv_byte_count;
|
||||
unsigned int flags;
|
||||
GL_SupportedExt extension;
|
||||
void (*convert)(const BYTE *src, BYTE *dst, UINT pitch, UINT width, UINT height);
|
||||
};
|
||||
|
||||
static void convert_r8g8_snorm(const BYTE *src, BYTE *dst, UINT pitch, UINT width, UINT height)
|
||||
{
|
||||
unsigned int x, y;
|
||||
const short *Source;
|
||||
unsigned char *Dest;
|
||||
UINT outpitch = (pitch * 3)/2;
|
||||
|
||||
for(y = 0; y < height; y++)
|
||||
{
|
||||
Source = (const short *)(src + y * pitch);
|
||||
Dest = dst + y * outpitch;
|
||||
for (x = 0; x < width; x++ )
|
||||
{
|
||||
long color = (*Source++);
|
||||
/* B */ Dest[0] = 0xff;
|
||||
/* G */ Dest[1] = (color >> 8) + 128; /* V */
|
||||
/* R */ Dest[2] = (color) + 128; /* U */
|
||||
Dest += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void convert_r16g16_snorm(const BYTE *src, BYTE *dst, UINT pitch, UINT width, UINT height)
|
||||
{
|
||||
unsigned int x, y;
|
||||
const DWORD *Source;
|
||||
unsigned short *Dest;
|
||||
UINT outpitch = (pitch * 3)/2;
|
||||
|
||||
for(y = 0; y < height; y++)
|
||||
{
|
||||
Source = (const DWORD *)(src + y * pitch);
|
||||
Dest = (unsigned short *) (dst + y * outpitch);
|
||||
for (x = 0; x < width; x++ )
|
||||
{
|
||||
DWORD color = (*Source++);
|
||||
/* B */ Dest[0] = 0xffff;
|
||||
/* G */ Dest[1] = (color >> 16) + 32768; /* V */
|
||||
/* R */ Dest[2] = (color ) + 32768; /* U */
|
||||
Dest += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const struct wined3d_format_texture_info format_texture_info[] =
|
||||
{
|
||||
/* WINED3DFORMAT internal srgbInternal rtInternal
|
||||
|
@ -253,289 +299,289 @@ static const struct wined3d_format_texture_info format_texture_info[] =
|
|||
* endian machine
|
||||
*/
|
||||
{WINED3DFMT_UYVY, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, 0,
|
||||
GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE,
|
||||
GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, 0,
|
||||
WINED3DFMT_FLAG_FILTERING,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
{WINED3DFMT_UYVY, GL_RGB, GL_RGB, 0,
|
||||
GL_YCBCR_422_APPLE, UNSIGNED_SHORT_8_8_APPLE,
|
||||
GL_YCBCR_422_APPLE, UNSIGNED_SHORT_8_8_APPLE, 0,
|
||||
WINED3DFMT_FLAG_FILTERING,
|
||||
APPLE_YCBCR_422},
|
||||
APPLE_YCBCR_422, NULL},
|
||||
{WINED3DFMT_YUY2, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, 0,
|
||||
GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE,
|
||||
GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, 0,
|
||||
WINED3DFMT_FLAG_FILTERING,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
{WINED3DFMT_YUY2, GL_RGB, GL_RGB, 0,
|
||||
GL_YCBCR_422_APPLE, UNSIGNED_SHORT_8_8_REV_APPLE,
|
||||
GL_YCBCR_422_APPLE, UNSIGNED_SHORT_8_8_REV_APPLE, 0,
|
||||
WINED3DFMT_FLAG_FILTERING,
|
||||
APPLE_YCBCR_422},
|
||||
APPLE_YCBCR_422, NULL},
|
||||
{WINED3DFMT_YV12, GL_ALPHA, GL_ALPHA, 0,
|
||||
GL_ALPHA, GL_UNSIGNED_BYTE,
|
||||
GL_ALPHA, GL_UNSIGNED_BYTE, 0,
|
||||
WINED3DFMT_FLAG_FILTERING,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
{WINED3DFMT_DXT1, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
EXT_TEXTURE_COMPRESSION_S3TC},
|
||||
EXT_TEXTURE_COMPRESSION_S3TC, NULL},
|
||||
{WINED3DFMT_DXT2, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
EXT_TEXTURE_COMPRESSION_S3TC},
|
||||
EXT_TEXTURE_COMPRESSION_S3TC, NULL},
|
||||
{WINED3DFMT_DXT3, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
EXT_TEXTURE_COMPRESSION_S3TC},
|
||||
EXT_TEXTURE_COMPRESSION_S3TC, NULL},
|
||||
{WINED3DFMT_DXT4, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
EXT_TEXTURE_COMPRESSION_S3TC},
|
||||
EXT_TEXTURE_COMPRESSION_S3TC, NULL},
|
||||
{WINED3DFMT_DXT5, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
EXT_TEXTURE_COMPRESSION_S3TC},
|
||||
EXT_TEXTURE_COMPRESSION_S3TC, NULL},
|
||||
/* IEEE formats */
|
||||
{WINED3DFMT_R32_FLOAT, GL_RGB32F_ARB, GL_RGB32F_ARB, 0,
|
||||
GL_RED, GL_FLOAT,
|
||||
GL_RED, GL_FLOAT, 0,
|
||||
WINED3DFMT_FLAG_RENDERTARGET,
|
||||
ARB_TEXTURE_FLOAT},
|
||||
ARB_TEXTURE_FLOAT, NULL},
|
||||
{WINED3DFMT_R32_FLOAT, GL_R32F, GL_R32F, 0,
|
||||
GL_RED, GL_FLOAT,
|
||||
GL_RED, GL_FLOAT, 0,
|
||||
WINED3DFMT_FLAG_RENDERTARGET,
|
||||
ARB_TEXTURE_RG},
|
||||
ARB_TEXTURE_RG, NULL},
|
||||
{WINED3DFMT_R32G32_FLOAT, GL_RGB32F_ARB, GL_RGB32F_ARB, 0,
|
||||
GL_RGB, GL_FLOAT,
|
||||
GL_RGB, GL_FLOAT, 0,
|
||||
WINED3DFMT_FLAG_RENDERTARGET,
|
||||
ARB_TEXTURE_FLOAT},
|
||||
ARB_TEXTURE_FLOAT, NULL},
|
||||
{WINED3DFMT_R32G32_FLOAT, GL_RG32F, GL_RG32F, 0,
|
||||
GL_RG, GL_FLOAT,
|
||||
GL_RG, GL_FLOAT, 0,
|
||||
WINED3DFMT_FLAG_RENDERTARGET,
|
||||
ARB_TEXTURE_RG},
|
||||
ARB_TEXTURE_RG, NULL},
|
||||
{WINED3DFMT_R32G32B32A32_FLOAT, GL_RGBA32F_ARB, GL_RGBA32F_ARB, 0,
|
||||
GL_RGBA, GL_FLOAT,
|
||||
GL_RGBA, GL_FLOAT, 0,
|
||||
WINED3DFMT_FLAG_RENDERTARGET,
|
||||
ARB_TEXTURE_FLOAT},
|
||||
ARB_TEXTURE_FLOAT, NULL},
|
||||
/* Float */
|
||||
{WINED3DFMT_R16_FLOAT, GL_RGB16F_ARB, GL_RGB16F_ARB, 0,
|
||||
GL_RED, GL_HALF_FLOAT_ARB,
|
||||
GL_RED, GL_HALF_FLOAT_ARB, 0,
|
||||
WINED3DFMT_FLAG_RENDERTARGET,
|
||||
ARB_TEXTURE_FLOAT},
|
||||
ARB_TEXTURE_FLOAT, NULL},
|
||||
{WINED3DFMT_R16_FLOAT, GL_R16F, GL_R16F, 0,
|
||||
GL_RED, GL_HALF_FLOAT_ARB,
|
||||
GL_RED, GL_HALF_FLOAT_ARB, 0,
|
||||
WINED3DFMT_FLAG_RENDERTARGET,
|
||||
ARB_TEXTURE_RG},
|
||||
ARB_TEXTURE_RG, NULL},
|
||||
{WINED3DFMT_R16G16_FLOAT, GL_RGB16F_ARB, GL_RGB16F_ARB, 0,
|
||||
GL_RGB, GL_HALF_FLOAT_ARB,
|
||||
GL_RGB, GL_HALF_FLOAT_ARB, 0,
|
||||
WINED3DFMT_FLAG_RENDERTARGET,
|
||||
ARB_TEXTURE_FLOAT},
|
||||
ARB_TEXTURE_FLOAT, NULL},
|
||||
{WINED3DFMT_R16G16_FLOAT, GL_RG16F, GL_RG16F, 0,
|
||||
GL_RG, GL_HALF_FLOAT_ARB,
|
||||
GL_RG, GL_HALF_FLOAT_ARB, 0,
|
||||
WINED3DFMT_FLAG_RENDERTARGET,
|
||||
ARB_TEXTURE_RG},
|
||||
ARB_TEXTURE_RG, NULL},
|
||||
{WINED3DFMT_R16G16B16A16_FLOAT, GL_RGBA16F_ARB, GL_RGBA16F_ARB, 0,
|
||||
GL_RGBA, GL_HALF_FLOAT_ARB,
|
||||
GL_RGBA, GL_HALF_FLOAT_ARB, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_RENDERTARGET,
|
||||
ARB_TEXTURE_FLOAT},
|
||||
ARB_TEXTURE_FLOAT, NULL},
|
||||
/* Palettized formats */
|
||||
{WINED3DFMT_P8_UINT, GL_RGBA, GL_RGBA, 0,
|
||||
GL_ALPHA, GL_UNSIGNED_BYTE,
|
||||
GL_ALPHA, GL_UNSIGNED_BYTE, 0,
|
||||
0,
|
||||
ARB_FRAGMENT_PROGRAM},
|
||||
ARB_FRAGMENT_PROGRAM, NULL},
|
||||
{WINED3DFMT_P8_UINT, GL_COLOR_INDEX8_EXT, GL_COLOR_INDEX8_EXT, 0,
|
||||
GL_COLOR_INDEX, GL_UNSIGNED_BYTE,
|
||||
GL_COLOR_INDEX, GL_UNSIGNED_BYTE, 0,
|
||||
0,
|
||||
EXT_PALETTED_TEXTURE},
|
||||
EXT_PALETTED_TEXTURE, NULL},
|
||||
/* Standard ARGB formats */
|
||||
{WINED3DFMT_B8G8R8_UNORM, GL_RGB8, GL_RGB8, 0,
|
||||
GL_BGR, GL_UNSIGNED_BYTE,
|
||||
GL_BGR, GL_UNSIGNED_BYTE, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_RENDERTARGET,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
{WINED3DFMT_B8G8R8A8_UNORM, GL_RGBA8, GL_SRGB8_ALPHA8_EXT, 0,
|
||||
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_RENDERTARGET,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
{WINED3DFMT_B8G8R8X8_UNORM, GL_RGB8, GL_SRGB8_EXT, 0,
|
||||
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_RENDERTARGET,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
{WINED3DFMT_B5G6R5_UNORM, GL_RGB5, GL_RGB5, GL_RGB8,
|
||||
GL_RGB, GL_UNSIGNED_SHORT_5_6_5,
|
||||
GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_RENDERTARGET,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
{WINED3DFMT_B5G5R5X1_UNORM, GL_RGB5, GL_RGB5_A1, 0,
|
||||
GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV,
|
||||
GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
{WINED3DFMT_B5G5R5A1_UNORM, GL_RGB5_A1, GL_RGB5_A1, 0,
|
||||
GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV,
|
||||
GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
{WINED3DFMT_B4G4R4A4_UNORM, GL_RGBA4, GL_SRGB8_ALPHA8_EXT, 0,
|
||||
GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4_REV,
|
||||
GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4_REV, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
{WINED3DFMT_B2G3R3_UNORM, GL_R3_G3_B2, GL_R3_G3_B2, 0,
|
||||
GL_RGB, GL_UNSIGNED_BYTE_3_3_2,
|
||||
GL_RGB, GL_UNSIGNED_BYTE_3_3_2, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
{WINED3DFMT_A8_UNORM, GL_ALPHA8, GL_ALPHA8, 0,
|
||||
GL_ALPHA, GL_UNSIGNED_BYTE,
|
||||
GL_ALPHA, GL_UNSIGNED_BYTE, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
{WINED3DFMT_B4G4R4X4_UNORM, GL_RGB4, GL_RGB4, 0,
|
||||
GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4_REV,
|
||||
GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4_REV, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
{WINED3DFMT_R10G10B10A2_UNORM, GL_RGB10_A2, GL_RGB10_A2, 0,
|
||||
GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV,
|
||||
GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
{WINED3DFMT_R8G8B8A8_UNORM, GL_RGBA8, GL_RGBA8, 0,
|
||||
GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
{WINED3DFMT_R8G8B8X8_UNORM, GL_RGB8, GL_RGB8, 0,
|
||||
GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
{WINED3DFMT_R16G16_UNORM, GL_RGB16, GL_RGB16, GL_RGBA16,
|
||||
GL_RGB, GL_UNSIGNED_SHORT,
|
||||
GL_RGB, GL_UNSIGNED_SHORT, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
{WINED3DFMT_B10G10R10A2_UNORM, GL_RGB10_A2, GL_RGB10_A2, 0,
|
||||
GL_BGRA, GL_UNSIGNED_INT_2_10_10_10_REV,
|
||||
GL_BGRA, GL_UNSIGNED_INT_2_10_10_10_REV, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
{WINED3DFMT_R16G16B16A16_UNORM, GL_RGBA16, GL_RGBA16, 0,
|
||||
GL_RGBA, GL_UNSIGNED_SHORT,
|
||||
GL_RGBA, GL_UNSIGNED_SHORT, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_RENDERTARGET,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
/* Luminance */
|
||||
{WINED3DFMT_L8_UNORM, GL_LUMINANCE8, GL_SLUMINANCE8_EXT, 0,
|
||||
GL_LUMINANCE, GL_UNSIGNED_BYTE,
|
||||
GL_LUMINANCE, GL_UNSIGNED_BYTE, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
{WINED3DFMT_L8A8_UNORM, GL_LUMINANCE8_ALPHA8, GL_SLUMINANCE8_ALPHA8_EXT, 0,
|
||||
GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE,
|
||||
GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
{WINED3DFMT_L4A4_UNORM, GL_LUMINANCE4_ALPHA4, GL_LUMINANCE4_ALPHA4, 0,
|
||||
GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE,
|
||||
GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, 0,
|
||||
0,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
/* Bump mapping stuff */
|
||||
{WINED3DFMT_R8G8_SNORM, GL_RGB8, GL_RGB8, 0,
|
||||
GL_BGR, GL_UNSIGNED_BYTE,
|
||||
GL_BGR, GL_UNSIGNED_BYTE, 3,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, &convert_r8g8_snorm},
|
||||
{WINED3DFMT_R8G8_SNORM, GL_DSDT8_NV, GL_DSDT8_NV, 0,
|
||||
GL_DSDT_NV, GL_BYTE,
|
||||
GL_DSDT_NV, GL_BYTE, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
NV_TEXTURE_SHADER},
|
||||
NV_TEXTURE_SHADER, NULL},
|
||||
{WINED3DFMT_R5G5_SNORM_L6_UNORM, GL_RGB5, GL_RGB5, 0,
|
||||
GL_RGB, GL_UNSIGNED_SHORT_5_6_5,
|
||||
GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
{WINED3DFMT_R5G5_SNORM_L6_UNORM, GL_DSDT8_MAG8_NV, GL_DSDT8_MAG8_NV, 0,
|
||||
GL_DSDT_MAG_NV, GL_BYTE,
|
||||
GL_DSDT_MAG_NV, GL_BYTE, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
NV_TEXTURE_SHADER},
|
||||
NV_TEXTURE_SHADER, NULL},
|
||||
{WINED3DFMT_R8G8_SNORM_L8X8_UNORM, GL_RGB8, GL_RGB8, 0,
|
||||
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
{WINED3DFMT_R8G8_SNORM_L8X8_UNORM, GL_DSDT8_MAG8_INTENSITY8_NV, GL_DSDT8_MAG8_INTENSITY8_NV, 0,
|
||||
GL_DSDT_MAG_VIB_NV, GL_UNSIGNED_INT_8_8_S8_S8_REV_NV,
|
||||
GL_DSDT_MAG_VIB_NV, GL_UNSIGNED_INT_8_8_S8_S8_REV_NV, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
NV_TEXTURE_SHADER},
|
||||
NV_TEXTURE_SHADER, NULL},
|
||||
{WINED3DFMT_R8G8B8A8_SNORM, GL_RGBA8, GL_RGBA8, 0,
|
||||
GL_BGRA, GL_UNSIGNED_BYTE,
|
||||
GL_BGRA, GL_UNSIGNED_BYTE, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
{WINED3DFMT_R8G8B8A8_SNORM, GL_SIGNED_RGBA8_NV, GL_SIGNED_RGBA8_NV, 0,
|
||||
GL_RGBA, GL_BYTE,
|
||||
GL_RGBA, GL_BYTE, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
NV_TEXTURE_SHADER},
|
||||
NV_TEXTURE_SHADER, NULL},
|
||||
{WINED3DFMT_R16G16_SNORM, GL_RGB16, GL_RGB16, 0,
|
||||
GL_BGR, GL_UNSIGNED_SHORT,
|
||||
GL_BGR, GL_UNSIGNED_SHORT, 6,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, &convert_r16g16_snorm},
|
||||
{WINED3DFMT_R16G16_SNORM, GL_SIGNED_HILO16_NV, GL_SIGNED_HILO16_NV, 0,
|
||||
GL_HILO_NV, GL_SHORT,
|
||||
GL_HILO_NV, GL_SHORT, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
NV_TEXTURE_SHADER},
|
||||
NV_TEXTURE_SHADER, NULL},
|
||||
/* Depth stencil formats */
|
||||
{WINED3DFMT_D16_LOCKABLE, GL_DEPTH_COMPONENT24_ARB, GL_DEPTH_COMPONENT24_ARB, 0,
|
||||
GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT,
|
||||
GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, 0,
|
||||
WINED3DFMT_FLAG_DEPTH,
|
||||
ARB_DEPTH_TEXTURE},
|
||||
ARB_DEPTH_TEXTURE, NULL},
|
||||
{WINED3DFMT_D32_UNORM, GL_DEPTH_COMPONENT32_ARB, GL_DEPTH_COMPONENT32_ARB, 0,
|
||||
GL_DEPTH_COMPONENT, GL_UNSIGNED_INT,
|
||||
GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 0,
|
||||
WINED3DFMT_FLAG_DEPTH,
|
||||
ARB_DEPTH_TEXTURE},
|
||||
ARB_DEPTH_TEXTURE, NULL},
|
||||
{WINED3DFMT_S1_UINT_D15_UNORM, GL_DEPTH_COMPONENT24_ARB, GL_DEPTH_COMPONENT24_ARB, 0,
|
||||
GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT,
|
||||
GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, 0,
|
||||
WINED3DFMT_FLAG_DEPTH,
|
||||
ARB_DEPTH_TEXTURE},
|
||||
ARB_DEPTH_TEXTURE, NULL},
|
||||
{WINED3DFMT_S1_UINT_D15_UNORM, GL_DEPTH24_STENCIL8_EXT, GL_DEPTH24_STENCIL8_EXT, 0,
|
||||
GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT,
|
||||
GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT, 0,
|
||||
WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL,
|
||||
EXT_PACKED_DEPTH_STENCIL},
|
||||
EXT_PACKED_DEPTH_STENCIL, NULL},
|
||||
{WINED3DFMT_S1_UINT_D15_UNORM, GL_DEPTH24_STENCIL8, GL_DEPTH24_STENCIL8, 0,
|
||||
GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8,
|
||||
GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 0,
|
||||
WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL,
|
||||
ARB_FRAMEBUFFER_OBJECT},
|
||||
ARB_FRAMEBUFFER_OBJECT, NULL},
|
||||
{WINED3DFMT_D24_UNORM_S8_UINT, GL_DEPTH_COMPONENT24_ARB, GL_DEPTH_COMPONENT24_ARB, 0,
|
||||
GL_DEPTH_COMPONENT, GL_UNSIGNED_INT,
|
||||
GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_DEPTH,
|
||||
ARB_DEPTH_TEXTURE},
|
||||
ARB_DEPTH_TEXTURE, NULL},
|
||||
{WINED3DFMT_D24_UNORM_S8_UINT, GL_DEPTH24_STENCIL8_EXT, GL_DEPTH24_STENCIL8_EXT, 0,
|
||||
GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT,
|
||||
GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL,
|
||||
EXT_PACKED_DEPTH_STENCIL},
|
||||
EXT_PACKED_DEPTH_STENCIL, NULL},
|
||||
{WINED3DFMT_D24_UNORM_S8_UINT, GL_DEPTH24_STENCIL8, GL_DEPTH24_STENCIL8, 0,
|
||||
GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8,
|
||||
GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL,
|
||||
ARB_FRAMEBUFFER_OBJECT},
|
||||
ARB_FRAMEBUFFER_OBJECT, NULL},
|
||||
{WINED3DFMT_X8D24_UNORM, GL_DEPTH_COMPONENT24_ARB, GL_DEPTH_COMPONENT24_ARB, 0,
|
||||
GL_DEPTH_COMPONENT, GL_UNSIGNED_INT,
|
||||
GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_DEPTH,
|
||||
ARB_DEPTH_TEXTURE},
|
||||
ARB_DEPTH_TEXTURE, NULL},
|
||||
{WINED3DFMT_S4X4_UINT_D24_UNORM, GL_DEPTH_COMPONENT24_ARB, GL_DEPTH_COMPONENT24_ARB, 0,
|
||||
GL_DEPTH_COMPONENT, GL_UNSIGNED_INT,
|
||||
GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 0,
|
||||
WINED3DFMT_FLAG_DEPTH,
|
||||
ARB_DEPTH_TEXTURE},
|
||||
ARB_DEPTH_TEXTURE, NULL},
|
||||
{WINED3DFMT_S4X4_UINT_D24_UNORM, GL_DEPTH24_STENCIL8_EXT, GL_DEPTH24_STENCIL8_EXT, 0,
|
||||
GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT,
|
||||
GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT, 0,
|
||||
WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL,
|
||||
EXT_PACKED_DEPTH_STENCIL},
|
||||
EXT_PACKED_DEPTH_STENCIL, NULL},
|
||||
{WINED3DFMT_S4X4_UINT_D24_UNORM, GL_DEPTH24_STENCIL8, GL_DEPTH24_STENCIL8, 0,
|
||||
GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8,
|
||||
GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 0,
|
||||
WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL,
|
||||
ARB_FRAMEBUFFER_OBJECT},
|
||||
ARB_FRAMEBUFFER_OBJECT, NULL},
|
||||
{WINED3DFMT_D16_UNORM, GL_DEPTH_COMPONENT24_ARB, GL_DEPTH_COMPONENT24_ARB, 0,
|
||||
GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT,
|
||||
GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_DEPTH,
|
||||
ARB_DEPTH_TEXTURE},
|
||||
ARB_DEPTH_TEXTURE, NULL},
|
||||
{WINED3DFMT_L16_UNORM, GL_LUMINANCE16, GL_LUMINANCE16, 0,
|
||||
GL_LUMINANCE, GL_UNSIGNED_SHORT,
|
||||
GL_LUMINANCE, GL_UNSIGNED_SHORT, 0,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
{WINED3DFMT_D32_FLOAT, GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT32F, 0,
|
||||
GL_DEPTH_COMPONENT, GL_FLOAT,
|
||||
GL_DEPTH_COMPONENT, GL_FLOAT, 0,
|
||||
WINED3DFMT_FLAG_DEPTH,
|
||||
ARB_DEPTH_BUFFER_FLOAT},
|
||||
ARB_DEPTH_BUFFER_FLOAT, NULL},
|
||||
{WINED3DFMT_S8_UINT_D24_FLOAT, GL_DEPTH32F_STENCIL8, GL_DEPTH32F_STENCIL8, 0,
|
||||
GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV,
|
||||
GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, 0,
|
||||
WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL,
|
||||
ARB_DEPTH_BUFFER_FLOAT},
|
||||
ARB_DEPTH_BUFFER_FLOAT, NULL},
|
||||
/* Vendor-specific formats */
|
||||
{WINED3DFMT_ATI2N, GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI, GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI, 0,
|
||||
GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE,
|
||||
GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, 0,
|
||||
0,
|
||||
ATI_TEXTURE_COMPRESSION_3DC},
|
||||
ATI_TEXTURE_COMPRESSION_3DC, NULL},
|
||||
{WINED3DFMT_ATI2N, GL_COMPRESSED_RED_GREEN_RGTC2_EXT, GL_COMPRESSED_RED_GREEN_RGTC2_EXT, 0,
|
||||
GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE,
|
||||
GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, 0,
|
||||
0,
|
||||
EXT_TEXTURE_COMPRESSION_RGTC},
|
||||
EXT_TEXTURE_COMPRESSION_RGTC, NULL},
|
||||
};
|
||||
|
||||
static inline int getFmtIdx(WINED3DFORMAT fmt) {
|
||||
|
@ -830,6 +876,10 @@ static BOOL init_format_texture_info(struct wined3d_gl_info *gl_info)
|
|||
desc->color_fixup = COLOR_FIXUP_IDENTITY;
|
||||
desc->Flags |= format_texture_info[i].flags;
|
||||
desc->heightscale = 1.0f;
|
||||
|
||||
/* Texture conversion stuff */
|
||||
desc->convert = format_texture_info[i].convert;
|
||||
desc->conv_byte_count = format_texture_info[i].conv_byte_count;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -1052,6 +1102,7 @@ static void apply_format_fixups(struct wined3d_gl_info *gl_info)
|
|||
idx = getFmtIdx(WINED3DFMT_R8G8_SNORM);
|
||||
gl_info->gl_formats[idx].color_fixup = create_color_fixup_desc(
|
||||
0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_ONE);
|
||||
|
||||
idx = getFmtIdx(WINED3DFMT_R16G16_SNORM);
|
||||
gl_info->gl_formats[idx].color_fixup = create_color_fixup_desc(
|
||||
0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_ONE);
|
||||
|
|
|
@ -3011,6 +3011,7 @@ struct wined3d_format_desc
|
|||
unsigned int Flags;
|
||||
float heightscale;
|
||||
struct color_fixup_desc color_fixup;
|
||||
void (*convert)(const BYTE *src, BYTE *dst, UINT pitch, UINT width, UINT height);
|
||||
};
|
||||
|
||||
const struct wined3d_format_desc *getFormatDescEntry(WINED3DFORMAT fmt,
|
||||
|
|
Loading…
Reference in New Issue