From a131d714ffb0c0dd9415e6b3b382b01818fa41cc Mon Sep 17 00:00:00 2001 From: Christian Costa Date: Sun, 12 May 2013 23:57:58 +0200 Subject: [PATCH] d3dx9_36: Fix D3DXCheckTextureRequirements to return D3DFMT_A8R8G8B8 when d3d doesn't support D3DFMT_P8 + tests. --- dlls/d3dx9_36/tests/texture.c | 11 +++++++++++ dlls/d3dx9_36/util.c | 1 + 2 files changed, 12 insertions(+) diff --git a/dlls/d3dx9_36/tests/texture.c b/dlls/d3dx9_36/tests/texture.c index 782864c5d4e..fd072c83a06 100644 --- a/dlls/d3dx9_36/tests/texture.c +++ b/dlls/d3dx9_36/tests/texture.c @@ -329,6 +329,17 @@ static void test_D3DXCheckTextureRequirements(IDirect3DDevice9 *device) ok(hr == D3D_OK, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr, D3D_OK); ok(format == expected, "Returned format %u, expected %u\n", format, expected); + if(SUCCEEDED(IDirect3D9_CheckDeviceFormat(d3d, params.AdapterOrdinal, params.DeviceType, + mode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_P8))) + expected = D3DFMT_P8; + else + expected = D3DFMT_A8R8G8B8; + + format = D3DFMT_P8; + hr = D3DXCheckTextureRequirements(device, NULL, NULL, NULL, 0, &format, D3DPOOL_DEFAULT); + ok(hr == D3D_OK, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr, D3D_OK); + ok(format == expected, "Returned format %u, expected %u\n", format, expected); + IDirect3D9_Release(d3d); } diff --git a/dlls/d3dx9_36/util.c b/dlls/d3dx9_36/util.c index 9ba54e210c9..376fe890f72 100644 --- a/dlls/d3dx9_36/util.c +++ b/dlls/d3dx9_36/util.c @@ -73,6 +73,7 @@ static const struct pixel_format_desc formats[] = {D3DFMT_DXT5, { 0, 0, 0, 0}, { 0, 0, 0, 0}, 1, 4, 4, 16, FORMAT_DXT, NULL, NULL }, {D3DFMT_A16B16G16R16F, {16, 16, 16, 16}, {48, 0, 16, 32}, 8, 1, 1, 8, FORMAT_ARGBF16, NULL, NULL }, {D3DFMT_A32B32G32R32F, {32, 32, 32, 32}, {96, 0, 32, 64}, 16, 1, 1, 16, FORMAT_ARGBF, NULL, NULL }, + {D3DFMT_P8, { 8, 8, 8, 8}, { 0, 0, 0, 0}, 1, 1, 1, 1, FORMAT_UNKNOWN, NULL, NULL }, /* marks last element */ {D3DFMT_UNKNOWN, { 0, 0, 0, 0}, { 0, 0, 0, 0}, 0, 1, 1, 0, FORMAT_UNKNOWN, NULL, NULL }, };