Module: wine Branch: master Commit: 60c6294f843fab02fd48d9a82d4fac8a3797e2c9 URL: http://source.winehq.org/git/wine.git/?a=commit;h=60c6294f843fab02fd48d9a82d...
Author: Roderick Colenbrander thunderbird2k@gmail.com Date: Thu Apr 8 22:49:48 2010 +0200
wined3d: Move Q8W8V8U8 conversion to the format table.
---
dlls/wined3d/surface.c | 26 -------------------------- dlls/wined3d/utils.c | 26 ++++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 28 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index f86c4e4..39029b1 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -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; diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 5b0af2a..bda0bde 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -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,