wined3d: Convert and load U8V8 surfaces as rgb.
GL_INDEX is definitly not the way to load U8V8 surfaces
This commit is contained in:
parent
99576ea24e
commit
de036ff68e
|
@ -44,7 +44,8 @@ typedef enum {
|
||||||
CONVERT_CK_RGB24,
|
CONVERT_CK_RGB24,
|
||||||
CONVERT_CK_8888,
|
CONVERT_CK_8888,
|
||||||
CONVERT_CK_8888_ARGB,
|
CONVERT_CK_8888_ARGB,
|
||||||
CONVERT_RGB32_888
|
CONVERT_RGB32_888,
|
||||||
|
CONVERT_V8U8
|
||||||
} CONVERT_TYPES;
|
} CONVERT_TYPES;
|
||||||
|
|
||||||
HRESULT d3dfmt_convert_surface(BYTE *src, BYTE *dst, UINT pitch, UINT width, UINT height, UINT outpitch, CONVERT_TYPES convert, IWineD3DSurfaceImpl *surf);
|
HRESULT d3dfmt_convert_surface(BYTE *src, BYTE *dst, UINT pitch, UINT width, UINT height, UINT outpitch, CONVERT_TYPES convert, IWineD3DSurfaceImpl *surf);
|
||||||
|
@ -71,6 +72,11 @@ static void surface_download_data(IWineD3DSurfaceImpl *This) {
|
||||||
int src_pitch = 0;
|
int src_pitch = 0;
|
||||||
int dst_pitch = 0;
|
int dst_pitch = 0;
|
||||||
|
|
||||||
|
if(This->Flags & SFLAG_CONVERTED) {
|
||||||
|
FIXME("Read back converted textures unsupported\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (This->Flags & SFLAG_NONPOW2) {
|
if (This->Flags & SFLAG_NONPOW2) {
|
||||||
src_pitch = This->bytesPerPixel * This->pow2Width;
|
src_pitch = This->bytesPerPixel * This->pow2Width;
|
||||||
dst_pitch = IWineD3DSurface_GetPitch((IWineD3DSurface *) This);
|
dst_pitch = IWineD3DSurface_GetPitch((IWineD3DSurface *) This);
|
||||||
|
@ -1405,6 +1411,14 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WINED3DFMT_V8U8:
|
||||||
|
*convert = CONVERT_V8U8;
|
||||||
|
*format = GL_BGR;
|
||||||
|
*internal = GL_RGB8;
|
||||||
|
*type = GL_BYTE;
|
||||||
|
*target_bpp = 3;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1524,6 +1538,25 @@ HRESULT d3dfmt_convert_surface(BYTE *src, BYTE *dst, UINT pitch, UINT width, UIN
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CONVERT_V8U8:
|
||||||
|
{
|
||||||
|
unsigned int x, y;
|
||||||
|
short *Source;
|
||||||
|
char *Dest;
|
||||||
|
for(y = 0; y < height; y++) {
|
||||||
|
Source = (short *) (src + y * pitch);
|
||||||
|
Dest = (char *) (dst + y * outpitch);
|
||||||
|
for (x = 0; x < width; x++ ) {
|
||||||
|
long color = (*Source++);
|
||||||
|
Dest[0] = color >> 8;
|
||||||
|
Dest[1] = color;
|
||||||
|
Dest[2] = 0xff;
|
||||||
|
Dest += 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERR("Unsupported conversation type %d\n", convert);
|
ERR("Unsupported conversation type %d\n", convert);
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ static const PixelFormatDesc formats[] = {
|
||||||
{WINED3DFMT_A8L8 ,0x0000ff00 ,0x0 ,0x0 ,0x0 ,2 ,FALSE ,GL_LUMINANCE8_ALPHA8 ,GL_LUMINANCE_ALPHA ,GL_UNSIGNED_BYTE },
|
{WINED3DFMT_A8L8 ,0x0000ff00 ,0x0 ,0x0 ,0x0 ,2 ,FALSE ,GL_LUMINANCE8_ALPHA8 ,GL_LUMINANCE_ALPHA ,GL_UNSIGNED_BYTE },
|
||||||
{WINED3DFMT_A4L4 ,0x000000f0 ,0x0 ,0x0 ,0x0 ,1 ,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