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.
This commit is contained in:
Stefan Dösinger 2008-12-15 19:14:15 +01:00 committed by Alexandre Julliard
parent 6ec741e766
commit 0dc0444c14
2 changed files with 30 additions and 0 deletions

View File

@ -1696,6 +1696,14 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
*target_bpp = 2; *target_bpp = 2;
break; break;
case WINED3DFMT_G16R16:
*convert = CONVERT_G16R16;
*format = GL_RGB;
*internal = GL_RGB16_EXT;
*type = GL_UNSIGNED_SHORT;
*target_bpp = 6;
break;
default: default:
break; break;
} }
@ -2023,6 +2031,27 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
break; 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: default:
ERR("Unsupported conversation type %d\n", convert); ERR("Unsupported conversation type %d\n", convert);
} }

View File

@ -1679,6 +1679,7 @@ typedef enum {
CONVERT_Q8W8V8U8, CONVERT_Q8W8V8U8,
CONVERT_V16U16, CONVERT_V16U16,
CONVERT_A4L4, CONVERT_A4L4,
CONVERT_G16R16,
} CONVERT_TYPES; } 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); 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);