wined3d: Test and fix ddraw and d3d9 GetDC differences.
The MSDN is not totally correct: A8R8G8B8 and A1R5G5B5 also allow GetDC. The main differences that have to be filtered out in d3d9.dll are GetDC on A8B8G8R8, X8B8G8R8 and P8.
This commit is contained in:
parent
65f3d54da5
commit
e1469961d4
|
@ -308,6 +308,8 @@ typedef struct IDirect3DSurface9Impl
|
|||
|
||||
/* Flags an implicit surface */
|
||||
BOOL isImplicit;
|
||||
|
||||
BOOL getdc_supported;
|
||||
} IDirect3DSurface9Impl;
|
||||
|
||||
/* ---------------------- */
|
||||
|
|
|
@ -671,6 +671,22 @@ static HRESULT IDirect3DDevice9Impl_CreateSurface(LPDIRECT3DDEVICE9EX iface, UIN
|
|||
object->lpVtbl = &Direct3DSurface9_Vtbl;
|
||||
object->ref = 1;
|
||||
|
||||
switch(Format)
|
||||
{
|
||||
case D3DFMT_A8R8G8B8:
|
||||
case D3DFMT_X8R8G8B8:
|
||||
case D3DFMT_R5G6B5:
|
||||
case D3DFMT_X1R5G5B5:
|
||||
case D3DFMT_A1R5G5B5:
|
||||
case D3DFMT_R8G8B8:
|
||||
object->getdc_supported = TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
object->getdc_supported = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
TRACE("(%p) : w(%d) h(%d) fmt(%d) surf@%p\n", This, Width, Height, Format, *ppSurface);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
|
|
|
@ -269,6 +269,13 @@ static HRESULT WINAPI IDirect3DSurface9Impl_GetDC(LPDIRECT3DSURFACE9 iface, HDC*
|
|||
HRESULT hr;
|
||||
TRACE("(%p) Relay\n", This);
|
||||
|
||||
if(!This->getdc_supported)
|
||||
{
|
||||
WARN("Surface does not support GetDC, returning D3DERR_INVALIDCALL\n");
|
||||
/* Don't touch the DC */
|
||||
return D3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = IWineD3DSurface_GetDC(This->wineD3DSurface, phdc);
|
||||
wined3d_mutex_unlock();
|
||||
|
|
|
@ -378,6 +378,86 @@ static void test_private_data(IDirect3DDevice9 *device)
|
|||
ok(ref2 == (ref - 1), "Object reference is %d, expected %d\n", ref2, (ref - 1));
|
||||
}
|
||||
|
||||
static void test_getdc(IDirect3DDevice9 *device)
|
||||
{
|
||||
IDirect3DSurface9 *surface;
|
||||
IDirect3DTexture9 *texture;
|
||||
HRESULT hr;
|
||||
unsigned int i;
|
||||
HDC dc;
|
||||
|
||||
struct
|
||||
{
|
||||
const char *name;
|
||||
D3DFORMAT fmt;
|
||||
BOOL getdc_supported;
|
||||
} testdata[] = {
|
||||
{ "D3DFMT_A8R8G8B8", D3DFMT_A8R8G8B8, TRUE },
|
||||
{ "D3DFMT_X8R8G8B8", D3DFMT_X8R8G8B8, TRUE },
|
||||
{ "D3DFMT_R5G6B5", D3DFMT_R5G6B5, TRUE },
|
||||
{ "D3DFMT_X1R5G5B5", D3DFMT_X1R5G5B5, TRUE },
|
||||
{ "D3DFMT_A1R5G5B5", D3DFMT_A1R5G5B5, TRUE },
|
||||
{ "D3DFMT_R8G8B8", D3DFMT_R8G8B8, TRUE },
|
||||
{ "D3DFMT_A2R10G10B10", D3DFMT_A2R10G10B10, FALSE }, /* Untested, card on windows didn't support it */
|
||||
{ "D3DFMT_V8U8", D3DFMT_V8U8, FALSE },
|
||||
{ "D3DFMT_Q8W8V8U8", D3DFMT_Q8W8V8U8, FALSE },
|
||||
{ "D3DFMT_A8B8G8R8", D3DFMT_A8B8G8R8, FALSE },
|
||||
{ "D3DFMT_X8B8G8R8", D3DFMT_A8B8G8R8, FALSE },
|
||||
{ "D3DFMT_R3G3B2", D3DFMT_R3G3B2, FALSE },
|
||||
{ "D3DFMT_P8", D3DFMT_P8, FALSE },
|
||||
{ "D3DFMT_L8", D3DFMT_L8, FALSE },
|
||||
{ "D3DFMT_A8L8", D3DFMT_A8L8, FALSE },
|
||||
{ "D3DFMT_DXT1", D3DFMT_DXT1, FALSE },
|
||||
{ "D3DFMT_DXT2", D3DFMT_DXT2, FALSE },
|
||||
{ "D3DFMT_DXT3", D3DFMT_DXT3, FALSE },
|
||||
{ "D3DFMT_DXT4", D3DFMT_DXT4, FALSE },
|
||||
{ "D3DFMT_DXT5", D3DFMT_DXT5, FALSE },
|
||||
};
|
||||
|
||||
for(i = 0; i < (sizeof(testdata) / sizeof(testdata[0])); i++)
|
||||
{
|
||||
texture = NULL;
|
||||
hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 64, 64, testdata[i].fmt, D3DPOOL_SYSTEMMEM, &surface, NULL);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
hr = IDirect3DDevice9_CreateTexture(device, 64, 64, 1, 0, testdata[i].fmt, D3DPOOL_MANAGED, &texture, NULL);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
skip("IDirect3DDevice9_CreateOffscreenPlainSurface failed, hr = 0x%08x, fmt %s\n", hr, testdata[i].name);
|
||||
continue;
|
||||
}
|
||||
IDirect3DTexture9_GetSurfaceLevel(texture, 0, &surface);
|
||||
}
|
||||
|
||||
dc = (void *) 0x1234;
|
||||
hr = IDirect3DSurface9_GetDC(surface, &dc);
|
||||
|
||||
if(testdata[i].getdc_supported)
|
||||
{
|
||||
ok(SUCCEEDED(hr), "GetDC on format %s failed(hr=0x%08x), but was expected to work\n",
|
||||
testdata[i].name, hr);
|
||||
}
|
||||
else
|
||||
{
|
||||
ok(FAILED(hr), "GetDC on format %s worked(hr=0x%08x), but was expected to fail\n",
|
||||
testdata[i].name, hr);
|
||||
}
|
||||
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
hr = IDirect3DSurface9_ReleaseDC(surface, dc);
|
||||
ok(hr == D3D_OK, "IDirect3DSurface9_ReleaseDC failed, hr = 0x%08x\n", hr);
|
||||
}
|
||||
else
|
||||
{
|
||||
ok(dc == (void *) 0x1234, "After failed getDC dc is %p\n", dc);
|
||||
}
|
||||
|
||||
IDirect3DSurface9_Release(surface);
|
||||
if(texture) IDirect3DTexture9_Release(texture);
|
||||
}
|
||||
}
|
||||
|
||||
START_TEST(surface)
|
||||
{
|
||||
HMODULE d3d9_handle;
|
||||
|
@ -399,6 +479,7 @@ START_TEST(surface)
|
|||
test_lockrect_offset(device_ptr);
|
||||
test_lockrect_invalid(device_ptr);
|
||||
test_private_data(device_ptr);
|
||||
test_getdc(device_ptr);
|
||||
|
||||
refcount = IDirect3DDevice9_Release(device_ptr);
|
||||
ok(!refcount, "Device has %u references left\n", refcount);
|
||||
|
|
|
@ -1069,7 +1069,17 @@ IDirectDrawSurfaceImpl_GetDC(IDirectDrawSurface7 *iface,
|
|||
hr = IWineD3DSurface_GetDC(This->WineD3DSurface,
|
||||
hdc);
|
||||
LeaveCriticalSection(&ddraw_cs);
|
||||
return hr;
|
||||
switch(hr)
|
||||
{
|
||||
/* Some, but not all errors set *hdc to NULL. E.g. DCALREADYCREATED does not
|
||||
* touch *hdc
|
||||
*/
|
||||
case WINED3DERR_INVALIDCALL:
|
||||
if(hdc) *hdc = NULL;
|
||||
return DDERR_INVALIDPARAMS;
|
||||
|
||||
default: return hr;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
|
|
@ -2994,6 +2994,239 @@ static void GetDCTest(void)
|
|||
IDirectDraw7_Release(dd7);
|
||||
}
|
||||
|
||||
static void GetDCFormatTest(void)
|
||||
{
|
||||
DDSURFACEDESC2 ddsd;
|
||||
unsigned int i;
|
||||
IDirectDrawSurface7 *surface;
|
||||
IDirectDraw7 *dd7;
|
||||
HRESULT hr;
|
||||
HDC dc;
|
||||
|
||||
struct
|
||||
{
|
||||
const char *name;
|
||||
DDPIXELFORMAT fmt;
|
||||
BOOL getdc_capable;
|
||||
} testdata[] = {
|
||||
{
|
||||
"D3DFMT_A8R8G8B8",
|
||||
{
|
||||
sizeof(DDPIXELFORMAT), DDPF_RGB | DDPF_ALPHAPIXELS, 0,
|
||||
{32}, {0x00ff0000}, {0x0000ff00}, {0x000000ff}, {0xff000000}
|
||||
},
|
||||
TRUE
|
||||
},
|
||||
{
|
||||
"D3DFMT_X8R8G8B8",
|
||||
{
|
||||
sizeof(DDPIXELFORMAT), DDPF_RGB, 0,
|
||||
{32}, {0x00ff0000}, {0x0000ff00}, {0x000000ff}, {0x00000000}
|
||||
},
|
||||
TRUE
|
||||
},
|
||||
{
|
||||
"D3DFMT_X8B8G8R8",
|
||||
{
|
||||
sizeof(DDPIXELFORMAT), DDPF_RGB, 0,
|
||||
{32}, {0x000000ff}, {0x0000ff00}, {0x00ff0000}, {0x00000000}
|
||||
},
|
||||
TRUE
|
||||
},
|
||||
{
|
||||
"D3DFMT_X8B8G8R8",
|
||||
{
|
||||
sizeof(DDPIXELFORMAT), DDPF_RGB | DDPF_ALPHAPIXELS, 0,
|
||||
{32}, {0x000000ff}, {0x0000ff00}, {0x00ff0000}, {0xff000000}
|
||||
},
|
||||
TRUE
|
||||
},
|
||||
{
|
||||
"D3DFMT_A4R4G4B4",
|
||||
{
|
||||
sizeof(DDPIXELFORMAT), DDPF_RGB | DDPF_ALPHAPIXELS, 0,
|
||||
{16}, {0x00000f00}, {0x000000f0}, {0x0000000f}, {0x0000f000}
|
||||
},
|
||||
TRUE
|
||||
},
|
||||
{
|
||||
"D3DFMT_X4R4G4B4",
|
||||
{
|
||||
sizeof(DDPIXELFORMAT), DDPF_RGB, 0,
|
||||
{16}, {0x00000f00}, {0x000000f0}, {0x0000000f}, {0x00000000}
|
||||
},
|
||||
TRUE
|
||||
},
|
||||
{
|
||||
"D3DFMT_R5G6B5",
|
||||
{
|
||||
sizeof(DDPIXELFORMAT), DDPF_RGB, 0,
|
||||
{16}, {0x0000F800}, {0x000007E0}, {0x0000001F}, {0x00000000}
|
||||
},
|
||||
TRUE
|
||||
},
|
||||
{
|
||||
"D3DFMT_A1R5G5B5",
|
||||
{
|
||||
sizeof(DDPIXELFORMAT), DDPF_RGB | DDPF_ALPHAPIXELS, 0,
|
||||
{16}, {0x00007C00}, {0x000003E0}, {0x0000001F}, {0x00008000}
|
||||
},
|
||||
TRUE
|
||||
},
|
||||
{
|
||||
"D3DFMT_X1R5G5B5",
|
||||
{
|
||||
sizeof(DDPIXELFORMAT), DDPF_RGB, 0,
|
||||
{16}, {0x00007C00}, {0x000003E0}, {0x0000001F}, {0x00000000}
|
||||
},
|
||||
TRUE
|
||||
},
|
||||
{
|
||||
"D3DFMT_R3G3B2",
|
||||
{
|
||||
sizeof(DDPIXELFORMAT), DDPF_RGB, 0,
|
||||
{ 8}, {0x000000E0}, {0x0000001C}, {0x00000003}, {0x00000000}
|
||||
},
|
||||
FALSE
|
||||
},
|
||||
{
|
||||
/* Untested, windows test machine didn't support this format */
|
||||
"D3DFMT_A2R10G10B10",
|
||||
{
|
||||
sizeof(DDPIXELFORMAT), DDPF_RGB | DDPF_ALPHAPIXELS, 0,
|
||||
{32}, {0xC0000000}, {0x3FF00000}, {0x000FFC00}, {0x000003FF}
|
||||
},
|
||||
FALSE
|
||||
},
|
||||
/*
|
||||
* GetDC on a P8 surface fails unless the display mode is 8 bpp. This is not
|
||||
* implemented in wine yet, so disable the test for now. Succeeding P8 getDC
|
||||
* calls are tested in the ddraw.visual test.
|
||||
*
|
||||
{
|
||||
"D3DFMT_P8",
|
||||
{
|
||||
sizeof(DDPIXELFORMAT), DDPF_PALETTEINDEXED8 | DDPF_RGB, 0,
|
||||
{8 }, {0x00000000}, {0x00000000}, {0x00000000}, {0x00000000}
|
||||
},
|
||||
FALSE
|
||||
},
|
||||
*/
|
||||
{
|
||||
"D3DFMT_L8",
|
||||
{
|
||||
sizeof(DDPIXELFORMAT), DDPF_LUMINANCE, 0,
|
||||
{8 }, {0x000000ff}, {0x00000000}, {0x00000000}, {0x00000000}
|
||||
},
|
||||
FALSE
|
||||
},
|
||||
{
|
||||
"D3DFMT_A8L8",
|
||||
{
|
||||
sizeof(DDPIXELFORMAT), DDPF_ALPHAPIXELS | DDPF_LUMINANCE, 0,
|
||||
{16}, {0x000000ff}, {0x00000000}, {0x00000000}, {0x0000ff00}
|
||||
},
|
||||
FALSE
|
||||
},
|
||||
{
|
||||
"D3DFMT_DXT1",
|
||||
{
|
||||
sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('D','X','T','1'),
|
||||
{0 }, {0x00000000}, {0x00000000}, {0x00000000}, {0x00000000}
|
||||
},
|
||||
FALSE
|
||||
},
|
||||
{
|
||||
"D3DFMT_DXT2",
|
||||
{
|
||||
sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('D','X','T','2'),
|
||||
{0 }, {0x00000000}, {0x00000000}, {0x00000000}, {0x00000000}
|
||||
},
|
||||
FALSE
|
||||
},
|
||||
{
|
||||
"D3DFMT_DXT3",
|
||||
{
|
||||
sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('D','X','T','3'),
|
||||
{0 }, {0x00000000}, {0x00000000}, {0x00000000}, {0x00000000}
|
||||
},
|
||||
FALSE
|
||||
},
|
||||
{
|
||||
"D3DFMT_DXT4",
|
||||
{
|
||||
sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('D','X','T','4'),
|
||||
{0 }, {0x00000000}, {0x00000000}, {0x00000000}, {0x00000000}
|
||||
},
|
||||
FALSE
|
||||
},
|
||||
{
|
||||
"D3DFMT_DXT5",
|
||||
{
|
||||
sizeof(DDPIXELFORMAT), DDPF_FOURCC, MAKEFOURCC('D','X','T','5'),
|
||||
{0 }, {0x00000000}, {0x00000000}, {0x00000000}, {0x00000000}
|
||||
},
|
||||
FALSE
|
||||
},
|
||||
};
|
||||
|
||||
hr = IDirectDraw_QueryInterface(lpDD, &IID_IDirectDraw7, (void **) &dd7);
|
||||
ok(hr == DD_OK, "IDirectDraw_QueryInterface failed, hr = 0x%08x\n", hr);
|
||||
|
||||
for(i = 0; i < (sizeof(testdata) / sizeof(testdata[0])); i++)
|
||||
{
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
|
||||
ddsd.dwWidth = 64;
|
||||
ddsd.dwHeight = 64;
|
||||
ddsd.ddpfPixelFormat = testdata[i].fmt;
|
||||
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
||||
|
||||
hr = IDirectDraw7_CreateSurface(dd7, &ddsd, &surface, NULL);
|
||||
hr = E_FAIL;
|
||||
if(FAILED(hr))
|
||||
{
|
||||
ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
|
||||
ddsd.ddsCaps.dwCaps2 = DDSCAPS2_TEXTUREMANAGE;
|
||||
hr = IDirectDraw7_CreateSurface(dd7, &ddsd, &surface, NULL);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
skip("IDirectDraw7_CreateSurface failed, hr = 0x%08x, format %s\n", hr, testdata[i].name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
dc = (void *) 0x1234;
|
||||
hr = IDirectDrawSurface7_GetDC(surface, &dc);
|
||||
if(testdata[i].getdc_capable)
|
||||
{
|
||||
ok(SUCCEEDED(hr), "GetDC on a %s surface failed(0x%08x), expected it to work\n",
|
||||
testdata[i].name, hr);
|
||||
}
|
||||
else
|
||||
{
|
||||
ok(FAILED(hr), "GetDC on a %s surface succeeded(0x%08x), expected it to fail\n",
|
||||
testdata[i].name, hr);
|
||||
}
|
||||
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
IDirectDrawSurface7_ReleaseDC(surface, dc);
|
||||
ok(hr == DD_OK, "IDirectDrawSurface7_ReleaseDC failed, hr = 0x%08x\n", hr);
|
||||
dc = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ok(dc == NULL, "After failed GetDC dc is %p\n", dc);
|
||||
}
|
||||
|
||||
IDirectDrawSurface7_Release(surface);
|
||||
}
|
||||
|
||||
IDirectDraw7_Release(dd7);
|
||||
}
|
||||
|
||||
START_TEST(dsurface)
|
||||
{
|
||||
HRESULT ret;
|
||||
|
@ -3038,5 +3271,6 @@ START_TEST(dsurface)
|
|||
PaletteTest();
|
||||
SurfaceCapsTest();
|
||||
GetDCTest();
|
||||
GetDCFormatTest();
|
||||
ReleaseDirectDraw();
|
||||
}
|
||||
|
|
|
@ -1589,20 +1589,12 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHD
|
|||
if (This->Flags & SFLAG_LOCKED)
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
|
||||
/* According to Direct3D9 docs, only these formats are supported */
|
||||
if (((IWineD3DImpl *)This->resource.wineD3DDevice->wineD3D)->dxVersion > 7) {
|
||||
if (This->resource.format_desc->format != WINED3DFMT_R5G6B5
|
||||
&& This->resource.format_desc->format != WINED3DFMT_X1R5G5B5
|
||||
&& This->resource.format_desc->format != WINED3DFMT_R8G8B8
|
||||
&& This->resource.format_desc->format != WINED3DFMT_X8R8G8B8)
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
memset(&lock, 0, sizeof(lock)); /* To be sure */
|
||||
|
||||
/* Create a DIB section if there isn't a hdc yet */
|
||||
if(!This->hDC) {
|
||||
IWineD3DBaseSurfaceImpl_CreateDIBSection(iface);
|
||||
hr = IWineD3DBaseSurfaceImpl_CreateDIBSection(iface);
|
||||
if(FAILED(hr)) return WINED3DERR_INVALIDCALL;
|
||||
if(This->Flags & SFLAG_CLIENT) {
|
||||
surface_internal_preload(iface, SRGB_RGB);
|
||||
}
|
||||
|
|
|
@ -542,6 +542,12 @@ HRESULT IWineD3DBaseSurfaceImpl_CreateDIBSection(IWineD3DSurface *iface) {
|
|||
DWORD *masks;
|
||||
UINT usage;
|
||||
|
||||
if(!(format_desc->Flags & WINED3DFMT_FLAG_GETDC))
|
||||
{
|
||||
WARN("Cannot use GetDC on a %s surface\n", debug_d3dformat(format_desc->format));
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
switch (format_desc->byte_count)
|
||||
{
|
||||
case 2:
|
||||
|
|
|
@ -384,6 +384,12 @@ static HRESULT WINAPI IWineGDISurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHD
|
|||
|
||||
TRACE("(%p)->(%p)\n",This,pHDC);
|
||||
|
||||
if(!(This->Flags & SFLAG_DIBSECTION))
|
||||
{
|
||||
WARN("DC not supported on this surface\n");
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
if(This->Flags & SFLAG_USERPTR) {
|
||||
ERR("Not supported on surfaces with an application-provided surfaces\n");
|
||||
return WINEDDERR_NODC;
|
||||
|
@ -525,26 +531,29 @@ static HRESULT WINAPI
|
|||
IWineGDISurfaceImpl_PrivateSetup(IWineD3DSurface *iface)
|
||||
{
|
||||
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
|
||||
HRESULT hr;
|
||||
|
||||
if(This->resource.usage & WINED3DUSAGE_OVERLAY)
|
||||
{
|
||||
ERR("(%p) Overlays not yet supported by GDI surfaces\n", This);
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
/* Sysmem textures have memory already allocated -
|
||||
* release it, this avoids an unnecessary memcpy
|
||||
*/
|
||||
HeapFree(GetProcessHeap(), 0, This->resource.heapMemory);
|
||||
This->resource.allocatedMemory = NULL;
|
||||
This->resource.heapMemory = NULL;
|
||||
hr = IWineD3DBaseSurfaceImpl_CreateDIBSection(iface);
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, This->resource.heapMemory);
|
||||
This->resource.heapMemory = NULL;
|
||||
This->resource.allocatedMemory = This->dib.bitmap_data;
|
||||
}
|
||||
|
||||
/* We don't mind the nonpow2 stuff in GDI */
|
||||
This->pow2Width = This->currentDesc.Width;
|
||||
This->pow2Height = This->currentDesc.Height;
|
||||
|
||||
IWineD3DBaseSurfaceImpl_CreateDIBSection(iface);
|
||||
This->resource.allocatedMemory = This->dib.bitmap_data;
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -294,40 +294,47 @@ static const GlPixelFormatDescTemplate gl_formats_template[] = {
|
|||
/* Palettized formats */
|
||||
{WINED3DFMT_P8, GL_RGBA, GL_RGBA, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
0,
|
||||
WINED3DFMT_FLAG_GETDC,
|
||||
ARB_FRAGMENT_PROGRAM},
|
||||
{WINED3DFMT_P8, GL_COLOR_INDEX8_EXT, GL_COLOR_INDEX8_EXT, 0,
|
||||
GL_COLOR_INDEX, GL_UNSIGNED_BYTE,
|
||||
0,
|
||||
WINED3DFMT_FLAG_GETDC,
|
||||
EXT_PALETTED_TEXTURE},
|
||||
/* Standard ARGB formats */
|
||||
{WINED3DFMT_R8G8B8, GL_RGB8, GL_RGB8, 0,
|
||||
GL_BGR, GL_UNSIGNED_BYTE,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_RENDERTARGET,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_RENDERTARGET |
|
||||
WINED3DFMT_FLAG_GETDC,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
{WINED3DFMT_A8R8G8B8, GL_RGBA8, GL_SRGB8_ALPHA8_EXT, 0,
|
||||
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_RENDERTARGET,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_RENDERTARGET |
|
||||
WINED3DFMT_FLAG_GETDC,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
{WINED3DFMT_X8R8G8B8, GL_RGB8, GL_SRGB8_EXT, 0,
|
||||
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_RENDERTARGET,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_RENDERTARGET |
|
||||
WINED3DFMT_FLAG_GETDC,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
{WINED3DFMT_R5G6B5, GL_RGB5, GL_RGB5, GL_RGB8,
|
||||
GL_RGB, GL_UNSIGNED_SHORT_5_6_5,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_RENDERTARGET,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_RENDERTARGET |
|
||||
WINED3DFMT_FLAG_GETDC,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
{WINED3DFMT_X1R5G5B5, GL_RGB5, GL_RGB5_A1, 0,
|
||||
GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING |
|
||||
WINED3DFMT_FLAG_GETDC,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
{WINED3DFMT_A1R5G5B5, GL_RGB5_A1, GL_RGB5_A1, 0,
|
||||
GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING |
|
||||
WINED3DFMT_FLAG_GETDC,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
{WINED3DFMT_A4R4G4B4, GL_RGBA4, GL_SRGB8_ALPHA8_EXT, 0,
|
||||
GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4_REV,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING |
|
||||
WINED3DFMT_FLAG_GETDC,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
{WINED3DFMT_R3G3B2, GL_R3_G3_B2, GL_R3_G3_B2, 0,
|
||||
GL_RGB, GL_UNSIGNED_BYTE_3_3_2,
|
||||
|
@ -339,7 +346,7 @@ static const GlPixelFormatDescTemplate gl_formats_template[] = {
|
|||
WINED3D_GL_EXT_NONE},
|
||||
{WINED3DFMT_X4R4G4B4, GL_RGB4, GL_RGB4, 0,
|
||||
GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4_REV,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_GETDC,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
{WINED3DFMT_R10G10B10A2_UNORM, GL_RGB10_A2, GL_RGB10_A2, 0,
|
||||
GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV,
|
||||
|
@ -347,11 +354,11 @@ static const GlPixelFormatDescTemplate gl_formats_template[] = {
|
|||
WINED3D_GL_EXT_NONE},
|
||||
{WINED3DFMT_R8G8B8A8_UNORM, GL_RGBA8, GL_RGBA8, 0,
|
||||
GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_GETDC,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
{WINED3DFMT_X8B8G8R8, GL_RGB8, GL_RGB8, 0,
|
||||
GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING,
|
||||
WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_GETDC,
|
||||
WINED3D_GL_EXT_NONE},
|
||||
{WINED3DFMT_R16G16_UNORM, GL_RGB16_EXT, GL_RGB16_EXT, GL_RGBA16_EXT,
|
||||
GL_RGB, GL_UNSIGNED_SHORT,
|
||||
|
|
|
@ -2850,6 +2850,7 @@ extern WINED3DFORMAT pixelformat_for_depth(DWORD depth);
|
|||
#define WINED3DFMT_FLAG_FOURCC 0x20
|
||||
#define WINED3DFMT_FLAG_FBO_ATTACHABLE 0x40
|
||||
#define WINED3DFMT_FLAG_COMPRESSED 0x80
|
||||
#define WINED3DFMT_FLAG_GETDC 0x100
|
||||
|
||||
struct GlPixelFormatDesc
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue