From 0dc0444c14c34cf90aba8b8a1af401571c959ccd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Mon, 15 Dec 2008 19:14:15 +0100 Subject: [PATCH] wined3d: Reinstall the G16R16F format surface load fixup. We cannot remove this because we still have to load the surface as RGB. The shader may take care of setting the blue channel to 1.0 now, but we still get the red and green channels loaded incorrectly if we don't insert a blue channel before loading. --- dlls/wined3d/surface.c | 29 +++++++++++++++++++++++++++++ dlls/wined3d/wined3d_private.h | 1 + 2 files changed, 30 insertions(+) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index b43697e8c2c..0eedf231460 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -1696,6 +1696,14 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_ *target_bpp = 2; break; + case WINED3DFMT_G16R16: + *convert = CONVERT_G16R16; + *format = GL_RGB; + *internal = GL_RGB16_EXT; + *type = GL_UNSIGNED_SHORT; + *target_bpp = 6; + break; + default: break; } @@ -2023,6 +2031,27 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI break; } + case CONVERT_G16R16: + { + unsigned int x, y; + const WORD *Source; + WORD *Dest; + + for(y = 0; y < height; y++) { + Source = (const WORD *)(src + y * pitch); + Dest = (WORD *) (dst + y * outpitch); + for (x = 0; x < width; x++ ) { + WORD green = (*Source++); + WORD red = (*Source++); + Dest[0] = green; + Dest[1] = red; + Dest[2] = 0xffff; + Dest += 3; + } + } + break; + } + default: ERR("Unsupported conversation type %d\n", convert); } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 16118121dda..a8438ce8b8d 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1679,6 +1679,7 @@ typedef enum { CONVERT_Q8W8V8U8, CONVERT_V16U16, CONVERT_A4L4, + CONVERT_G16R16, } CONVERT_TYPES; HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_texturing, GLenum *format, GLenum *internal, GLenum *type, CONVERT_TYPES *convert, int *target_bpp, BOOL srgb_mode);