From: Connor McAdams cmcadams@codeweavers.com
Signed-off-by: Connor McAdams cmcadams@codeweavers.com --- dlls/d3dx9_36/surface.c | 11 +++++------ dlls/d3dx9_36/tests/surface.c | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c index f7572405d5c..3346e9b0d6f 100644 --- a/dlls/d3dx9_36/surface.c +++ b/dlls/d3dx9_36/surface.c @@ -645,14 +645,13 @@ static HRESULT d3dx_initialize_image_from_dds(const void *src_data, uint32_t src } else if (header->caps2 & DDS_CAPS2_CUBEMAP) { - DWORD face; - - faces = 0; - for (face = DDS_CAPS2_CUBEMAP_POSITIVEX; face <= DDS_CAPS2_CUBEMAP_NEGATIVEZ; face <<= 1) + if ((header->caps2 & DDS_CAPS2_CUBEMAP_ALL_FACES) != DDS_CAPS2_CUBEMAP_ALL_FACES) { - if (header->caps2 & face) - faces++; + WARN("Tried to load a partial cubemap DDS file.\n"); + return D3DXERR_INVALIDDATA; } + + faces = 6; image->resource_type = D3DRTYPE_CUBETEXTURE; } else diff --git a/dlls/d3dx9_36/tests/surface.c b/dlls/d3dx9_36/tests/surface.c index ebca259e551..5fca2f5d64d 100644 --- a/dlls/d3dx9_36/tests/surface.c +++ b/dlls/d3dx9_36/tests/surface.c @@ -408,7 +408,7 @@ static void test_dds_header_handling(void) /* Partial cubemaps are not supported. */ { (DDS_CAPS | DDS_WIDTH | DDS_HEIGHT | DDS_PIXELFORMAT), 4, 4, 1, (4 * 4), 1, (DDS_CAPS_TEXTURE | DDS_CAPS_COMPLEX), (DDS_CAPS2_CUBEMAP | DDS_CAPS2_CUBEMAP_POSITIVEX), - { D3DXERR_INVALIDDATA, }, TRUE, FALSE, (64 * 6) }, + { D3DXERR_INVALIDDATA, }, FALSE, FALSE, (64 * 6) }, };
dds = calloc(1, sizeof(*dds));