mirror of
https://github.com/microsoft/DirectXTex
synced 2024-11-21 12:00:06 +00:00
Merge Xbox xtexconv tool into mainline via CMake (#441)
* Merge Xbox xtexconv tool into mainline via CMake * Update CMake for Xbox builds * Keep using _USE_GXDK * Code review feedback
This commit is contained in:
parent
fae11ce578
commit
9aa857e160
@ -259,19 +259,50 @@ endif()
|
||||
if(BUILD_XBOX_EXTS_SCARLETT AND WIN32)
|
||||
if (EXISTS "${GameDK_DIR}/GXDK/toolKit/include/gxdk.h")
|
||||
message(STATUS "Building Xbox extensions for Xbox Series X|S")
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE _USE_GXDK _USE_SCARLETT)
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${GameDK_DIR}/GXDK/toolKit/include ${GameDK_DIR}/GXDK/toolKit/include/Scarlett)
|
||||
|
||||
add_library(Xbox::GDKX SHARED IMPORTED)
|
||||
set_target_properties(Xbox::GDKX PROPERTIES
|
||||
IMPORTED_LOCATION "${GameDK_DIR}/GXDK/bin/Scarlett/xg_xs.dll"
|
||||
IMPORTED_IMPLIB "${GameDK_DIR}/GXDK/toolKit/lib/amd64/Scarlett/xg_xs.lib"
|
||||
MAP_IMPORTED_CONFIG_MINSIZEREL ""
|
||||
MAP_IMPORTED_CONFIG_RELWITHDEBINFO ""
|
||||
INTERFACE_COMPILE_DEFINITIONS "_USE_GXDK;_USE_SCARLETT"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${GameDK_DIR}/GXDK/toolKit/include;${GameDK_DIR}/GXDK/toolKit/include/Scarlett")
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE USE_XBOX_EXTS)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC Xbox::GDKX)
|
||||
else()
|
||||
message(FATAL_ERROR "Building Xbox extensions requires GameDKLatest")
|
||||
endif()
|
||||
elseif(BUILD_XBOX_EXTS_XBOXONE AND WIN32)
|
||||
if (EXISTS "${GameDK_DIR}/GXDK/toolKit/include/gxdk.h")
|
||||
message(STATUS "Building Xbox extensions for XboxOne using the Microsoft GDK")
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE _USE_GXDK)
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${GameDK_DIR}/GXDK/toolKit/include ${GameDK_DIR}/GXDK/toolKit/include/XboxOne)
|
||||
|
||||
add_library(Xbox::GDKX SHARED IMPORTED)
|
||||
set_target_properties(Xbox::GDKX PROPERTIES
|
||||
IMPORTED_LOCATION "${GameDK_DIR}/GXDK/bin/XboxOne/xg.dll"
|
||||
IMPORTED_IMPLIB "${GameDK_DIR}/GXDK/toolKit/lib/amd64/XboxOne/xg.lib"
|
||||
MAP_IMPORTED_CONFIG_MINSIZEREL ""
|
||||
MAP_IMPORTED_CONFIG_RELWITHDEBINFO ""
|
||||
INTERFACE_COMPILE_DEFINITIONS "_USE_GXDK"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${GameDK_DIR}/GXDK/toolKit/include;${GameDK_DIR}/GXDK/toolKit/include/XboxOne")
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE USE_XBOX_EXTS)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC Xbox::GDKX)
|
||||
|
||||
elseif (EXISTS "${XboxOneXDK_DIR}/PC/include/xdk.h")
|
||||
message(STATUS "Building Xbox extensions for XboxOne using the Xbox One XDK")
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${XboxOneXDK_DIR}/PC/include)
|
||||
|
||||
add_library(Xbox::XDK SHARED IMPORTED)
|
||||
set_target_properties(Xbox::XDK PROPERTIES
|
||||
IMPORTED_LOCATION "${XboxOneXDK_DIR}/bin/xg.dll"
|
||||
IMPORTED_IMPLIB "${XboxOneXDK_DIR}/PC/lib/amd64/xg.lib"
|
||||
MAP_IMPORTED_CONFIG_MINSIZEREL ""
|
||||
MAP_IMPORTED_CONFIG_RELWITHDEBINFO ""
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${XboxOneXDK_DIR}/PC/include")
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE USE_XBOX_EXTS)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC Xbox::XDK)
|
||||
else()
|
||||
message(FATAL_ERROR "Building Xbox extensions requires GameDKLatest or XboxOneXDKLatest")
|
||||
endif()
|
||||
@ -478,6 +509,19 @@ if(BUILD_TOOLS AND WIN32)
|
||||
target_compile_definitions(${t} PRIVATE USE_LIBPNG)
|
||||
endforeach()
|
||||
endif()
|
||||
if(BUILD_XBOX_EXTS_SCARLETT OR BUILD_XBOX_EXTS_XBOXONE)
|
||||
target_include_directories(texconv PRIVATE Auxiliary)
|
||||
target_compile_definitions(texconv PRIVATE USE_XBOX_EXTS)
|
||||
target_link_libraries(texconv PUBLIC $<TARGET_NAME_IF_EXISTS:Xbox::GDKX> $<TARGET_NAME_IF_EXISTS:Xbox::XDK>)
|
||||
|
||||
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.21")
|
||||
add_custom_command(TARGET texconv POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
$<TARGET_RUNTIME_DLLS:texconv> $<TARGET_FILE_DIR:texconv>
|
||||
COMMAND_EXPAND_LISTS
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#--- DDSView sample
|
||||
|
@ -104,7 +104,7 @@
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<AdditionalOptions>/Zc:twoPhase- /Zc:__cplusplus /ZH:SHA_256 %(AdditionalOptions)</AdditionalOptions>
|
||||
<PreprocessorDefinitions>_USE_GXDK;_UNICODE;UNICODE;WIN32;_DEBUG;_LIB;_WIN32_WINNT=0x0A00;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_USE_GXDK;USE_XBOX_EXTS;_UNICODE;UNICODE;WIN32;_DEBUG;_LIB;_WIN32_WINNT=0x0A00;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)Shaders\Compiled;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
@ -132,7 +132,7 @@
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<AdditionalOptions>/Zc:twoPhase- /Zc:__cplusplus /ZH:SHA_256 %(AdditionalOptions)</AdditionalOptions>
|
||||
<PreprocessorDefinitions>_USE_GXDK;_USE_SCARLETT;_UNICODE;UNICODE;WIN32;_DEBUG;_LIB;_WIN32_WINNT=0x0A00;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_USE_GXDK;USE_XBOX_EXTS;_USE_SCARLETT;_UNICODE;UNICODE;WIN32;_DEBUG;_LIB;_WIN32_WINNT=0x0A00;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)Shaders\Compiled;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
@ -159,7 +159,7 @@
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<AdditionalOptions>/Zc:twoPhase- /Zc:__cplusplus /ZH:SHA_256 %(AdditionalOptions)</AdditionalOptions>
|
||||
<PreprocessorDefinitions>_USE_GXDK;_UNICODE;UNICODE;WIN32;NDEBUG;_LIB;_WIN32_WINNT=0x0A00;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_USE_GXDK;USE_XBOX_EXTS;_UNICODE;UNICODE;WIN32;NDEBUG;_LIB;_WIN32_WINNT=0x0A00;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)Shaders\Compiled;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
@ -187,7 +187,7 @@
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<AdditionalOptions>/Zc:twoPhase- /Zc:__cplusplus /ZH:SHA_256 %(AdditionalOptions)</AdditionalOptions>
|
||||
<PreprocessorDefinitions>_USE_GXDK;_USE_SCARLETT;_UNICODE;UNICODE;WIN32;NDEBUG;_LIB;_WIN32_WINNT=0x0A00;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_USE_GXDK;USE_XBOX_EXTS;_USE_SCARLETT;_UNICODE;UNICODE;WIN32;NDEBUG;_LIB;_WIN32_WINNT=0x0A00;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)Shaders\Compiled;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
|
@ -104,7 +104,7 @@
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<AdditionalOptions>/Zc:twoPhase- /Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
|
||||
<PreprocessorDefinitions>_USE_GXDK;_UNICODE;UNICODE;WIN32;_DEBUG;_LIB;_WIN32_WINNT=0x0A00;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_USE_GXDK;USE_XBOX_EXTS;_UNICODE;UNICODE;WIN32;_DEBUG;_LIB;_WIN32_WINNT=0x0A00;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)Shaders\Compiled;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
@ -132,7 +132,7 @@
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<AdditionalOptions>/Zc:twoPhase- /Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
|
||||
<PreprocessorDefinitions>_USE_GXDK;_USE_SCARLETT;_UNICODE;UNICODE;WIN32;_DEBUG;_LIB;_WIN32_WINNT=0x0A00;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_USE_GXDK;USE_XBOX_EXTS;_USE_SCARLETT;_UNICODE;UNICODE;WIN32;_DEBUG;_LIB;_WIN32_WINNT=0x0A00;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)Shaders\Compiled;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
@ -159,7 +159,7 @@
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<AdditionalOptions>/Zc:twoPhase- /Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
|
||||
<PreprocessorDefinitions>_USE_GXDK;_UNICODE;UNICODE;WIN32;NDEBUG;_LIB;_WIN32_WINNT=0x0A00;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_USE_GXDK;USE_XBOX_EXTS;_UNICODE;UNICODE;WIN32;NDEBUG;_LIB;_WIN32_WINNT=0x0A00;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)Shaders\Compiled;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
@ -187,7 +187,7 @@
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<AdditionalOptions>/Zc:twoPhase- /Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
|
||||
<PreprocessorDefinitions>_USE_GXDK;_USE_SCARLETT;_UNICODE;UNICODE;WIN32;NDEBUG;_LIB;_WIN32_WINNT=0x0A00;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_USE_GXDK;USE_XBOX_EXTS;_USE_SCARLETT;_UNICODE;UNICODE;WIN32;NDEBUG;_LIB;_WIN32_WINNT=0x0A00;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>DirectXTexP.h</PrecompiledHeaderFile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)Shaders\Compiled;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
|
11
README.md
11
README.md
@ -20,12 +20,11 @@ These components are designed to work without requiring any content from the leg
|
||||
|
||||
+ This contains the DirectXTex library. This includes a full-featured DDS reader and writer including legacy format conversions, a TGA reader and writer, a HDR reader and writer, a WIC-based bitmap reader and writer (BMP, JPEG, PNG, TIFF, and HD Photo), and various texture processing functions. This is intended primarily for tool usage.
|
||||
|
||||
> The majority of the header files here are intended for internal implementation
|
||||
of the library only (``BC.h``, ``BCDirectCompute.h``, ``DDS.h``, ``DirectXTexP.h``, etc.). Only ``DirectXTex.h`` and ``DirectXTex.inl`` are meant as the 'public' header for the library.
|
||||
> The majority of the header files here are intended for internal implementation of the library only (``BC.h``, ``BCDirectCompute.h``, ``DDS.h``, ``DirectXTexP.h``, etc.). Only ``DirectXTex.h`` and ``DirectXTex.inl`` are meant as the 'public' header for the library.
|
||||
|
||||
* ``Auxiliary\``
|
||||
|
||||
+ Contains optional source files for the DirectXTex library, such as adapter loading functions using the OpenEXR library.
|
||||
+ Contains optional source files for the DirectXTex library, such as adapter loading functions using the OpenEXR library, Xbox texture tiling extensions, etc.
|
||||
|
||||
* ``Texconv\``
|
||||
|
||||
@ -87,14 +86,8 @@ For the latest version of DirectXTex, bug reports, etc. please visit the project
|
||||
|
||||
* In cases where some of the flags overlap, you can use the ``|`` to combine the relevant types: ``TEX_FILTER_FLAGS`` filter modes combine with ``WIC_FLAGS``, ``TEX_FILTER_FLAGS`` sRGB flags combine with ``TEX_PMALPHA_FLAGS`` or ``TEX_COMPRESS_FLAGS``. No other bitwise operators are defined. For example, ```WIC_FLAGS wicFlags = WIC_FLAGS_NONE | TEX_FILTER_CUBIC;```
|
||||
|
||||
* Due to the underlying Windows BMP WIC codec, alpha channels are not supported for 16bpp or 32bpp BMP pixel format files. The Windows 8.x and Windows 10 version of the Windows BMP WIC codec does support 32bpp pixel formats with alpha when using the ``BITMAPV5HEADER`` file header. Note the updated WIC is available on Windows 7 SP1 with [KB 2670838](https://walbourn.github.io/directx-11-1-and-windows-7-update/) installed.
|
||||
|
||||
* While DXGI 1.0 and DXGI 1.1 include 5:6:5 (``DXGI_FORMAT_B5G6R5_UNORM``) and 5:5:5:1 (``DXGI_FORMAT_B5G5R5A1_UNORM``) pixel format enumerations, the DirectX 10.x and 11.0 Runtimes do not support these formats for use with Direct3D. The DirectX 11.1 runtime, DXGI 1.2, and the WDDM 1.2 driver model fully support 16bpp formats (5:6:5, 5:5:5:1, and 4:4:4:4).
|
||||
|
||||
* WICTextureLoader cannot load ``.TGA`` or ``.HDR`` files unless the system has a 3rd party WIC codec installed. You must use the DirectXTex library for TGA/HDR file format support without relying on an add-on WIC codec.
|
||||
|
||||
* Loading of 96bpp floating-point TIFF files results in a corrupted image prior to Windows 8. This fix is available on Windows 7 SP1 with KB 2670838 installed.
|
||||
|
||||
* The UWP projects and the Win10 classic desktop project include configurations for the ARM64 platform. Building these requires installing the ARM64 toolset.
|
||||
|
||||
* When using clang/LLVM for the ARM64 platform, the Windows 11 SDK ([22000](https://walbourn.github.io/windows-sdk-for-windows-11/)) or later is required.
|
||||
|
@ -61,7 +61,6 @@
|
||||
#endif
|
||||
|
||||
#include "DirectXTex.h"
|
||||
|
||||
#include "DirectXPackedVector.h"
|
||||
|
||||
#ifdef USE_OPENEXR
|
||||
@ -77,6 +76,11 @@
|
||||
#include "DirectXTexPNG.h"
|
||||
#endif
|
||||
|
||||
#ifdef USE_XBOX_EXTS
|
||||
// See <https://github.com/microsoft/DirectXTex/wiki/DirectXTexXbox> for details
|
||||
#include "DirectXTexXbox.h"
|
||||
#endif
|
||||
|
||||
using namespace DirectX;
|
||||
using namespace DirectX::PackedVector;
|
||||
using Microsoft::WRL::ComPtr;
|
||||
@ -144,6 +148,10 @@ namespace
|
||||
OPT_PAPER_WHITE_NITS,
|
||||
OPT_BCNONMULT4FIX,
|
||||
OPT_SWIZZLE,
|
||||
#ifdef USE_XBOX_EXTS
|
||||
OPT_USE_XBOX,
|
||||
OPT_XGMODE,
|
||||
#endif
|
||||
OPT_MAX
|
||||
};
|
||||
|
||||
@ -241,6 +249,10 @@ namespace
|
||||
{ L"nits", OPT_PAPER_WHITE_NITS },
|
||||
{ L"fixbc4x4", OPT_BCNONMULT4FIX },
|
||||
{ L"swizzle", OPT_SWIZZLE },
|
||||
#ifdef USE_XBOX_EXTS
|
||||
{ L"xbox", OPT_USE_XBOX },
|
||||
{ L"xgmode", OPT_XGMODE },
|
||||
#endif
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
@ -333,6 +345,14 @@ namespace
|
||||
// D3D11on12 format
|
||||
{ L"A4B4G4R4_UNORM", DXGI_FORMAT(191) },
|
||||
|
||||
#ifdef USE_XBOX_EXTS
|
||||
// Xbox One extended formats
|
||||
{ L"R10G10B10_7E3_A2_FLOAT", DXGI_FORMAT(116) },
|
||||
{ L"R10G10B10_6E4_A2_FLOAT", DXGI_FORMAT(117) },
|
||||
{ L"R10G10B10_SNORM_A2_UNORM", DXGI_FORMAT(189) },
|
||||
{ L"R4G4_UNORM", DXGI_FORMAT(190) },
|
||||
#endif
|
||||
|
||||
{ nullptr, DXGI_FORMAT_UNKNOWN }
|
||||
};
|
||||
|
||||
@ -412,6 +432,13 @@ namespace
|
||||
{ L"V208", DXGI_FORMAT(131) },
|
||||
{ L"V408", DXGI_FORMAT(132) },
|
||||
|
||||
#ifdef USE_XBOX_EXTS
|
||||
// Xbox One extended formats
|
||||
{ L"D16_UNORM_S8_UINT", DXGI_FORMAT(118) },
|
||||
{ L"R16_UNORM_X8_TYPELESS", DXGI_FORMAT(119) },
|
||||
{ L"X16_TYPELESS_G8_UINT", DXGI_FORMAT(120) },
|
||||
#endif
|
||||
|
||||
{ nullptr, DXGI_FORMAT_UNKNOWN }
|
||||
};
|
||||
|
||||
@ -773,7 +800,7 @@ namespace
|
||||
wprintf(L"*UNKNOWN*");
|
||||
}
|
||||
|
||||
void PrintInfo(const TexMetadata& info)
|
||||
void PrintInfo(const TexMetadata& info, bool isXbox)
|
||||
{
|
||||
wprintf(L" (%zux%zu", info.width, info.height);
|
||||
|
||||
@ -829,6 +856,11 @@ namespace
|
||||
break;
|
||||
}
|
||||
|
||||
if (isXbox)
|
||||
{
|
||||
wprintf(L" Xbox");
|
||||
}
|
||||
|
||||
wprintf(L")");
|
||||
}
|
||||
|
||||
@ -886,7 +918,13 @@ namespace
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(USE_XBOX_EXTS) && defined(_USE_SCARLETT)
|
||||
wprintf(L"Microsoft (R) DirectX Texture Converter for Microsoft GDKX for Xbox Series X|S [Version %ls]\n", version);
|
||||
#elif defined(USE_XBOX_EXTS)
|
||||
wprintf(L"Microsoft (R) DirectX Texture Converter for Microsoft GDKX for Xbox One [Version %ls]\n", version);
|
||||
#else
|
||||
wprintf(L"Microsoft (R) DirectX Texture Converter [DirectXTex] Version %ls\n", version);
|
||||
#endif
|
||||
wprintf(L"Copyright (C) Microsoft Corp.\n");
|
||||
#ifdef _DEBUG
|
||||
wprintf(L"*** Debug build ***\n");
|
||||
@ -981,6 +1019,10 @@ namespace
|
||||
L" (DDS output only)\n"
|
||||
L" -dx10 Force use of 'DX10' extended header\n"
|
||||
L" -dx9 Force use of legacy DX9 header\n"
|
||||
#ifdef USE_XBOX_EXTS
|
||||
L" -xbox Tile/swizzle and use 'XBOX' variant of DDS\n"
|
||||
L" -xgmode <mode> Tile/swizzle using provided memory layout mode\n"
|
||||
#endif
|
||||
L"\n"
|
||||
L" (TGA input only)\n"
|
||||
L" -tgazeroalpha Allow all zero alpha channel files to be loaded 'as is'\n"
|
||||
@ -1559,6 +1601,9 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
||||
case OPT_PAPER_WHITE_NITS:
|
||||
case OPT_PRESERVE_ALPHA_COVERAGE:
|
||||
case OPT_SWIZZLE:
|
||||
#ifdef USE_XBOX_EXTS
|
||||
case OPT_XGMODE:
|
||||
#endif
|
||||
// These support either "-arg:value" or "-arg value"
|
||||
if (!*pValue)
|
||||
{
|
||||
@ -2040,6 +2085,40 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef USE_XBOX_EXTS
|
||||
case OPT_XGMODE:
|
||||
{
|
||||
#ifdef _USE_SCARLETT
|
||||
static const SValue<uint32_t> s_pXGModes[] =
|
||||
{
|
||||
{ L"xboxseriess", XG_HARDWARE_VERSION_XBOX_SCARLETT_LOCKHART },
|
||||
{ L"xboxseriesx", XG_HARDWARE_VERSION_XBOX_SCARLETT_ANACONDA },
|
||||
{ nullptr, 0 },
|
||||
};
|
||||
#else
|
||||
static const SValue<uint32_t> s_pXGModes[] =
|
||||
{
|
||||
{ L"xboxone", XG_HARDWARE_VERSION_XBOX_ONE },
|
||||
{ L"xboxonex", XG_HARDWARE_VERSION_XBOX_ONE_X },
|
||||
{ L"scorpio", XG_HARDWARE_VERSION_SCORPIO },
|
||||
{ nullptr, 0 },
|
||||
};
|
||||
#endif
|
||||
|
||||
const uint32_t mode = LookupByName(pValue, s_pXGModes);
|
||||
if (!mode)
|
||||
{
|
||||
printf("Invalid value specified with -xgmode (%ls)\n", pValue);
|
||||
wprintf(L"\n <mode>: ");
|
||||
PrintList(14, s_pXGModes);
|
||||
return 1;
|
||||
};
|
||||
|
||||
XGSetHardwareVersion(static_cast<XG_HARDWARE_VERSION>(mode));
|
||||
break;
|
||||
}
|
||||
#endif // USE_XBOX_EXTS
|
||||
}
|
||||
}
|
||||
else if (wcspbrk(pArg, L"?*") != nullptr)
|
||||
@ -2124,19 +2203,46 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
||||
std::filesystem::path curpath(pConv->szSrc);
|
||||
auto const ext = curpath.extension();
|
||||
|
||||
#ifndef USE_XBOX_EXTS
|
||||
constexpr
|
||||
#endif
|
||||
bool isXbox = false;
|
||||
if (_wcsicmp(ext.c_str(), L".dds") == 0 || _wcsicmp(ext.c_str(), L".ddx") == 0)
|
||||
{
|
||||
DDS_FLAGS ddsFlags = DDS_FLAGS_ALLOW_LARGE_FILES;
|
||||
if (dwOptions & (uint64_t(1) << OPT_DDS_DWORD_ALIGN))
|
||||
ddsFlags |= DDS_FLAGS_LEGACY_DWORD;
|
||||
if (dwOptions & (uint64_t(1) << OPT_EXPAND_LUMINANCE))
|
||||
ddsFlags |= DDS_FLAGS_EXPAND_LUMINANCE;
|
||||
if (dwOptions & (uint64_t(1) << OPT_DDS_BAD_DXTN_TAILS))
|
||||
ddsFlags |= DDS_FLAGS_BAD_DXTN_TAILS;
|
||||
if (dwOptions & (uint64_t(1) << OPT_DDS_PERMISSIVE))
|
||||
ddsFlags |= DDS_FLAGS_PERMISSIVE;
|
||||
#ifdef USE_XBOX_EXTS
|
||||
hr = Xbox::GetMetadataFromDDSFile(curpath.c_str(), info, isXbox);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
retVal = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
hr = LoadFromDDSFile(curpath.c_str(), ddsFlags, &info, *image);
|
||||
if (isXbox)
|
||||
{
|
||||
Xbox::XboxImage xbox;
|
||||
|
||||
hr = Xbox::LoadFromDDSFile(curpath.c_str(), &info, xbox);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = Xbox::Detile(xbox, *image);
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif // USE_XBOX_EXTS
|
||||
{
|
||||
DDS_FLAGS ddsFlags = DDS_FLAGS_ALLOW_LARGE_FILES;
|
||||
if (dwOptions & (uint64_t(1) << OPT_DDS_DWORD_ALIGN))
|
||||
ddsFlags |= DDS_FLAGS_LEGACY_DWORD;
|
||||
if (dwOptions & (uint64_t(1) << OPT_EXPAND_LUMINANCE))
|
||||
ddsFlags |= DDS_FLAGS_EXPAND_LUMINANCE;
|
||||
if (dwOptions & (uint64_t(1) << OPT_DDS_BAD_DXTN_TAILS))
|
||||
ddsFlags |= DDS_FLAGS_BAD_DXTN_TAILS;
|
||||
if (dwOptions & (uint64_t(1) << OPT_DDS_PERMISSIVE))
|
||||
ddsFlags |= DDS_FLAGS_PERMISSIVE;
|
||||
|
||||
hr = LoadFromDDSFile(curpath.c_str(), ddsFlags, &info, *image);
|
||||
}
|
||||
if (FAILED(hr))
|
||||
{
|
||||
wprintf(L" FAILED (%08X%ls)\n", static_cast<unsigned int>(hr), GetErrorDesc(hr));
|
||||
@ -2291,7 +2397,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
||||
}
|
||||
}
|
||||
|
||||
PrintInfo(info);
|
||||
PrintInfo(info, isXbox);
|
||||
|
||||
size_t tMips = (!mipLevels && info.mipLevels > 1) ? info.mipLevels : mipLevels;
|
||||
|
||||
@ -3741,7 +3847,12 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
||||
assert(img);
|
||||
const size_t nimg = image->GetImageCount();
|
||||
|
||||
PrintInfo(info);
|
||||
#ifdef USE_XBOX_EXTS
|
||||
const bool isXboxOut = ((FileType == CODEC_DDS) && (dwOptions & (uint64_t(1) << OPT_USE_XBOX))) != 0;
|
||||
#else
|
||||
constexpr bool isXboxOut = false;
|
||||
#endif
|
||||
PrintInfo(info, isXboxOut);
|
||||
wprintf(L"\n");
|
||||
|
||||
// Figure out dest filename
|
||||
@ -3806,6 +3917,19 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
||||
switch (FileType)
|
||||
{
|
||||
case CODEC_DDS:
|
||||
#ifdef USE_XBOX_EXTS
|
||||
if (isXboxOut)
|
||||
{
|
||||
Xbox::XboxImage xbox;
|
||||
|
||||
hr = Xbox::Tile(img, nimg, info, xbox);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = Xbox::SaveToDDSFile(xbox, destName.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif // USE_XBOX_EXTS
|
||||
{
|
||||
DDS_FLAGS ddsFlags = DDS_FLAGS_NONE;
|
||||
if (dwOptions & (uint64_t(1) << OPT_USE_DX10))
|
||||
@ -3823,8 +3947,8 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
||||
}
|
||||
|
||||
hr = SaveToDDSFile(img, nimg, info, ddsFlags, destName.c_str());
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case CODEC_TGA:
|
||||
hr = SaveToTGAFile(img[0], TGA_FLAGS_NONE, destName.c_str(), (dwOptions & (uint64_t(1) << OPT_TGA20)) ? &info : nullptr);
|
||||
|
Loading…
Reference in New Issue
Block a user