From 596f879071c84425e5ead041c2aaf71ae90c76c1 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Mon, 14 Oct 2024 15:55:55 -0700 Subject: [PATCH 1/2] Add DDS_LOADER_FLAG_IGNORE_MIPS to DDSTextureLoader --- Inc/DDSTextureLoader.h | 1 + Src/DDSTextureLoader.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/Inc/DDSTextureLoader.h b/Inc/DDSTextureLoader.h index 5e0f941f..cfb84f4f 100644 --- a/Inc/DDSTextureLoader.h +++ b/Inc/DDSTextureLoader.h @@ -47,6 +47,7 @@ namespace DirectX DDS_LOADER_DEFAULT = 0, DDS_LOADER_FORCE_SRGB = 0x1, DDS_LOADER_IGNORE_SRGB = 0x2, + DDS_LOADER_IGNORE_MIPS = 0x20, }; } diff --git a/Src/DDSTextureLoader.cpp b/Src/DDSTextureLoader.cpp index a9828b7e..22359354 100644 --- a/Src/DDSTextureLoader.cpp +++ b/Src/DDSTextureLoader.cpp @@ -164,6 +164,11 @@ namespace format = MakeLinear(format); } + if (loadFlags & DDS_LOADER_IGNORE_MIPS) + { + mipCount = 1; + } + switch (resDim) { case D3D11_RESOURCE_DIMENSION_TEXTURE1D: From 7434df37730b20989370cdb40daf98effc162293 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Mon, 14 Oct 2024 16:16:44 -0700 Subject: [PATCH 2/2] Code review --- Src/DDSTextureLoader.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Src/DDSTextureLoader.cpp b/Src/DDSTextureLoader.cpp index 22359354..1cf6a914 100644 --- a/Src/DDSTextureLoader.cpp +++ b/Src/DDSTextureLoader.cpp @@ -164,11 +164,6 @@ namespace format = MakeLinear(format); } - if (loadFlags & DDS_LOADER_IGNORE_MIPS) - { - mipCount = 1; - } - switch (resDim) { case D3D11_RESOURCE_DIMENSION_TEXTURE1D: @@ -408,7 +403,7 @@ namespace bool isCubeMap = false; size_t mipCount = header->mipMapCount; - if (0 == mipCount) + if ((0 == mipCount) || (loadFlags & DDS_LOADER_IGNORE_MIPS)) { mipCount = 1; }