Module: wine Branch: master Commit: c621516c05dae821405d9135b095c6619a4d7d3a URL: https://gitlab.winehq.org/wine/wine/-/commit/c621516c05dae821405d9135b095c66...
Author: Connor McAdams cmcadams@codeweavers.com Date: Mon Jul 1 06:17:33 2024 -0400
d3dx9: Check the proper flag for DDS files representing a volume texture.
Signed-off-by: Connor McAdams cmcadams@codeweavers.com
---
dlls/d3dx9_36/surface.c | 4 ++-- dlls/d3dx9_36/tests/surface.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c index da23047534b..6d12872a647 100644 --- a/dlls/d3dx9_36/surface.c +++ b/dlls/d3dx9_36/surface.c @@ -638,9 +638,9 @@ static HRESULT d3dx_initialize_image_from_dds(const void *src_data, uint32_t src return D3DXERR_INVALIDDATA;
TRACE("Pixel format is %#x.\n", image->format); - if (header->caps2 & DDS_CAPS2_VOLUME) + if (header->flags & DDS_DEPTH) { - image->size.depth = header->depth; + image->size.depth = max(header->depth, 1); image->resource_type = D3DRTYPE_VOLUMETEXTURE; } else if (header->caps2 & DDS_CAPS2_CUBEMAP) diff --git a/dlls/d3dx9_36/tests/surface.c b/dlls/d3dx9_36/tests/surface.c index 28cad04199f..7c1a33ad2b1 100644 --- a/dlls/d3dx9_36/tests/surface.c +++ b/dlls/d3dx9_36/tests/surface.c @@ -384,22 +384,22 @@ static void test_dds_header_handling(void) /* The volume texture caps2 field is ignored. */ { (DDS_CAPS | DDS_WIDTH | DDS_HEIGHT | DDS_PIXELFORMAT), 4, 4, 4, (4 * 4), 3, (DDS_CAPS_TEXTURE | DDS_CAPS_COMPLEX), DDS_CAPS2_VOLUME, - { D3D_OK, 4, 4, 1, 3, D3DRTYPE_TEXTURE, }, TRUE, 292 }, + { D3D_OK, 4, 4, 1, 3, D3DRTYPE_TEXTURE, }, FALSE, 292 }, /* * The DDS_DEPTH flag is the only thing checked to determine if a DDS * file represents a volume texture. */ { (DDS_CAPS | DDS_WIDTH | DDS_HEIGHT | DDS_PIXELFORMAT | DDS_DEPTH), 4, 4, 4, (4 * 4), 3, 0, 0, - { D3D_OK, 4, 4, 4, 3, D3DRTYPE_VOLUMETEXTURE, }, TRUE, 292 }, + { D3D_OK, 4, 4, 4, 3, D3DRTYPE_VOLUMETEXTURE, }, FALSE, 292 }, /* Even if the depth field is set to 0, it's still a volume texture. */ { (DDS_CAPS | DDS_WIDTH | DDS_HEIGHT | DDS_PIXELFORMAT | DDS_DEPTH), 4, 4, 0, (4 * 4), 3, 0, 0, - { D3D_OK, 4, 4, 1, 3, D3DRTYPE_VOLUMETEXTURE, }, TRUE, 292 }, + { D3D_OK, 4, 4, 1, 3, D3DRTYPE_VOLUMETEXTURE, }, FALSE, 292 }, /* The DDS_DEPTH flag overrides cubemap caps. */ { (DDS_CAPS | DDS_WIDTH | DDS_HEIGHT | DDS_PIXELFORMAT | DDS_DEPTH), 4, 4, 4, (4 * 4), 3, (DDS_CAPS_TEXTURE | DDS_CAPS_COMPLEX), (DDS_CAPS2_CUBEMAP | DDS_CAPS2_CUBEMAP_ALL_FACES), - { D3D_OK, 4, 4, 4, 3, D3DRTYPE_VOLUMETEXTURE, }, TRUE, (292 * 6) }, + { D3D_OK, 4, 4, 4, 3, D3DRTYPE_VOLUMETEXTURE, }, FALSE, (292 * 6) }, };
dds = calloc(1, sizeof(*dds));