- only enumerate 32 bpp ARGB texture format and remove RGBA one
- add support for 32 bpp ARGB texture format
This commit is contained in:
parent
5548822a7d
commit
9914a8ec5d
|
@ -385,6 +385,8 @@ static HRESULT enum_texture_format_OpenGL(LPD3DENUMTEXTUREFORMATSCALLBACK cb_1,
|
|||
pformat->dwSize = sizeof(DDPIXELFORMAT);
|
||||
pformat->dwFourCC = 0;
|
||||
|
||||
#if 0
|
||||
/* See argument about the RGBA format for 'packed' texture formats */
|
||||
TRACE("Enumerating GL_RGBA unpacked (32)\n");
|
||||
pformat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
|
||||
pformat->u1.dwRGBBitCount = 32;
|
||||
|
@ -394,6 +396,17 @@ static HRESULT enum_texture_format_OpenGL(LPD3DENUMTEXTUREFORMATSCALLBACK cb_1,
|
|||
pformat->u5.dwRGBAlphaBitMask = 0x000000FF;
|
||||
if (cb_1) if (cb_1(&sdesc , context) == 0) return DD_OK;
|
||||
if (cb_2) if (cb_2(pformat, context) == 0) return DD_OK;
|
||||
#endif
|
||||
|
||||
TRACE("Enumerating GL_RGBA unpacked (32)\n");
|
||||
pformat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
|
||||
pformat->u1.dwRGBBitCount = 32;
|
||||
pformat->u2.dwRBitMask = 0x00FF0000;
|
||||
pformat->u3.dwGBitMask = 0x0000FF00;
|
||||
pformat->u4.dwBBitMask = 0x000000FF;
|
||||
pformat->u5.dwRGBAlphaBitMask = 0xFF000000;
|
||||
if (cb_1) if (cb_1(&sdesc , context) == 0) return DD_OK;
|
||||
if (cb_2) if (cb_2(pformat, context) == 0) return DD_OK;
|
||||
|
||||
TRACE("Enumerating GL_RGB unpacked (24)\n");
|
||||
pformat->dwFlags = DDPF_RGB;
|
||||
|
|
|
@ -383,6 +383,35 @@ gltex_upload_texture(IDirectDrawSurfaceImpl *This) {
|
|||
}
|
||||
format = GL_RGBA;
|
||||
pixel_format = GL_UNSIGNED_INT_8_8_8_8;
|
||||
} else if ((src_d->ddpfPixelFormat.u2.dwRBitMask == 0x00FF0000) &&
|
||||
(src_d->ddpfPixelFormat.u3.dwGBitMask == 0x0000FF00) &&
|
||||
(src_d->ddpfPixelFormat.u4.dwBBitMask == 0x000000FF) &&
|
||||
(src_d->ddpfPixelFormat.u5.dwRGBAlphaBitMask == 0xFF000000)) {
|
||||
/* Convert from ARGB (Windows' format) to RGBA.
|
||||
Note: need to check for GL extensions handling ARGB instead of always converting */
|
||||
DWORD i;
|
||||
DWORD *src = (DWORD *) src_d->lpSurface, *dst;
|
||||
|
||||
surface = (DWORD *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, src_d->dwWidth * src_d->dwHeight * sizeof(DWORD));
|
||||
dst = (DWORD *) surface;
|
||||
if (src_d->dwFlags & DDSD_CKSRCBLT) {
|
||||
for (i = 0; i < src_d->dwHeight * src_d->dwWidth; i++) {
|
||||
DWORD color = *src++;
|
||||
*dst = (color & 0x00FFFFFF) << 8;
|
||||
if ((color < src_d->ddckCKSrcBlt.dwColorSpaceLowValue) ||
|
||||
(color > src_d->ddckCKSrcBlt.dwColorSpaceHighValue))
|
||||
*dst |= (color & 0xFF000000) >> 24;
|
||||
dst++;
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < src_d->dwHeight * src_d->dwWidth; i++) {
|
||||
DWORD color = *src++;
|
||||
*dst = (color & 0x00FFFFFF) << 8;
|
||||
*dst |= (color & 0xFF000000) >> 24;
|
||||
}
|
||||
}
|
||||
format = GL_RGBA;
|
||||
pixel_format = GL_UNSIGNED_INT_8_8_8_8;
|
||||
} else if ((src_d->ddpfPixelFormat.u2.dwRBitMask == 0x00FF0000) &&
|
||||
(src_d->ddpfPixelFormat.u3.dwGBitMask == 0x0000FF00) &&
|
||||
(src_d->ddpfPixelFormat.u4.dwBBitMask == 0x000000FF) &&
|
||||
|
|
Loading…
Reference in New Issue