1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-11-08 05:50:05 +00:00

CMake support added for building with MinGW (#275)

This commit is contained in:
Chuck Walbourn 2022-05-05 14:50:13 -07:00 committed by GitHub
parent 24c1415c9a
commit 9c72f2c6cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 229 additions and 151 deletions

View File

@ -8,7 +8,7 @@ if(ENABLE_OPENEXR_SUPPORT)
find_dependency(OpenEXR)
endif()
if((NOT WIN32) OR VCPKG_TOOLCHAIN)
if(MINGW OR (NOT WIN32) OR VCPKG_TOOLCHAIN)
find_dependency(directx-headers CONFIG)
find_dependency(directxmath CONFIG)
endif()

View File

@ -156,7 +156,7 @@ if(ENABLE_OPENEXR_SUPPORT)
target_include_directories(${PROJECT_NAME} PRIVATE ${OPENEXR_INCLUDE_DIRS}/OpenEXR)
endif()
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16")
if ((${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16") AND (NOT MINGW))
target_precompile_headers(${PROJECT_NAME} PRIVATE DirectXTex/DirectXTexP.h)
endif()
@ -172,7 +172,7 @@ if(MSVC)
string(REPLACE "/GR " "/GR- " CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
endif()
if ((NOT WIN32) OR VCPKG_TOOLCHAIN)
if (MINGW OR (NOT WIN32) OR VCPKG_TOOLCHAIN)
message("INFO: Using VCPKG for DirectX-Headers and DirectXMath.")
find_package(directx-headers CONFIG REQUIRED)
find_package(directxmath CONFIG REQUIRED)
@ -268,7 +268,7 @@ if(BUILD_SAMPLE AND BUILD_DX11 AND WIN32 AND (NOT WINDOWS_STORE))
endif()
endif()
if ((NOT WIN32) OR VCPKG_TOOLCHAIN)
if (MINGW OR (NOT WIN32) OR VCPKG_TOOLCHAIN)
foreach(t IN LISTS TOOL_EXES)
target_link_libraries(${t} Microsoft::DirectXMath)
endforeach()
@ -282,12 +282,23 @@ if(MSVC)
if((${CMAKE_SIZEOF_VOID_P} EQUAL 4) AND (NOT ${DIRECTX_ARCH} MATCHES "^arm"))
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
target_compile_options(${t} PRIVATE /arch:SSE2)
target_link_options(${t} PRIVATE /SAFESEH)
endforeach()
endif()
endif()
if(NOT ${DIRECTX_ARCH} MATCHES "^arm")
if (${CMAKE_SIZEOF_VOID_P} EQUAL "4")
set(ARCH_SSE2 $<$<CXX_COMPILER_ID:MSVC>:/arch:SSE2> $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-msse2>)
else()
set(ARCH_SSE2 $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-msse2>)
endif()
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
target_compile_options(${t} PRIVATE ${ARCH_SSE2})
endforeach()
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(WarningsLib "-Wpedantic" "-Wextra")
target_compile_options(${PROJECT_NAME} PRIVATE ${WarningsLib})
@ -299,6 +310,12 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_options(${t} PRIVATE ${WarningsEXE})
endforeach()
endif()
if(MINGW)
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
target_compile_options(${t} PRIVATE -Wno-ignored-attributes)
target_link_options(${t} PRIVATE -municode)
endforeach()
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
target_compile_options(${t} PRIVATE /sdl /permissive- /JMC- /Zc:__cplusplus)

View File

@ -81,6 +81,17 @@
"strategy": "external"
}
},
{
"name": "GNUC",
"hidden": true,
"cacheVariables": {
"CMAKE_CXX_COMPILER": "g++.exe"
},
"toolset": {
"value": "host=x64",
"strategy": "external"
}
},
{
"name": "Win7",
@ -151,9 +162,14 @@
{ "name": "arm64-Debug-UWP-Clang" , "description": "Clang/LLVM for AArch64 (Debug) for UWP", "inherits": [ "base", "ARM64", "Debug", "Clang", "UWP" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } },
{ "name": "arm64-Release-UWP-Clang", "description": "Clang/LLVM for AArch64 (Release) for UWP", "inherits": [ "base", "ARM64", "Release", "Clang", "UWP" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } },
{ "name": "x64-Debug-Win7-Clang" , "description": "Clang/LLVM for x64 (Debug) for Windows 7", "inherits": [ "base", "x64", "Debug", "Clang", "Win7" ] },
{ "name": "x64-Release-Win7-Clang" , "description": "Clang/LLVM for x64 (Release) for Windows 7", "inherits": [ "base", "x64", "Release", "Clang", "Win7" ] },
{ "name": "x86-Debug-Win7-Clang" , "description": "Clang/LLVM for x86 (Debug) for Windows 7", "inherits": [ "base", "x86", "Debug", "Clang", "Win7" ], "environment": { "CXXFLAGS": "-m32" } },
{ "name": "x86-Release-Win7-Clang" , "description": "Clang/LLVM for x86 (Release) for Windows 7", "inherits": [ "base", "x86", "Release", "Clang", "Win7" ], "environment": { "CXXFLAGS": "-m32" } }
{ "name": "x64-Debug-Win7-Clang" , "description": "Clang/LLVM for x64 (Debug) for Windows 7", "inherits": [ "base", "x64", "Debug", "Clang", "Win7" ] },
{ "name": "x64-Release-Win7-Clang", "description": "Clang/LLVM for x64 (Release) for Windows 7", "inherits": [ "base", "x64", "Release", "Clang", "Win7" ] },
{ "name": "x86-Debug-Win7-Clang" , "description": "Clang/LLVM for x86 (Debug) for Windows 7", "inherits": [ "base", "x86", "Debug", "Clang", "Win7" ], "environment": { "CXXFLAGS": "-m32" } },
{ "name": "x86-Release-Win7-Clang", "description": "Clang/LLVM for x86 (Release) for Windows 7", "inherits": [ "base", "x86", "Release", "Clang", "Win7" ], "environment": { "CXXFLAGS": "-m32" } },
{ "name": "x64-Debug-MinGW" , "description": "MinG-W64 (Debug)", "inherits": [ "base", "x64", "Debug", "GNUC", "VCPKG" ], "environment": { "PATH": "$penv{PATH};c:/mingw64/bin" } },
{ "name": "x64-Release-MinGW", "description": "MinG-W64 (Release)", "inherits": [ "base", "x64", "Release", "GNUC", "VCPKG" ], "environment": { "PATH": "$penv{PATH};c:/mingw64/bin" } },
{ "name": "x86-Debug-MinGW" , "description": "MinG-W32 (Debug)", "inherits": [ "base", "x86", "Debug", "GNUC", "VCPKG" ], "environment": { "PATH": "$penv{PATH};c:/mingw32/bin" } },
{ "name": "x86-Release-MinGW", "description": "MinG-W32 (Release)", "inherits": [ "base", "x86", "Release", "GNUC", "VCPKG" ], "environment": { "PATH": "$penv{PATH};c:/mingw32/bin" } }
]
}

View File

@ -135,16 +135,18 @@ namespace
inline HANDLE safe_handle(HANDLE h) noexcept { return (h == INVALID_HANDLE_VALUE) ? nullptr : h; }
#if defined(_DEBUG) || defined(PROFILE)
template<UINT TNameLength>
inline void SetDebugObjectName(_In_ ID3D11DeviceChild* resource, _In_ const char(&name)[TNameLength]) noexcept
{
#if defined(_DEBUG) || defined(PROFILE)
resource->SetPrivateData(WKPDID_D3DDebugObjectName, TNameLength - 1, name);
#else
UNREFERENCED_PARAMETER(resource);
UNREFERENCED_PARAMETER(name);
#endif
}
#else
template<UINT TNameLength>
inline void SetDebugObjectName(_In_ ID3D11DeviceChild*, _In_ const char(&)[TNameLength]) noexcept
{
}
#endif
//--------------------------------------------------------------------------------------
HRESULT LoadTextureDataFromMemory(

View File

@ -21,7 +21,7 @@
#include <memory>
#include <new>
#ifndef WIN32
#ifndef _WIN32
#include <fstream>
#include <filesystem>
#endif
@ -47,10 +47,10 @@
#define D3DX12_NO_STATE_OBJECT_HELPERS
#define D3DX12_NO_CHECK_FEATURE_SUPPORT_CLASS
#ifdef WIN32
#include "d3dx12.h"
#else
#if !defined(_WIN32) || defined(USING_DIRECTX_HEADERS)
#include "directx/d3dx12.h"
#else
#include "d3dx12.h"
#endif
using namespace DirectX;
@ -157,7 +157,7 @@ struct DDS_HEADER_DXT10
//--------------------------------------------------------------------------------------
namespace
{
#ifdef WIN32
#ifdef _WIN32
struct handle_closer { void operator()(HANDLE h) noexcept { if (h) CloseHandle(h); } };
using ScopedHandle = std::unique_ptr<void, handle_closer>;
@ -165,16 +165,18 @@ namespace
inline HANDLE safe_handle(HANDLE h) noexcept { return (h == INVALID_HANDLE_VALUE) ? nullptr : h; }
#endif
#if !defined(NO_D3D12_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) )
template<UINT TNameLength>
inline void SetDebugObjectName(_In_ ID3D12DeviceChild* resource, _In_z_ const wchar_t(&name)[TNameLength]) noexcept
{
#if !defined(NO_D3D12_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) )
resource->SetName(name);
#else
UNREFERENCED_PARAMETER(resource);
UNREFERENCED_PARAMETER(name);
#endif
}
#else
template<UINT TNameLength>
inline void SetDebugObjectName(_In_ ID3D12DeviceChild*, _In_z_ const wchar_t(&)[TNameLength]) noexcept
{
}
#endif
inline uint32_t CountMips(uint32_t width, uint32_t height) noexcept
{
@ -274,7 +276,7 @@ namespace
*bitSize = 0;
#ifdef WIN32
#ifdef _WIN32
// open the file
ScopedHandle hFile(safe_handle(CreateFile2(fileName,
GENERIC_READ,

View File

@ -16,13 +16,21 @@
#pragma once
#if defined(WIN32) || defined(_WIN32)
#include <d3d12.h>
#pragma comment(lib,"dxguid.lib")
#else
#ifdef __MINGW32__
#include <unknwn.h>
#endif
#ifndef _WIN32
#include <wsl/winadapter.h>
#include <wsl/wrladapter.h>
#endif
#if !defined(_WIN32) || defined(USING_DIRECTX_HEADERS)
#include <directx/d3d12.h>
#include <dxguids/dxguids.h>
#else
#include <d3d12.h>
#pragma comment(lib,"dxguid.lib")
#endif
#include <cstddef>

View File

@ -448,12 +448,7 @@ HRESULT InitDevice(const TexMetadata& mdata)
g_pImmediateContext->OMSetRenderTargets(1, &g_pRenderTargetView, g_pDepthStencilView);
// Setup the viewport
D3D11_VIEWPORT vp = {};
vp.TopLeftX = vp.TopLeftY = 0.f;
vp.Width = static_cast<float>(width);
vp.Height = static_cast<float>(height);
vp.MinDepth = D3D11_MIN_DEPTH;
vp.MaxDepth = D3D11_MAX_DEPTH;
const D3D11_VIEWPORT vp = { 0.f, 0.f, static_cast<float>(width), static_cast<float>(height), 0.f, 1.f };
g_pImmediateContext->RSSetViewports(1, &vp);
// Create the vertex shader

View File

@ -17,7 +17,7 @@
#include <utility>
#include <vector>
#if defined(WIN32) || defined(_WIN32)
#ifdef _WIN32
#if !defined(__d3d11_h__) && !defined(__d3d11_x_h__) && !defined(__d3d12_h__) && !defined(__d3d12_x_h__) && !defined(__XBOX_D3D12_X__)
#ifdef _GAMING_XBOX_SCARLETT
#include <d3d12_xs.h>
@ -36,8 +36,8 @@
#include <DirectXMath.h>
#ifdef WIN32
#ifdef NTDDI_WIN10_FE
#ifdef _WIN32
#if defined(NTDDI_WIN10_FE) || defined(__MINGW32__)
#include <ocidl.h>
#else
#include <OCIdl.h>
@ -315,7 +315,7 @@ namespace DirectX
_In_ TGA_FLAGS flags,
_Out_ TexMetadata& metadata) noexcept;
#ifdef WIN32
#ifdef _WIN32
HRESULT __cdecl GetMetadataFromWICMemory(
_In_reads_bytes_(size) const void* pSource, _In_ size_t size,
_In_ WIC_FLAGS flags,
@ -486,7 +486,7 @@ namespace DirectX
_In_z_ const wchar_t* szFile, _In_opt_ const TexMetadata* metadata = nullptr) noexcept;
// WIC operations
#ifdef WIN32
#ifdef _WIN32
HRESULT __cdecl LoadFromWICMemory(
_In_reads_bytes_(size) const void* pSource, _In_ size_t size,
_In_ WIC_FLAGS flags,
@ -542,7 +542,7 @@ namespace DirectX
TEX_FR_FLIP_VERTICAL = 0x10,
};
#ifdef WIN32
#ifdef _WIN32
HRESULT __cdecl FlipRotate(_In_ const Image& srcImage, _In_ TEX_FR_FLAGS flags, _Out_ ScratchImage& image) noexcept;
HRESULT __cdecl FlipRotate(
_In_reads_(nimages) const Image* srcImages, _In_ size_t nimages, _In_ const TexMetadata& metadata,
@ -828,7 +828,7 @@ namespace DirectX
//---------------------------------------------------------------------------------
// WIC utility code
#ifdef WIN32
#ifdef _WIN32
enum WICCodecs
{
WIC_CODEC_BMP = 1, // Windows Bitmap (.bmp)

View File

@ -4394,7 +4394,7 @@ namespace
_Out_ WICPixelFormatGUID& pfGUID,
_Out_ WICPixelFormatGUID& targetGUID) noexcept
{
#ifndef WIN32
#ifndef _WIN32
UNREFERENCED_PARAMETER(filter);
UNREFERENCED_PARAMETER(sformat);
UNREFERENCED_PARAMETER(tformat);
@ -4557,7 +4557,7 @@ namespace
_In_ float threshold,
_In_ const Image& destImage)
{
#ifndef WIN32
#ifndef _WIN32
UNREFERENCED_PARAMETER(srcImage);
UNREFERENCED_PARAMETER(pfGUID);
UNREFERENCED_PARAMETER(targetGUID);

View File

@ -19,17 +19,15 @@
#define D3DX12_NO_STATE_OBJECT_HELPERS
#define D3DX12_NO_CHECK_FEATURE_SUPPORT_CLASS
#ifdef WIN32
#ifdef _GAMING_XBOX_SCARLETT
#include <d3dx12_xs.h>
#elif (defined(_XBOX_ONE) && defined(_TITLE)) || defined(_GAMING_XBOX)
#include "d3dx12_x.h"
#else
#include "d3dx12.h"
#endif
#else
#elif !defined(_WIN32) || defined(USING_DIRECTX_HEADERS)
#include "directx/d3dx12.h"
#include "dxguids/dxguids.h"
#else
#include "d3dx12.h"
#endif
#ifdef __clang__
@ -304,7 +302,7 @@ namespace
// Block until the copy is complete
while (fence->GetCompletedValue() < 1)
{
#ifdef WIN32
#ifdef _WIN32
SwitchToThread();
#else
std::this_thread::yield();

View File

@ -1583,7 +1583,7 @@ HRESULT DirectX::GetMetadataFromDDSFile(
if (!szFile)
return E_INVALIDARG;
#ifdef WIN32
#ifdef _WIN32
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
ScopedHandle hFile(safe_handle(CreateFile2(szFile, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, nullptr)));
#else
@ -1637,7 +1637,7 @@ HRESULT DirectX::GetMetadataFromDDSFile(
// Read the header in (including extended header if present)
uint8_t header[MAX_HEADER_SIZE] = {};
#ifdef WIN32
#ifdef _WIN32
DWORD bytesRead = 0;
if (!ReadFile(hFile.get(), header, MAX_HEADER_SIZE, &bytesRead, nullptr))
{
@ -1746,7 +1746,7 @@ HRESULT DirectX::LoadFromDDSFile(
image.Release();
#ifdef WIN32
#ifdef _WIN32
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
ScopedHandle hFile(safe_handle(CreateFile2(szFile, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, nullptr)));
#else
@ -1798,7 +1798,7 @@ HRESULT DirectX::LoadFromDDSFile(
// Read the header in (including extended header if present)
uint8_t header[MAX_HEADER_SIZE] = {};
#ifdef WIN32
#ifdef _WIN32
DWORD bytesRead = 0;
if (!ReadFile(hFile.get(), header, MAX_HEADER_SIZE, &bytesRead, nullptr))
{
@ -1824,7 +1824,7 @@ HRESULT DirectX::LoadFromDDSFile(
if (!(convFlags & CONV_FLAGS_DX10))
{
#ifdef WIN32
#ifdef _WIN32
// Must reset file position since we read more than the standard header above
const LARGE_INTEGER filePos = { { sizeof(uint32_t) + sizeof(DDS_HEADER), 0 } };
if (!SetFilePointerEx(hFile.get(), filePos, nullptr, FILE_BEGIN))
@ -1849,7 +1849,7 @@ HRESULT DirectX::LoadFromDDSFile(
return E_OUTOFMEMORY;
}
#ifdef WIN32
#ifdef _WIN32
if (!ReadFile(hFile.get(), pal8.get(), 256 * sizeof(uint32_t), &bytesRead, nullptr))
{
return HRESULT_FROM_WIN32(GetLastError());
@ -1885,7 +1885,7 @@ HRESULT DirectX::LoadFromDDSFile(
return E_OUTOFMEMORY;
}
#ifdef WIN32
#ifdef _WIN32
if (!ReadFile(hFile.get(), temp.get(), static_cast<DWORD>(remaining), &bytesRead, nullptr))
{
image.Release();
@ -1943,7 +1943,7 @@ HRESULT DirectX::LoadFromDDSFile(
return HRESULT_E_ARITHMETIC_OVERFLOW;
}
#ifdef WIN32
#ifdef _WIN32
auto pixelBytes = static_cast<DWORD>(image.GetPixelsSize());
if (!ReadFile(hFile.get(), image.GetPixels(), pixelBytes, &bytesRead, nullptr))
{
@ -2230,7 +2230,7 @@ HRESULT DirectX::SaveToDDSFile(
return hr;
// Create file and write header
#ifdef WIN32
#ifdef _WIN32
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
ScopedHandle hFile(safe_handle(CreateFile2(szFile,
GENERIC_WRITE | DELETE, 0, CREATE_ALWAYS, nullptr)));
@ -2292,7 +2292,7 @@ HRESULT DirectX::SaveToDDSFile(
if ((images[index].slicePitch == ddsSlicePitch) && (ddsSlicePitch <= UINT32_MAX))
{
#ifdef WIN32
#ifdef _WIN32
if (!WriteFile(hFile.get(), images[index].pixels, static_cast<DWORD>(ddsSlicePitch), &bytesWritten, nullptr))
{
return HRESULT_FROM_WIN32(GetLastError());
@ -2325,7 +2325,7 @@ HRESULT DirectX::SaveToDDSFile(
const size_t lines = ComputeScanlines(metadata.format, images[index].height);
for (size_t j = 0; j < lines; ++j)
{
#ifdef WIN32
#ifdef _WIN32
if (!WriteFile(hFile.get(), sPtr, static_cast<DWORD>(ddsRowPitch), &bytesWritten, nullptr))
{
return HRESULT_FROM_WIN32(GetLastError());
@ -2377,7 +2377,7 @@ HRESULT DirectX::SaveToDDSFile(
if ((images[index].slicePitch == ddsSlicePitch) && (ddsSlicePitch <= UINT32_MAX))
{
#ifdef WIN32
#ifdef _WIN32
if (!WriteFile(hFile.get(), images[index].pixels, static_cast<DWORD>(ddsSlicePitch), &bytesWritten, nullptr))
{
return HRESULT_FROM_WIN32(GetLastError());
@ -2410,7 +2410,7 @@ HRESULT DirectX::SaveToDDSFile(
const size_t lines = ComputeScanlines(metadata.format, images[index].height);
for (size_t j = 0; j < lines; ++j)
{
#ifdef WIN32
#ifdef _WIN32
if (!WriteFile(hFile.get(), sPtr, static_cast<DWORD>(ddsRowPitch), &bytesWritten, nullptr))
{
return HRESULT_FROM_WIN32(GetLastError());
@ -2440,7 +2440,7 @@ HRESULT DirectX::SaveToDDSFile(
return E_FAIL;
}
#ifdef WIN32
#ifdef _WIN32
delonfail.clear();
#endif

View File

@ -34,7 +34,7 @@
using namespace DirectX;
#ifndef WIN32
#ifndef _WIN32
#include <cstdarg>
#define strncpy_s strncpy
@ -77,7 +77,7 @@ namespace
return 0;
}
#ifndef WIN32
#ifndef _WIN32
template<size_t sizeOfBuffer>
inline int sprintf_s(char(&buffer)[sizeOfBuffer], const char* format, ...)
{
@ -598,7 +598,7 @@ HRESULT DirectX::GetMetadataFromHDRFile(const wchar_t* szFile, TexMetadata& meta
if (!szFile)
return E_INVALIDARG;
#ifdef WIN32
#ifdef _WIN32
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
ScopedHandle hFile(safe_handle(CreateFile2(szFile, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, nullptr)));
#else
@ -652,7 +652,7 @@ HRESULT DirectX::GetMetadataFromHDRFile(const wchar_t* szFile, TexMetadata& meta
// Read the first part of the file to find the header
uint8_t header[8192] = {};
#ifdef WIN32
#ifdef _WIN32
DWORD bytesRead = 0;
if (!ReadFile(hFile.get(), header, std::min<DWORD>(sizeof(header), fileInfo.EndOfFile.LowPart), &bytesRead, nullptr))
{
@ -902,7 +902,7 @@ HRESULT DirectX::LoadFromHDRFile(const wchar_t* szFile, TexMetadata* metadata, S
image.Release();
#ifdef WIN32
#ifdef _WIN32
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
ScopedHandle hFile(safe_handle(CreateFile2(szFile, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, nullptr)));
#else
@ -960,7 +960,7 @@ HRESULT DirectX::LoadFromHDRFile(const wchar_t* szFile, TexMetadata* metadata, S
return E_OUTOFMEMORY;
}
#ifdef WIN32
#ifdef _WIN32
DWORD bytesRead = 0;
if (!ReadFile(hFile.get(), temp.get(), fileInfo.EndOfFile.LowPart, &bytesRead, nullptr))
{
@ -1125,7 +1125,7 @@ HRESULT DirectX::SaveToHDRFile(const Image& image, const wchar_t* szFile) noexce
}
// Create file and write header
#ifdef WIN32
#ifdef _WIN32
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
ScopedHandle hFile(safe_handle(CreateFile2(szFile,
GENERIC_WRITE, 0, CREATE_ALWAYS, nullptr)));
@ -1163,7 +1163,7 @@ HRESULT DirectX::SaveToHDRFile(const Image& image, const wchar_t* szFile) noexce
return hr;
// Write blob
#ifdef WIN32
#ifdef _WIN32
auto const bytesToWrite = static_cast<const DWORD>(blob.GetBufferSize());
DWORD bytesWritten;
if (!WriteFile(hFile.get(), blob.GetBufferPointer(), bytesToWrite, &bytesWritten, nullptr))
@ -1196,7 +1196,7 @@ HRESULT DirectX::SaveToHDRFile(const Image& image, const wchar_t* szFile) noexce
char header[256] = {};
sprintf_s(header, g_Header, image.height, image.width);
#ifdef WIN32
#ifdef _WIN32
auto const headerLen = static_cast<DWORD>(strlen(header));
DWORD bytesWritten;
@ -1221,7 +1221,7 @@ HRESULT DirectX::SaveToHDRFile(const Image& image, const wchar_t* szFile) noexce
FloatToRGBE(rgbe, reinterpret_cast<const float*>(sPtr), image.width, fpp);
sPtr += image.rowPitch;
#ifdef WIN32
#ifdef _WIN32
if (!WriteFile(hFile.get(), rgbe, static_cast<DWORD>(rowPitch), &bytesWritten, nullptr))
{
return HRESULT_FROM_WIN32(GetLastError());
@ -1258,7 +1258,7 @@ HRESULT DirectX::SaveToHDRFile(const Image& image, const wchar_t* szFile) noexce
if (encSize > UINT32_MAX)
return HRESULT_E_ARITHMETIC_OVERFLOW;
#ifdef WIN32
#ifdef _WIN32
if (!WriteFile(hFile.get(), enc, static_cast<DWORD>(encSize), &bytesWritten, nullptr))
{
return HRESULT_FROM_WIN32(GetLastError());
@ -1274,7 +1274,7 @@ HRESULT DirectX::SaveToHDRFile(const Image& image, const wchar_t* szFile) noexce
}
else
{
#ifdef WIN32
#ifdef _WIN32
if (!WriteFile(hFile.get(), rgbe, static_cast<DWORD>(rowPitch), &bytesWritten, nullptr))
{
return HRESULT_FROM_WIN32(GetLastError());
@ -1292,7 +1292,7 @@ HRESULT DirectX::SaveToHDRFile(const Image& image, const wchar_t* szFile) noexce
#endif
}
#ifdef WIN32
#ifdef _WIN32
delonfail.clear();
#endif

View File

@ -14,7 +14,7 @@
using namespace DirectX;
using namespace DirectX::Internal;
#ifndef WIN32
#ifndef _WIN32
namespace
{
inline void * _aligned_malloc(size_t size, size_t alignment)

View File

@ -65,7 +65,7 @@ namespace
return mipLevels;
}
#ifdef WIN32
#ifdef _WIN32
HRESULT EnsureWicBitmapPixelFormat(
_In_ IWICImagingFactory* pWIC,
_In_ IWICBitmap* src,
@ -399,7 +399,7 @@ bool DirectX::Internal::CalculateMipLevels3D(
return true;
}
#ifdef WIN32
#ifdef _WIN32
//--- Resizing color and alpha channels separately using WIC ---
_Use_decl_annotations_
HRESULT DirectX::Internal::ResizeSeparateColorAndAlpha(
@ -543,7 +543,7 @@ HRESULT DirectX::Internal::ResizeSeparateColorAndAlpha(
if (SUCCEEDED(hr))
{
WICInProcPointer colorWithAlphaData = nullptr;
BYTE* colorWithAlphaData = nullptr;
UINT colorWithAlphaSizeInBytes = 0;
UINT colorWithAlphaStride = 0;
@ -560,7 +560,7 @@ HRESULT DirectX::Internal::ResizeSeparateColorAndAlpha(
}
}
WICInProcPointer colorData = nullptr;
BYTE* colorData = nullptr;
UINT colorSizeInBytes = 0;
UINT colorStride = 0;
if (SUCCEEDED(hr))
@ -620,7 +620,7 @@ HRESULT DirectX::Internal::ResizeSeparateColorAndAlpha(
namespace
{
#ifdef WIN32
#ifdef _WIN32
//--- determine when to use WIC vs. non-WIC paths ---
bool UseWICFiltering(_In_ DXGI_FORMAT format, _In_ TEX_FILTER_FLAGS filter) noexcept
{
@ -2836,7 +2836,7 @@ HRESULT DirectX::GenerateMipMaps(
static_assert(TEX_FILTER_POINT == 0x100000, "TEX_FILTER_ flag values don't match TEX_FILTER_MODE_MASK");
#ifdef WIN32
#ifdef _WIN32
bool usewic = UseWICFiltering(baseImage.format, filter);
WICPixelFormatGUID pfGUID = {};
@ -3051,7 +3051,7 @@ HRESULT DirectX::GenerateMipMaps(
static_assert(TEX_FILTER_POINT == 0x100000, "TEX_FILTER_ flag values don't match TEX_FILTER_MODE_MASK");
#ifdef WIN32
#ifdef _WIN32
bool usewic = !metadata.IsPMAlpha() && UseWICFiltering(metadata.format, filter);
WICPixelFormatGUID pfGUID = {};

View File

@ -71,14 +71,14 @@
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#endif
#if defined(WIN32) || defined(_WIN32)
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#pragma warning(push)
#pragma warning(disable : 4005)
#define NOMINMAX
#define NOMINMAX 1
#define NODRAWTEXT
#define NOGDI
#define NOBITMAP
@ -89,6 +89,10 @@
#include <Windows.h>
#ifdef __MINGW32__
#include <unknwn.h>
#endif
#ifndef _WIN32_WINNT_WIN10
#define _WIN32_WINNT_WIN10 0x0A00
#endif
@ -133,7 +137,7 @@
#include <new>
#include <tuple>
#ifndef WIN32
#ifndef _WIN32
#include <fstream>
#include <filesystem>
#include <thread>
@ -151,8 +155,8 @@
#include <malloc.h>
#ifdef WIN32
#ifdef NTDDI_WIN10_FE
#ifdef _WIN32
#if defined(NTDDI_WIN10_FE) || defined(__MINGW32__)
#include <ole2.h>
#else
#include <Ole2.h>
@ -181,6 +185,10 @@ using WICPixelFormatGUID = GUID;
#define XBOX_DXGI_FORMAT_R4G4_UNORM DXGI_FORMAT(190)
#if defined(__MINGW32__) && !defined(E_BOUNDS)
#define E_BOUNDS static_cast<HRESULT>(0x8000000BL)
#endif
// HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW)
#define HRESULT_E_ARITHMETIC_OVERFLOW static_cast<HRESULT>(0x80070216L)
@ -211,7 +219,7 @@ namespace DirectX
{
//-----------------------------------------------------------------------------
// WIC helper functions
#ifdef WIN32
#ifdef _WIN32
DXGI_FORMAT __cdecl WICToDXGI(_In_ const GUID& guid) noexcept;
bool __cdecl DXGIToWIC(_In_ DXGI_FORMAT format, _Out_ GUID& guid, _In_ bool ignoreRGBvsBGR = false) noexcept;
@ -418,7 +426,7 @@ namespace DirectX
bool __cdecl CalculateMipLevels3D(_In_ size_t width, _In_ size_t height, _In_ size_t depth,
_Inout_ size_t& mipLevels) noexcept;
#ifdef WIN32
#ifdef _WIN32
HRESULT __cdecl ResizeSeparateColorAndAlpha(_In_ IWICImagingFactory* pWIC,
_In_ bool iswic2,
_In_ IWICBitmap* original,

View File

@ -19,7 +19,7 @@ using Microsoft::WRL::ComPtr;
namespace
{
#ifdef WIN32
#ifdef _WIN32
//--- Do image resize using WIC ---
HRESULT PerformResizeUsingWIC(
const Image& srcImage,
@ -876,7 +876,7 @@ HRESULT DirectX::Resize(
return HRESULT_E_NOT_SUPPORTED;
}
#ifdef WIN32
#ifdef _WIN32
bool usewic = UseWICFiltering(srcImage.format, filter);
WICPixelFormatGUID pfGUID = {};
@ -905,7 +905,7 @@ HRESULT DirectX::Resize(
if (!rimage)
return E_POINTER;
#ifdef WIN32
#ifdef _WIN32
if (usewic)
{
if (wicpf)
@ -963,7 +963,7 @@ HRESULT DirectX::Resize(
if (FAILED(hr))
return hr;
#ifdef WIN32
#ifdef _WIN32
bool usewic = !metadata.IsPMAlpha() && UseWICFiltering(metadata.format, filter);
WICPixelFormatGUID pfGUID = {};
@ -1019,7 +1019,7 @@ HRESULT DirectX::Resize(
return E_FAIL;
}
#ifdef WIN32
#ifdef _WIN32
if (usewic)
{
if (wicpf)
@ -1080,7 +1080,7 @@ HRESULT DirectX::Resize(
return E_FAIL;
}
#ifdef WIN32
#ifdef _WIN32
if (usewic)
{
if (wicpf)

View File

@ -1224,7 +1224,7 @@ namespace
time_t now = {};
time(&now);
#ifdef WIN32
#ifdef _WIN32
tm info;
auto pinfo = &info;
if (!gmtime_s(pinfo, &now))
@ -1343,7 +1343,7 @@ HRESULT DirectX::GetMetadataFromTGAFile(const wchar_t* szFile, TGA_FLAGS flags,
if (!szFile)
return E_INVALIDARG;
#ifdef WIN32
#ifdef _WIN32
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
ScopedHandle hFile(safe_handle(CreateFile2(szFile, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, nullptr)));
#else
@ -1397,7 +1397,7 @@ HRESULT DirectX::GetMetadataFromTGAFile(const wchar_t* szFile, TGA_FLAGS flags,
// Read the standard header (we don't need the file footer to parse the file)
uint8_t header[sizeof(TGA_HEADER)] = {};
#ifdef WIN32
#ifdef _WIN32
DWORD bytesRead = 0;
if (!ReadFile(hFile.get(), header, sizeof(TGA_HEADER), &bytesRead, nullptr))
{
@ -1424,7 +1424,7 @@ HRESULT DirectX::GetMetadataFromTGAFile(const wchar_t* szFile, TGA_FLAGS flags,
{
TGA_FOOTER footer = {};
#ifdef WIN32
#ifdef _WIN32
if (SetFilePointer(hFile.get(), -static_cast<int>(sizeof(TGA_FOOTER)), nullptr, FILE_END) != INVALID_SET_FILE_POINTER)
{
if (!ReadFile(hFile.get(), &footer, sizeof(TGA_FOOTER), &bytesRead, nullptr))
@ -1452,7 +1452,7 @@ HRESULT DirectX::GetMetadataFromTGAFile(const wchar_t* szFile, TGA_FLAGS flags,
if (footer.dwExtensionOffset != 0
&& ((footer.dwExtensionOffset + sizeof(TGA_EXTENSION)) <= len))
{
#ifdef WIN32
#ifdef _WIN32
const LARGE_INTEGER filePos = { { static_cast<DWORD>(footer.dwExtensionOffset), 0 } };
if (SetFilePointerEx(hFile.get(), filePos, nullptr, FILE_BEGIN))
{
@ -1592,7 +1592,7 @@ HRESULT DirectX::LoadFromTGAFile(
image.Release();
#ifdef WIN32
#ifdef _WIN32
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
ScopedHandle hFile(safe_handle(CreateFile2(szFile, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, nullptr)));
#else
@ -1646,7 +1646,7 @@ HRESULT DirectX::LoadFromTGAFile(
// Read the header
uint8_t header[sizeof(TGA_HEADER)] = {};
#ifdef WIN32
#ifdef _WIN32
DWORD bytesRead = 0;
if (!ReadFile(hFile.get(), header, sizeof(TGA_HEADER), &bytesRead, nullptr))
{
@ -1676,7 +1676,7 @@ HRESULT DirectX::LoadFromTGAFile(
if (offset > sizeof(TGA_HEADER))
{
#ifdef WIN32
#ifdef _WIN32
// Skip past the id string
const LARGE_INTEGER filePos = { { static_cast<DWORD>(offset), 0 } };
if (!SetFilePointerEx(hFile.get(), filePos, nullptr, FILE_BEGIN))
@ -1713,7 +1713,7 @@ HRESULT DirectX::LoadFromTGAFile(
return HRESULT_E_ARITHMETIC_OVERFLOW;
}
#ifdef WIN32
#ifdef _WIN32
if (!ReadFile(hFile.get(), image.GetPixels(), static_cast<DWORD>(image.GetPixelsSize()), &bytesRead, nullptr))
{
image.Release();
@ -1932,7 +1932,7 @@ HRESULT DirectX::LoadFromTGAFile(
return E_OUTOFMEMORY;
}
#ifdef WIN32
#ifdef _WIN32
if (!ReadFile(hFile.get(), temp.get(), static_cast<DWORD>(remaining), &bytesRead, nullptr))
{
image.Release();
@ -1978,7 +1978,7 @@ HRESULT DirectX::LoadFromTGAFile(
{
TGA_FOOTER footer = {};
#ifdef WIN32
#ifdef _WIN32
if (SetFilePointer(hFile.get(), -static_cast<int>(sizeof(TGA_FOOTER)), nullptr, FILE_END) != INVALID_SET_FILE_POINTER)
{
if (!ReadFile(hFile.get(), &footer, sizeof(TGA_FOOTER), &bytesRead, nullptr))
@ -2011,7 +2011,7 @@ HRESULT DirectX::LoadFromTGAFile(
if (footer.dwExtensionOffset != 0
&& ((footer.dwExtensionOffset + sizeof(TGA_EXTENSION)) <= len))
{
#ifdef WIN32
#ifdef _WIN32
const LARGE_INTEGER filePos = { { static_cast<DWORD>(footer.dwExtensionOffset), 0 } };
if (SetFilePointerEx(hFile.get(), filePos, nullptr, FILE_BEGIN))
{
@ -2174,7 +2174,7 @@ HRESULT DirectX::SaveToTGAFile(
return hr;
// Create file and write header
#ifdef WIN32
#ifdef _WIN32
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
ScopedHandle hFile(safe_handle(CreateFile2(szFile, GENERIC_WRITE, 0,
CREATE_ALWAYS, nullptr)));
@ -2211,7 +2211,7 @@ HRESULT DirectX::SaveToTGAFile(
return hr;
// Write blob
#ifdef WIN32
#ifdef _WIN32
const DWORD bytesToWrite = static_cast<DWORD>(blob.GetBufferSize());
DWORD bytesWritten;
if (!WriteFile(hFile.get(), blob.GetBufferPointer(), bytesToWrite, &bytesWritten, nullptr))
@ -2239,7 +2239,7 @@ HRESULT DirectX::SaveToTGAFile(
return E_OUTOFMEMORY;
// Write header
#ifdef WIN32
#ifdef _WIN32
DWORD bytesWritten;
if (!WriteFile(hFile.get(), &tga_header, sizeof(TGA_HEADER), &bytesWritten, nullptr))
{
@ -2278,7 +2278,7 @@ HRESULT DirectX::SaveToTGAFile(
pPixels += image.rowPitch;
#ifdef WIN32
#ifdef _WIN32
if (!WriteFile(hFile.get(), temp.get(), static_cast<DWORD>(rowPitch), &bytesWritten, nullptr))
{
return HRESULT_FROM_WIN32(GetLastError());
@ -2300,7 +2300,7 @@ HRESULT DirectX::SaveToTGAFile(
TGA_EXTENSION ext = {};
SetExtension(&ext, flags, *metadata);
#ifdef WIN32
#ifdef _WIN32
extOffset = SetFilePointer(hFile.get(), 0, nullptr, FILE_CURRENT);
if (extOffset == INVALID_SET_FILE_POINTER)
{
@ -2330,7 +2330,7 @@ HRESULT DirectX::SaveToTGAFile(
footer.dwExtensionOffset = extOffset;
memcpy(footer.Signature, g_Signature, sizeof(g_Signature));
#ifdef WIN32
#ifdef _WIN32
if (!WriteFile(hFile.get(), &footer, sizeof(TGA_FOOTER), &bytesWritten, nullptr))
{
return HRESULT_FROM_WIN32(GetLastError());
@ -2345,7 +2345,7 @@ HRESULT DirectX::SaveToTGAFile(
#endif
}
#ifdef WIN32
#ifdef _WIN32
delonfail.clear();
#endif

View File

@ -32,7 +32,7 @@ using Microsoft::WRL::ComPtr;
namespace
{
#ifdef WIN32
#ifdef _WIN32
//-------------------------------------------------------------------------------------
// WIC Pixel Format Translation Data
//-------------------------------------------------------------------------------------
@ -127,7 +127,7 @@ namespace
}
#ifdef WIN32
#ifdef _WIN32
//=====================================================================================
// WIC Utilities
//=====================================================================================

View File

@ -15,7 +15,7 @@
#include <memory>
#include <tuple>
#ifndef WIN32
#ifndef _WIN32
#include <cstdlib>
struct aligned_deleter { void operator()(void* p) noexcept { free(p); } };

View File

@ -19,7 +19,7 @@
#include <d3d11_1.h>
#ifdef NTDDI_WIN10_FE
#if defined(NTDDI_WIN10_FE) || defined(__MINGW32__)
#include <ocidl.h>
#else
#include <OCIdl.h>

View File

@ -31,7 +31,7 @@
#include <new>
#include <tuple>
#ifdef WIN32
#ifdef _WIN32
#include <wincodec.h>
#include <wrl\client.h>
#else
@ -61,10 +61,10 @@
#define D3DX12_NO_STATE_OBJECT_HELPERS
#define D3DX12_NO_CHECK_FEATURE_SUPPORT_CLASS
#ifdef WIN32
#include "d3dx12.h"
#else
#if !defined(_WIN32) || defined(USING_DIRECTX_HEADERS)
#include "directx/d3dx12.h"
#else
#include "d3dx12.h"
#endif
using Microsoft::WRL::ComPtr;
@ -230,7 +230,7 @@ namespace
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','1','0'), 0, 0, 0, 0, 0 };
//-----------------------------------------------------------------------------
#ifdef WIN32
#ifdef _WIN32
struct handle_closer { void operator()(HANDLE h) noexcept { if (h) CloseHandle(h); } };
using ScopedHandle = std::unique_ptr<void, handle_closer>;
@ -842,7 +842,7 @@ namespace
// Block until the copy is complete
while (fence->GetCompletedValue() < 1)
{
#ifdef WIN32
#ifdef _WIN32
SwitchToThread();
#else
std::this_thread::yield();
@ -852,7 +852,7 @@ namespace
return S_OK;
}
#ifdef WIN32
#ifdef _WIN32
BOOL WINAPI InitializeWICFactory(PINIT_ONCE, PVOID, PVOID* ifactory) noexcept
{
return SUCCEEDED(CoCreateInstance(
@ -929,7 +929,7 @@ HRESULT DirectX::SaveDDSTextureToFile(
return hr;
// Create file
#ifdef WIN32
#ifdef _WIN32
ScopedHandle hFile(safe_handle(CreateFile2(fileName, GENERIC_WRITE, 0, CREATE_ALWAYS, nullptr)));
if (!hFile)
return HRESULT_FROM_WIN32(GetLastError());
@ -1070,7 +1070,7 @@ HRESULT DirectX::SaveDDSTextureToFile(
pStaging->Unmap(0, &writeRange);
// Write header & pixels
#ifdef WIN32
#ifdef _WIN32
DWORD bytesWritten;
if (!WriteFile(hFile.get(), fileHeader, static_cast<DWORD>(headerSize), &bytesWritten, nullptr))
return HRESULT_FROM_WIN32(GetLastError());
@ -1101,7 +1101,7 @@ HRESULT DirectX::SaveDDSTextureToFile(
}
//--------------------------------------------------------------------------------------
#ifdef WIN32
#ifdef _WIN32
_Use_decl_annotations_
HRESULT DirectX::SaveWICTextureToFile(
ID3D12CommandQueue* pCommandQ,

View File

@ -17,20 +17,31 @@
#pragma once
#ifdef WIN32
#include <d3d12.h>
#ifdef __MINGW32__
#include <unknwn.h>
#endif
#ifdef NTDDI_WIN10_FE
#ifndef _WIN32
#include <wsl/winadapter.h>
#include <wsl/wrladapter.h>
#endif
#if !defined(_WIN32) || defined(USING_DIRECTX_HEADERS)
#include <directx/d3d12.h>
#include <dxguids/dxguids.h>
#else
#include <d3d12.h>
#pragma comment(lib,"dxguid.lib")
#endif
#ifdef _WIN32
#if defined(NTDDI_WIN10_FE) || defined(__MINGW32__)
#include <ocidl.h>
#else
#include <OCIdl.h>
#endif
#include <functional>
#else
#include <wsl/winadapter.h>
#include <wsl/wrladapter.h>
#include <directx/d3d12.h>
#endif
@ -43,7 +54,7 @@ namespace DirectX
D3D12_RESOURCE_STATES beforeState = D3D12_RESOURCE_STATE_RENDER_TARGET,
D3D12_RESOURCE_STATES afterState = D3D12_RESOURCE_STATE_RENDER_TARGET) noexcept;
#ifdef WIN32
#ifdef _WIN32
HRESULT __cdecl SaveWICTextureToFile(
_In_ ID3D12CommandQueue* pCommandQ,
_In_ ID3D12Resource* pSource,

View File

@ -23,7 +23,7 @@
#include <d3d9.h>
#ifdef NTDDI_WIN10_FE
#if defined(NTDDI_WIN10_FE) || defined(__MINGW32__)
#include <ocidl.h>
#else
#include <OCIdl.h>

View File

@ -64,16 +64,18 @@ using Microsoft::WRL::ComPtr;
namespace
{
//--------------------------------------------------------------------------------------
#if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) )
template<UINT TNameLength>
inline void SetDebugObjectName(_In_ ID3D11DeviceChild* resource, _In_ const char(&name)[TNameLength]) noexcept
{
#if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) )
resource->SetPrivateData(WKPDID_D3DDebugObjectName, TNameLength - 1, name);
#else
UNREFERENCED_PARAMETER(resource);
UNREFERENCED_PARAMETER(name);
#endif
}
#else
template<UINT TNameLength>
inline void SetDebugObjectName(_In_ ID3D11DeviceChild*, _In_ const char(&)[TNameLength]) noexcept
{
}
#endif
//-------------------------------------------------------------------------------------
// WIC Pixel Format Translation Data

View File

@ -57,7 +57,11 @@
#define D3DX12_NO_STATE_OBJECT_HELPERS
#define D3DX12_NO_CHECK_FEATURE_SUPPORT_CLASS
#ifdef USING_DIRECTX_HEADERS
#include "directx/d3dx12.h"
#else
#include "d3dx12.h"
#endif
using namespace DirectX;
using Microsoft::WRL::ComPtr;
@ -197,16 +201,18 @@ namespace
}
//---------------------------------------------------------------------------------
#if !defined(NO_D3D12_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) )
template<UINT TNameLength>
inline void SetDebugObjectName(_In_ ID3D12DeviceChild* resource, _In_z_ const wchar_t(&name)[TNameLength]) noexcept
{
#if !defined(NO_D3D12_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) )
resource->SetName(name);
#else
UNREFERENCED_PARAMETER(resource);
UNREFERENCED_PARAMETER(name);
#endif
}
#else
template<UINT TNameLength>
inline void SetDebugObjectName(_In_ ID3D12DeviceChild*, _In_z_ const wchar_t(&)[TNameLength]) noexcept
{
}
#endif
inline uint32_t CountMips(uint32_t width, uint32_t height) noexcept
{

View File

@ -20,9 +20,22 @@
#pragma once
#include <d3d12.h>
#ifndef _WIN32
#error This module only supports Windows
#endif
#ifdef __MINGW32__
#include <unknwn.h>
#endif
#ifdef USING_DIRECTX_HEADERS
#include <directx/d3d12.h>
#include <dxguids/dxguids.h>
#else
#include <d3d12.h>
#pragma comment(lib,"dxguid.lib")
#endif
#pragma comment(lib,"windowscodecs.lib")
#include <cstddef>