Commit 60c6294f authored by Roderick Colenbrander's avatar Roderick Colenbrander Committed by Alexandre Julliard

wined3d: Move Q8W8V8U8 conversion to the format table.

parent d7e1b973
......@@ -2261,12 +2261,6 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
}
break;
case WINED3DFMT_R8G8B8A8_SNORM:
if (gl_info->supported[NV_TEXTURE_SHADER]) break;
*convert = CONVERT_Q8W8V8U8;
desc->conv_byte_count = 4;
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
......@@ -2563,26 +2557,6 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
}
break;
case CONVERT_Q8W8V8U8:
{
unsigned int x, y;
const DWORD *Source;
unsigned char *Dest;
for(y = 0; y < height; y++) {
Source = (const DWORD *)(src + y * pitch);
Dest = dst + y * outpitch;
for (x = 0; x < width; x++ ) {
long color = (*Source++);
/* B */ Dest[0] = ((color >> 16) & 0xff) + 128; /* W */
/* G */ Dest[1] = ((color >> 8 ) & 0xff) + 128; /* V */
/* R */ Dest[2] = (color & 0xff) + 128; /* U */
/* A */ Dest[3] = ((color >> 24) & 0xff) + 128; /* Q */
Dest += 4;
}
}
break;
}
case CONVERT_L6V5U5:
{
unsigned int x, y;
......
......@@ -263,6 +263,28 @@ static void convert_r8g8_snorm(const BYTE *src, BYTE *dst, UINT pitch, UINT widt
}
}
static void convert_r8g8b8a8_snorm(const BYTE *src, BYTE *dst, UINT pitch, UINT width, UINT height)
{
unsigned int x, y;
const DWORD *Source;
unsigned char *Dest;
for(y = 0; y < height; y++)
{
Source = (const DWORD *)(src + y * pitch);
Dest = dst + y * pitch;
for (x = 0; x < width; x++ )
{
long color = (*Source++);
/* B */ Dest[0] = ((color >> 16) & 0xff) + 128; /* W */
/* G */ Dest[1] = ((color >> 8 ) & 0xff) + 128; /* V */
/* R */ Dest[2] = (color & 0xff) + 128; /* U */
/* A */ Dest[3] = ((color >> 24) & 0xff) + 128; /* Q */
Dest += 4;
}
}
}
static void convert_r16g16_snorm(const BYTE *src, BYTE *dst, UINT pitch, UINT width, UINT height)
{
unsigned int x, y;
......@@ -493,9 +515,9 @@ static const struct wined3d_format_texture_info format_texture_info[] =
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
NV_TEXTURE_SHADER, NULL},
{WINED3DFMT_R8G8B8A8_SNORM, GL_RGBA8, GL_RGBA8, 0,
GL_BGRA, GL_UNSIGNED_BYTE, 0,
GL_BGRA, GL_UNSIGNED_BYTE, 4,
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
WINED3D_GL_EXT_NONE, NULL},
WINED3D_GL_EXT_NONE, &convert_r8g8b8a8_snorm},
{WINED3DFMT_R8G8B8A8_SNORM, GL_SIGNED_RGBA8_NV, GL_SIGNED_RGBA8_NV, 0,
GL_RGBA, GL_BYTE, 0,
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment