mirror of
https://github.com/microsoft/DirectXTex
synced 2024-11-08 14:00:05 +00:00
Workaround clang/LLVM bug with /fp:fast+SSE+float_control (#449)
This commit is contained in:
parent
95796ba57e
commit
819c5b78f7
@ -563,7 +563,7 @@ endif()
|
||||
|
||||
if(MSVC)
|
||||
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
||||
target_compile_options(${t} PRIVATE /Wall /GR- /fp:fast "$<$<NOT:$<CONFIG:DEBUG>>:/guard:cf>")
|
||||
target_compile_options(${t} PRIVATE /Wall /GR- "$<$<NOT:$<CONFIG:DEBUG>>:/guard:cf>")
|
||||
target_link_options(${t} PRIVATE /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO)
|
||||
endforeach()
|
||||
|
||||
@ -649,7 +649,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
endif()
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE ${WarningsLib})
|
||||
|
||||
set(WarningsEXE ${WarningsLib} "-Wno-c++98-compat" "-Wno-c++98-compat-pedantic" "-Wno-switch" "-Wno-switch-enum" "-Wno-covered-switch-default" "-Wno-language-extension-token" "-Wno-missing-prototypes" "-Wno-global-constructors" "-Wno-double-promotion")
|
||||
set(WarningsEXE ${WarningsLib} "-Wno-c++98-compat" "-Wno-c++98-compat-pedantic" "-Wno-switch" "-Wno-switch-enum" "-Wno-switch-default" "-Wno-covered-switch-default" "-Wno-language-extension-token" "-Wno-missing-prototypes" "-Wno-global-constructors" "-Wno-double-promotion")
|
||||
foreach(t IN LISTS TOOL_EXES)
|
||||
target_compile_options(${t} PRIVATE ${WarningsEXE})
|
||||
endforeach()
|
||||
@ -659,7 +659,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
endforeach()
|
||||
elseif(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 /Zc:inline)
|
||||
target_compile_options(${t} PRIVATE /sdl /permissive- /JMC- /Zc:__cplusplus /Zc:inline /fp:fast)
|
||||
endforeach()
|
||||
|
||||
if(ENABLE_CODE_ANALYSIS)
|
||||
|
@ -746,6 +746,9 @@ namespace
|
||||
|
||||
// No 3:3:2 or paletted DXGI formats aka D3DFMT_R3G3B2, D3DFMT_P8
|
||||
break;
|
||||
|
||||
default:
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
}
|
||||
else if (ddpf.flags & DDS_LUMINANCE)
|
||||
@ -776,6 +779,9 @@ namespace
|
||||
return DXGI_FORMAT_R8G8_UNORM; // Some DDS writers assume the bitcount should be 8 instead of 16
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
}
|
||||
else if (ddpf.flags & DDS_ALPHA)
|
||||
@ -808,6 +814,9 @@ namespace
|
||||
return DXGI_FORMAT_R8G8_SNORM; // D3DX10/11 writes this out as DX10 extension
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
|
||||
// No DXGI format maps to DDPF_BUMPLUMINANCE aka D3DFMT_L6V5U5, D3DFMT_X8L8V8U8
|
||||
@ -908,6 +917,9 @@ namespace
|
||||
return DXGI_FORMAT_R32G32B32A32_FLOAT;
|
||||
|
||||
// No DXGI format maps to D3DFMT_CxV8U8
|
||||
|
||||
default:
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1312,6 +1324,9 @@ namespace
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
return hr;
|
||||
|
@ -830,6 +830,9 @@ namespace
|
||||
|
||||
// No 3:3:2 or paletted DXGI formats aka D3DFMT_R3G3B2, D3DFMT_P8
|
||||
break;
|
||||
|
||||
default:
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
}
|
||||
else if (ddpf.flags & DDS_LUMINANCE)
|
||||
@ -860,6 +863,9 @@ namespace
|
||||
return DXGI_FORMAT_R8G8_UNORM; // Some DDS writers assume the bitcount should be 8 instead of 16
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
}
|
||||
else if (ddpf.flags & DDS_ALPHA)
|
||||
@ -892,6 +898,9 @@ namespace
|
||||
return DXGI_FORMAT_R8G8_SNORM; // D3DX10/11 writes this out as DX10 extension
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
|
||||
// No DXGI format maps to DDPF_BUMPLUMINANCE aka D3DFMT_L6V5U5, D3DFMT_X8L8V8U8
|
||||
@ -992,6 +1001,9 @@ namespace
|
||||
return DXGI_FORMAT_R32G32B32A32_FLOAT;
|
||||
|
||||
// No DXGI format maps to D3DFMT_CxV8U8
|
||||
|
||||
default:
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1127,6 +1139,9 @@ namespace
|
||||
res.SlicePitch = res.RowPitch * static_cast<LONG>(height);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -620,6 +620,9 @@ namespace
|
||||
|
||||
// Paletted texture formats are typically not supported on modern video cards aka D3DFMT_P8, D3DFMT_A8P8
|
||||
break;
|
||||
|
||||
default:
|
||||
return D3DFMT_UNKNOWN;
|
||||
}
|
||||
}
|
||||
else if (ddpf.flags & DDS_LUMINANCE)
|
||||
@ -651,6 +654,9 @@ namespace
|
||||
return D3DFMT_A8L8; // Some DDS writers assume the bitcount should be 8 instead of 16
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return D3DFMT_UNKNOWN;
|
||||
}
|
||||
}
|
||||
else if (ddpf.flags & DDS_ALPHA)
|
||||
@ -685,6 +691,9 @@ namespace
|
||||
return D3DFMT_V8U8;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return D3DFMT_UNKNOWN;
|
||||
}
|
||||
}
|
||||
else if (ddpf.flags & DDS_BUMPLUMINANCE)
|
||||
@ -704,6 +713,9 @@ namespace
|
||||
return D3DFMT_L6V5U5;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return D3DFMT_UNKNOWN;
|
||||
}
|
||||
}
|
||||
else if (ddpf.flags & DDS_FOURCC)
|
||||
@ -760,6 +772,9 @@ namespace
|
||||
case D3DFMT_A32B32G32R32F:
|
||||
case D3DFMT_CxV8U8:
|
||||
return static_cast<D3DFORMAT>(ddpf.fourCC);
|
||||
|
||||
default:
|
||||
return D3DFMT_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1800,6 +1800,7 @@ void D3DX_BC6H::Decode(bool bSigned, HDRColorA* pOut) const noexcept
|
||||
case 0x17: warnstr = "BC6H: Reserved mode 10111 encountered during decoding\n"; break;
|
||||
case 0x1B: warnstr = "BC6H: Reserved mode 11011 encountered during decoding\n"; break;
|
||||
case 0x1F: warnstr = "BC6H: Reserved mode 11111 encountered during decoding\n"; break;
|
||||
default: break;
|
||||
}
|
||||
OutputDebugStringA(warnstr);
|
||||
#endif
|
||||
@ -2762,6 +2763,7 @@ void D3DX_BC7::Decode(HDRColorA* pOut) const noexcept
|
||||
case 1: std::swap(outPixel.r, outPixel.a); break;
|
||||
case 2: std::swap(outPixel.g, outPixel.a); break;
|
||||
case 3: std::swap(outPixel.b, outPixel.a); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
pOut[i] = HDRColorA(outPixel);
|
||||
@ -2837,6 +2839,7 @@ void D3DX_BC7::Encode(uint32_t flags, const HDRColorA* const pIn) noexcept
|
||||
case 1: for (size_t i = 0; i < NUM_PIXELS_PER_BLOCK; i++) std::swap(EP.aLDRPixels[i].r, EP.aLDRPixels[i].a); break;
|
||||
case 2: for (size_t i = 0; i < NUM_PIXELS_PER_BLOCK; i++) std::swap(EP.aLDRPixels[i].g, EP.aLDRPixels[i].a); break;
|
||||
case 3: for (size_t i = 0; i < NUM_PIXELS_PER_BLOCK; i++) std::swap(EP.aLDRPixels[i].b, EP.aLDRPixels[i].a); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
for (size_t im = 0; im < uNumIdxMode && fMSEBest > 0; ++im)
|
||||
@ -2877,6 +2880,7 @@ void D3DX_BC7::Encode(uint32_t flags, const HDRColorA* const pIn) noexcept
|
||||
case 1: for (size_t i = 0; i < NUM_PIXELS_PER_BLOCK; i++) std::swap(EP.aLDRPixels[i].r, EP.aLDRPixels[i].a); break;
|
||||
case 2: for (size_t i = 0; i < NUM_PIXELS_PER_BLOCK; i++) std::swap(EP.aLDRPixels[i].g, EP.aLDRPixels[i].a); break;
|
||||
case 3: for (size_t i = 0; i < NUM_PIXELS_PER_BLOCK; i++) std::swap(EP.aLDRPixels[i].b, EP.aLDRPixels[i].a); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -415,6 +415,9 @@ void DirectX::Internal::CopyScanline(
|
||||
case DXGI_FORMAT_A8_UNORM:
|
||||
memset(pDestination, 0xff, outSize);
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -586,6 +589,9 @@ void DirectX::Internal::SwizzleScanline(
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Fall-through case is to just use memcpy (assuming this is not an in-place operation)
|
||||
|
@ -653,6 +653,9 @@ HRESULT DirectX::CreateTextureEx(
|
||||
hr = pDevice->CreateTexture3D(&desc, initData.get(), reinterpret_cast<ID3D11Texture3D**>(ppResource));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return HRESULT_E_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
return hr;
|
||||
|
@ -88,6 +88,9 @@ namespace
|
||||
res.SlicePitch = res.RowPitch * static_cast<PT>(height);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1344,6 +1344,7 @@ namespace
|
||||
|
||||
switch (metadata.GetAlphaMode())
|
||||
{
|
||||
default:
|
||||
case TEX_ALPHA_MODE_UNKNOWN:
|
||||
ext->bAttributesType = HasAlpha(metadata.format) ? TGA_ATTRIBUTE_UNDEFINED : TGA_ATTRIBUTE_NONE;
|
||||
break;
|
||||
@ -1399,6 +1400,7 @@ namespace
|
||||
case TGA_ATTRIBUTE_UNDEFINED: return TEX_ALPHA_MODE_CUSTOM;
|
||||
case TGA_ATTRIBUTE_ALPHA: return TEX_ALPHA_MODE_STRAIGHT;
|
||||
case TGA_ATTRIBUTE_PREMULTIPLIED: return TEX_ALPHA_MODE_PREMULTIPLIED;
|
||||
default: return TEX_ALPHA_MODE_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -761,7 +761,7 @@ struct CD3DX12_HEAP_PROPERTIES : public D3D12_HEAP_PROPERTIES
|
||||
bool IsCPUAccessible() const noexcept
|
||||
{
|
||||
return Type == D3D12_HEAP_TYPE_UPLOAD || Type == D3D12_HEAP_TYPE_READBACK
|
||||
#if 0
|
||||
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609)
|
||||
|| Type == D3D12_HEAP_TYPE_GPU_UPLOAD
|
||||
#endif
|
||||
|| (Type == D3D12_HEAP_TYPE_CUSTOM &&
|
||||
@ -1539,7 +1539,6 @@ struct CD3DX12_STATIC_SAMPLER_DESC : public D3D12_STATIC_SAMPLER_DESC
|
||||
shaderVisibility,
|
||||
registerSpace);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
@ -2029,6 +2028,7 @@ struct CD3DX12_VERSIONED_ROOT_SIGNATURE_DESC : public D3D12_VERSIONED_ROOT_SIGNA
|
||||
desc.Desc_1_1.pStaticSamplers = _pStaticSamplers;
|
||||
desc.Desc_1_1.Flags = flags;
|
||||
}
|
||||
|
||||
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609)
|
||||
static inline void Init_1_2(
|
||||
_Out_ D3D12_VERSIONED_ROOT_SIGNATURE_DESC& desc,
|
||||
@ -2845,6 +2845,11 @@ inline ID3D12CommandList * const * CommandListCast(t_CommandListType * const * p
|
||||
// To help enable root signature 1.1 features when they are available and not require maintaining
|
||||
// two code paths for building root signatures, this helper method reconstructs a 1.0 signature when
|
||||
// 1.1 is not supported.
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wcovered-switch-default"
|
||||
#endif
|
||||
|
||||
inline HRESULT D3DX12SerializeVersionedRootSignature(
|
||||
_In_ const D3D12_VERSIONED_ROOT_SIGNATURE_DESC* pRootSignatureDesc,
|
||||
D3D_ROOT_SIGNATURE_VERSION MaxVersion,
|
||||
@ -2904,39 +2909,72 @@ inline HRESULT D3DX12SerializeVersionedRootSignature(
|
||||
break;
|
||||
|
||||
case D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE:
|
||||
const D3D12_ROOT_DESCRIPTOR_TABLE1& table_1_1 = desc_1_1.pParameters[n].DescriptorTable;
|
||||
|
||||
const SIZE_T DescriptorRangesSize = sizeof(D3D12_DESCRIPTOR_RANGE) * table_1_1.NumDescriptorRanges;
|
||||
void* pDescriptorRanges = (DescriptorRangesSize > 0 && SUCCEEDED(hr)) ? HeapAlloc(GetProcessHeap(), 0, DescriptorRangesSize) : nullptr;
|
||||
if (DescriptorRangesSize > 0 && pDescriptorRanges == nullptr)
|
||||
{
|
||||
hr = E_OUTOFMEMORY;
|
||||
}
|
||||
auto pDescriptorRanges_1_0 = static_cast<D3D12_DESCRIPTOR_RANGE*>(pDescriptorRanges);
|
||||
const D3D12_ROOT_DESCRIPTOR_TABLE1& table_1_1 = desc_1_1.pParameters[n].DescriptorTable;
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
for (UINT x = 0; x < table_1_1.NumDescriptorRanges; x++)
|
||||
const SIZE_T DescriptorRangesSize = sizeof(D3D12_DESCRIPTOR_RANGE) * table_1_1.NumDescriptorRanges;
|
||||
void* pDescriptorRanges = (DescriptorRangesSize > 0 && SUCCEEDED(hr)) ? HeapAlloc(GetProcessHeap(), 0, DescriptorRangesSize) : nullptr;
|
||||
if (DescriptorRangesSize > 0 && pDescriptorRanges == nullptr)
|
||||
{
|
||||
__analysis_assume(DescriptorRangesSize == sizeof(D3D12_DESCRIPTOR_RANGE) * table_1_1.NumDescriptorRanges);
|
||||
pDescriptorRanges_1_0[x].BaseShaderRegister = table_1_1.pDescriptorRanges[x].BaseShaderRegister;
|
||||
pDescriptorRanges_1_0[x].NumDescriptors = table_1_1.pDescriptorRanges[x].NumDescriptors;
|
||||
pDescriptorRanges_1_0[x].OffsetInDescriptorsFromTableStart = table_1_1.pDescriptorRanges[x].OffsetInDescriptorsFromTableStart;
|
||||
pDescriptorRanges_1_0[x].RangeType = table_1_1.pDescriptorRanges[x].RangeType;
|
||||
pDescriptorRanges_1_0[x].RegisterSpace = table_1_1.pDescriptorRanges[x].RegisterSpace;
|
||||
hr = E_OUTOFMEMORY;
|
||||
}
|
||||
}
|
||||
auto pDescriptorRanges_1_0 = static_cast<D3D12_DESCRIPTOR_RANGE*>(pDescriptorRanges);
|
||||
|
||||
D3D12_ROOT_DESCRIPTOR_TABLE& table_1_0 = pParameters_1_0[n].DescriptorTable;
|
||||
table_1_0.NumDescriptorRanges = table_1_1.NumDescriptorRanges;
|
||||
table_1_0.pDescriptorRanges = pDescriptorRanges_1_0;
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
for (UINT x = 0; x < table_1_1.NumDescriptorRanges; x++)
|
||||
{
|
||||
__analysis_assume(DescriptorRangesSize == sizeof(D3D12_DESCRIPTOR_RANGE) * table_1_1.NumDescriptorRanges);
|
||||
pDescriptorRanges_1_0[x].BaseShaderRegister = table_1_1.pDescriptorRanges[x].BaseShaderRegister;
|
||||
pDescriptorRanges_1_0[x].NumDescriptors = table_1_1.pDescriptorRanges[x].NumDescriptors;
|
||||
pDescriptorRanges_1_0[x].OffsetInDescriptorsFromTableStart = table_1_1.pDescriptorRanges[x].OffsetInDescriptorsFromTableStart;
|
||||
pDescriptorRanges_1_0[x].RangeType = table_1_1.pDescriptorRanges[x].RangeType;
|
||||
pDescriptorRanges_1_0[x].RegisterSpace = table_1_1.pDescriptorRanges[x].RegisterSpace;
|
||||
}
|
||||
}
|
||||
|
||||
D3D12_ROOT_DESCRIPTOR_TABLE& table_1_0 = pParameters_1_0[n].DescriptorTable;
|
||||
table_1_0.NumDescriptorRanges = table_1_1.NumDescriptorRanges;
|
||||
table_1_0.pDescriptorRanges = pDescriptorRanges_1_0;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
D3D12_STATIC_SAMPLER_DESC* pStaticSamplers = nullptr;
|
||||
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609)
|
||||
if (desc_1_1.NumStaticSamplers > 0 && pRootSignatureDesc->Version == D3D_ROOT_SIGNATURE_VERSION_1_2)
|
||||
{
|
||||
const SIZE_T SamplersSize = sizeof(D3D12_STATIC_SAMPLER_DESC) * desc_1_1.NumStaticSamplers;
|
||||
pStaticSamplers = static_cast<D3D12_STATIC_SAMPLER_DESC*>(HeapAlloc(GetProcessHeap(), 0, SamplersSize));
|
||||
|
||||
if (pStaticSamplers == nullptr)
|
||||
{
|
||||
hr = E_OUTOFMEMORY;
|
||||
}
|
||||
else
|
||||
{
|
||||
const D3D12_ROOT_SIGNATURE_DESC2& desc_1_2 = pRootSignatureDesc->Desc_1_2;
|
||||
for (UINT n = 0; n < desc_1_1.NumStaticSamplers; ++n)
|
||||
{
|
||||
if ((desc_1_2.pStaticSamplers[n].Flags & ~D3D12_SAMPLER_FLAG_UINT_BORDER_COLOR) != 0)
|
||||
{
|
||||
hr = E_INVALIDARG;
|
||||
break;
|
||||
}
|
||||
memcpy(pStaticSamplers + n, desc_1_2.pStaticSamplers + n, sizeof(D3D12_STATIC_SAMPLER_DESC));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
const CD3DX12_ROOT_SIGNATURE_DESC desc_1_0(desc_1_1.NumParameters, pParameters_1_0, desc_1_1.NumStaticSamplers, desc_1_1.pStaticSamplers, desc_1_1.Flags);
|
||||
const CD3DX12_ROOT_SIGNATURE_DESC desc_1_0(desc_1_1.NumParameters, pParameters_1_0, desc_1_1.NumStaticSamplers, pStaticSamplers == nullptr ? desc_1_1.pStaticSamplers : pStaticSamplers, desc_1_1.Flags);
|
||||
hr = D3D12SerializeRootSignature(&desc_1_0, D3D_ROOT_SIGNATURE_VERSION_1, ppBlob, ppErrorBlob);
|
||||
}
|
||||
|
||||
@ -2952,21 +2990,92 @@ inline HRESULT D3DX12SerializeVersionedRootSignature(
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, pParameters);
|
||||
}
|
||||
|
||||
if (pStaticSamplers)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, pStaticSamplers);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case D3D_ROOT_SIGNATURE_VERSION_1_1:
|
||||
switch (pRootSignatureDesc->Version)
|
||||
{
|
||||
case D3D_ROOT_SIGNATURE_VERSION_1_0:
|
||||
case D3D_ROOT_SIGNATURE_VERSION_1_1:
|
||||
return D3D12SerializeVersionedRootSignature(pRootSignatureDesc, ppBlob, ppErrorBlob);
|
||||
|
||||
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609)
|
||||
case D3D_ROOT_SIGNATURE_VERSION_1_2:
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
const D3D12_ROOT_SIGNATURE_DESC1& desc_1_1 = pRootSignatureDesc->Desc_1_1;
|
||||
|
||||
D3D12_STATIC_SAMPLER_DESC* pStaticSamplers = nullptr;
|
||||
if (desc_1_1.NumStaticSamplers > 0)
|
||||
{
|
||||
const SIZE_T SamplersSize = sizeof(D3D12_STATIC_SAMPLER_DESC) * desc_1_1.NumStaticSamplers;
|
||||
pStaticSamplers = static_cast<D3D12_STATIC_SAMPLER_DESC*>(HeapAlloc(GetProcessHeap(), 0, SamplersSize));
|
||||
|
||||
if (pStaticSamplers == nullptr)
|
||||
{
|
||||
hr = E_OUTOFMEMORY;
|
||||
}
|
||||
else
|
||||
{
|
||||
const D3D12_ROOT_SIGNATURE_DESC2& desc_1_2 = pRootSignatureDesc->Desc_1_2;
|
||||
for (UINT n = 0; n < desc_1_1.NumStaticSamplers; ++n)
|
||||
{
|
||||
if ((desc_1_2.pStaticSamplers[n].Flags & ~D3D12_SAMPLER_FLAG_UINT_BORDER_COLOR) != 0)
|
||||
{
|
||||
hr = E_INVALIDARG;
|
||||
break;
|
||||
}
|
||||
memcpy(pStaticSamplers + n, desc_1_2.pStaticSamplers + n, sizeof(D3D12_STATIC_SAMPLER_DESC));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
const CD3DX12_VERSIONED_ROOT_SIGNATURE_DESC desc(desc_1_1.NumParameters, desc_1_1.pParameters, desc_1_1.NumStaticSamplers, pStaticSamplers == nullptr ? desc_1_1.pStaticSamplers : pStaticSamplers, desc_1_1.Flags);
|
||||
hr = D3D12SerializeVersionedRootSignature(&desc, ppBlob, ppErrorBlob);
|
||||
}
|
||||
|
||||
if (pStaticSamplers)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, pStaticSamplers);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
#endif
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609)
|
||||
case D3D_ROOT_SIGNATURE_VERSION_1_2:
|
||||
#endif
|
||||
default:
|
||||
return D3D12SerializeVersionedRootSignature(pRootSignatureDesc, ppBlob, ppErrorBlob);
|
||||
}
|
||||
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
struct CD3DX12_RT_FORMAT_ARRAY : public D3D12_RT_FORMAT_ARRAY
|
||||
{
|
||||
@ -2992,8 +3101,10 @@ struct CD3DX12_RT_FORMAT_ARRAY : public D3D12_RT_FORMAT_ARRAY
|
||||
struct DefaultSampleMask { operator UINT() noexcept { return UINT_MAX; } };
|
||||
struct DefaultSampleDesc { operator DXGI_SAMPLE_DESC() noexcept { return DXGI_SAMPLE_DESC{1, 0}; } };
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4324)
|
||||
#endif
|
||||
template <typename InnerStructType, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE Type, typename DefaultArg = InnerStructType>
|
||||
class alignas(void*) CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT
|
||||
{
|
||||
@ -3009,7 +3120,9 @@ public:
|
||||
InnerStructType* operator&() noexcept { return &pssInner; }
|
||||
InnerStructType const* operator&() const noexcept { return &pssInner; }
|
||||
};
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< D3D12_PIPELINE_STATE_FLAGS, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_FLAGS> CD3DX12_PIPELINE_STATE_STREAM_FLAGS;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< UINT, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_NODE_MASK> CD3DX12_PIPELINE_STATE_STREAM_NODE_MASK;
|
||||
typedef CD3DX12_PIPELINE_STATE_STREAM_SUBOBJECT< ID3D12RootSignature*, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_ROOT_SIGNATURE> CD3DX12_PIPELINE_STATE_STREAM_ROOT_SIGNATURE;
|
||||
@ -4411,6 +4524,7 @@ inline bool operator==( const D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wswitch"
|
||||
#pragma GCC diagnostic ignored "-Wswitch-default"
|
||||
#endif
|
||||
|
||||
inline bool operator==( const D3D12_RENDER_PASS_BEGINNING_ACCESS &a, const D3D12_RENDER_PASS_BEGINNING_ACCESS &b) noexcept
|
||||
@ -5580,9 +5694,7 @@ public: // Function declaration
|
||||
#endif
|
||||
|
||||
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609)
|
||||
#if 0
|
||||
BOOL GPUUploadHeapSupported() const noexcept;
|
||||
#endif
|
||||
|
||||
// D3D12_OPTIONS17
|
||||
BOOL NonNormalizedCoordinateSamplersSupported() const noexcept;
|
||||
@ -5604,6 +5716,10 @@ public: // Function declaration
|
||||
UINT MaxViewDescriptorHeapSize() const noexcept;
|
||||
#endif
|
||||
|
||||
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 611)
|
||||
BOOL ComputeOnlyWriteWatchSupported() const noexcept;
|
||||
#endif
|
||||
|
||||
private: // Private structs and helpers declaration
|
||||
struct ProtectedResourceSessionTypesLocal : D3D12_FEATURE_DATA_PROTECTED_RESOURCE_SESSION_TYPES
|
||||
{
|
||||
@ -5687,6 +5803,9 @@ private: // Member data
|
||||
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 610)
|
||||
D3D12_FEATURE_DATA_D3D12_OPTIONS19 m_dOptions19;
|
||||
#endif
|
||||
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 611)
|
||||
D3D12_FEATURE_DATA_D3D12_OPTIONS20 m_dOptions20;
|
||||
#endif
|
||||
};
|
||||
|
||||
// Implementations for CD3DX12FeatureSupport functions
|
||||
@ -5775,6 +5894,9 @@ inline CD3DX12FeatureSupport::CD3DX12FeatureSupport() noexcept
|
||||
#if defined (D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 610)
|
||||
, m_dOptions19{}
|
||||
#endif
|
||||
#if defined (D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 611)
|
||||
, m_dOptions20{}
|
||||
#endif
|
||||
{}
|
||||
|
||||
inline HRESULT CD3DX12FeatureSupport::Init(ID3D12Device* pDevice)
|
||||
@ -5936,6 +6058,13 @@ inline HRESULT CD3DX12FeatureSupport::Init(ID3D12Device* pDevice)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 611)
|
||||
if (FAILED(m_pDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS20, &m_dOptions20, sizeof(m_dOptions20))))
|
||||
{
|
||||
m_dOptions20 = {};
|
||||
}
|
||||
#endif
|
||||
|
||||
// Initialize per-node feature support data structures
|
||||
const UINT uNodeCount = m_pDevice->GetNodeCount();
|
||||
m_dProtectedResourceSessionSupport.resize(uNodeCount);
|
||||
@ -6281,9 +6410,7 @@ FEATURE_SUPPORT_GET(BOOL, m_dOptions15, DynamicIndexBufferStripCutSupported);
|
||||
FEATURE_SUPPORT_GET(BOOL, m_dOptions16, DynamicDepthBiasSupported);
|
||||
#endif
|
||||
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609)
|
||||
#if 0
|
||||
FEATURE_SUPPORT_GET(BOOL, m_dOptions16, GPUUploadHeapSupported);
|
||||
#endif
|
||||
|
||||
// 46: Options17
|
||||
FEATURE_SUPPORT_GET(BOOL, m_dOptions17, NonNormalizedCoordinateSamplersSupported);
|
||||
@ -6305,6 +6432,11 @@ FEATURE_SUPPORT_GET(UINT, m_dOptions19, MaxSamplerDescriptorHeapSizeWithStaticSa
|
||||
FEATURE_SUPPORT_GET(UINT, m_dOptions19, MaxViewDescriptorHeapSize);
|
||||
#endif
|
||||
|
||||
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 611)
|
||||
// 49: Options20
|
||||
FEATURE_SUPPORT_GET(BOOL, m_dOptions20, ComputeOnlyWriteWatchSupported);
|
||||
#endif
|
||||
|
||||
// Helper function to decide the highest shader model supported by the system
|
||||
// Stores the result in m_dShaderModel
|
||||
// Must be updated whenever a new shader model is added to the d3d12.h header
|
||||
@ -6411,7 +6543,12 @@ inline HRESULT CD3DX12FeatureSupport::QueryHighestFeatureLevel()
|
||||
D3D_FEATURE_LEVEL_9_3,
|
||||
D3D_FEATURE_LEVEL_9_2,
|
||||
D3D_FEATURE_LEVEL_9_1,
|
||||
D3D_FEATURE_LEVEL_1_0_CORE
|
||||
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 5)
|
||||
D3D_FEATURE_LEVEL_1_0_CORE,
|
||||
#endif
|
||||
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 611)
|
||||
D3D_FEATURE_LEVEL_1_0_GENERIC
|
||||
#endif
|
||||
};
|
||||
|
||||
D3D12_FEATURE_DATA_FEATURE_LEVELS dFeatureLevel;
|
||||
|
@ -343,6 +343,9 @@ HRESULT __cdecl LoadFromPortablePixMap(
|
||||
|
||||
mode = PPM_DATA_R - 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
mode++;
|
||||
|
Loading…
Reference in New Issue
Block a user