1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00

[d3d11] Fix CheckFeatureSupport formatting and return code

This commit is contained in:
Philip Rebohle 2019-09-22 15:00:26 +02:00
parent 252d71e55e
commit 92d1cf8ae0
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -1492,58 +1492,64 @@ namespace dxvk {
UINT FeatureSupportDataSize) { UINT FeatureSupportDataSize) {
switch (Feature) { switch (Feature) {
case D3D11_FEATURE_THREADING: { case D3D11_FEATURE_THREADING: {
if (FeatureSupportDataSize != sizeof(D3D11_FEATURE_DATA_THREADING)) auto info = static_cast<D3D11_FEATURE_DATA_THREADING*>(pFeatureSupportData);
if (FeatureSupportDataSize != sizeof(*info))
return E_INVALIDARG; return E_INVALIDARG;
// We report native support for command lists here so that we do not actually // We report native support for command lists here so that we do not actually
// have to re-implement the UpdateSubresource bug from the D3D11 runtime, see // have to re-implement the UpdateSubresource bug from the D3D11 runtime, see
// https://msdn.microsoft.com/en-us/library/windows/desktop/ff476486(v=vs.85).aspx) // https://msdn.microsoft.com/en-us/library/windows/desktop/ff476486(v=vs.85).aspx)
auto info = static_cast<D3D11_FEATURE_DATA_THREADING*>(pFeatureSupportData);
info->DriverConcurrentCreates = TRUE; info->DriverConcurrentCreates = TRUE;
info->DriverCommandLists = TRUE; info->DriverCommandLists = TRUE;
} return S_OK; } return S_OK;
case D3D11_FEATURE_DOUBLES: { case D3D11_FEATURE_DOUBLES: {
if (FeatureSupportDataSize != sizeof(D3D11_FEATURE_DATA_DOUBLES)) auto info = static_cast<D3D11_FEATURE_DATA_DOUBLES*>(pFeatureSupportData);
if (FeatureSupportDataSize != sizeof(*info))
return E_INVALIDARG; return E_INVALIDARG;
auto info = static_cast<D3D11_FEATURE_DATA_DOUBLES*>(pFeatureSupportData);
info->DoublePrecisionFloatShaderOps = m_dxvkDevice->features().core.features.shaderFloat64 info->DoublePrecisionFloatShaderOps = m_dxvkDevice->features().core.features.shaderFloat64
&& m_dxvkDevice->features().core.features.shaderInt64; && m_dxvkDevice->features().core.features.shaderInt64;
} return S_OK; } return S_OK;
case D3D11_FEATURE_FORMAT_SUPPORT: { case D3D11_FEATURE_FORMAT_SUPPORT: {
if (FeatureSupportDataSize != sizeof(D3D11_FEATURE_DATA_FORMAT_SUPPORT)) auto info = static_cast<D3D11_FEATURE_DATA_FORMAT_SUPPORT*>(pFeatureSupportData);
if (FeatureSupportDataSize != sizeof(*info))
return E_INVALIDARG; return E_INVALIDARG;
auto info = static_cast<D3D11_FEATURE_DATA_FORMAT_SUPPORT*>(pFeatureSupportData);
return GetFormatSupportFlags(info->InFormat, &info->OutFormatSupport, nullptr); return GetFormatSupportFlags(info->InFormat, &info->OutFormatSupport, nullptr);
} return S_OK; } return S_OK;
case D3D11_FEATURE_FORMAT_SUPPORT2: { case D3D11_FEATURE_FORMAT_SUPPORT2: {
if (FeatureSupportDataSize != sizeof(D3D11_FEATURE_DATA_FORMAT_SUPPORT2)) auto info = static_cast<D3D11_FEATURE_DATA_FORMAT_SUPPORT2*>(pFeatureSupportData);
if (FeatureSupportDataSize != sizeof(*info))
return E_INVALIDARG; return E_INVALIDARG;
auto info = static_cast<D3D11_FEATURE_DATA_FORMAT_SUPPORT2*>(pFeatureSupportData);
return GetFormatSupportFlags(info->InFormat, nullptr, &info->OutFormatSupport2); return GetFormatSupportFlags(info->InFormat, nullptr, &info->OutFormatSupport2);
} return S_OK; } return S_OK;
case D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS: { case D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS: {
if (FeatureSupportDataSize != sizeof(D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS)) auto info = static_cast<D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS*>(pFeatureSupportData);
if (FeatureSupportDataSize != sizeof(*info))
return E_INVALIDARG; return E_INVALIDARG;
auto info = static_cast<D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS*>(pFeatureSupportData);
info->ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x = TRUE; info->ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x = TRUE;
} return S_OK; } return S_OK;
case D3D11_FEATURE_D3D11_OPTIONS: { case D3D11_FEATURE_D3D11_OPTIONS: {
if (FeatureSupportDataSize != sizeof(D3D11_FEATURE_DATA_D3D11_OPTIONS)) auto info = static_cast<D3D11_FEATURE_DATA_D3D11_OPTIONS*>(pFeatureSupportData);
if (FeatureSupportDataSize != sizeof(*info))
return E_INVALIDARG; return E_INVALIDARG;
// https://msdn.microsoft.com/en-us/library/windows/desktop/hh404457(v=vs.85).aspx // https://msdn.microsoft.com/en-us/library/windows/desktop/hh404457(v=vs.85).aspx
const auto& features = m_dxvkDevice->features(); const auto& features = m_dxvkDevice->features();
auto info = static_cast<D3D11_FEATURE_DATA_D3D11_OPTIONS*>(pFeatureSupportData);
info->OutputMergerLogicOp = features.core.features.logicOp; info->OutputMergerLogicOp = features.core.features.logicOp;
info->UAVOnlyRenderingForcedSampleCount = features.core.features.variableMultisampleRate; info->UAVOnlyRenderingForcedSampleCount = features.core.features.variableMultisampleRate;
info->DiscardAPIsSeenByDriver = TRUE; info->DiscardAPIsSeenByDriver = TRUE;
@ -1561,46 +1567,51 @@ namespace dxvk {
} return S_OK; } return S_OK;
case D3D11_FEATURE_ARCHITECTURE_INFO: { case D3D11_FEATURE_ARCHITECTURE_INFO: {
if (FeatureSupportDataSize != sizeof(D3D11_FEATURE_DATA_ARCHITECTURE_INFO)) auto info = static_cast<D3D11_FEATURE_DATA_ARCHITECTURE_INFO*>(pFeatureSupportData);
if (FeatureSupportDataSize != sizeof(*info))
return E_INVALIDARG; return E_INVALIDARG;
auto info = static_cast<D3D11_FEATURE_DATA_ARCHITECTURE_INFO*>(pFeatureSupportData);
info->TileBasedDeferredRenderer = FALSE; info->TileBasedDeferredRenderer = FALSE;
} return S_OK; } return S_OK;
case D3D11_FEATURE_D3D9_OPTIONS: { case D3D11_FEATURE_D3D9_OPTIONS: {
if (FeatureSupportDataSize != sizeof(D3D11_FEATURE_DATA_D3D9_OPTIONS)) auto info = static_cast<D3D11_FEATURE_DATA_D3D9_OPTIONS*>(pFeatureSupportData);
if (FeatureSupportDataSize != sizeof(*info))
return E_INVALIDARG; return E_INVALIDARG;
auto info = static_cast<D3D11_FEATURE_DATA_D3D9_OPTIONS*>(pFeatureSupportData);
info->FullNonPow2TextureSupport = TRUE; info->FullNonPow2TextureSupport = TRUE;
} return S_OK; } return S_OK;
case D3D11_FEATURE_SHADER_MIN_PRECISION_SUPPORT: { case D3D11_FEATURE_SHADER_MIN_PRECISION_SUPPORT: {
if (FeatureSupportDataSize != sizeof(D3D11_FEATURE_DATA_SHADER_MIN_PRECISION_SUPPORT)) auto info = static_cast<D3D11_FEATURE_DATA_SHADER_MIN_PRECISION_SUPPORT*>(pFeatureSupportData);
if (FeatureSupportDataSize != sizeof(*info))
return E_INVALIDARG; return E_INVALIDARG;
// Report that we only support full 32-bit operations // Report that we only support full 32-bit operations
auto info = static_cast<D3D11_FEATURE_DATA_SHADER_MIN_PRECISION_SUPPORT*>(pFeatureSupportData);
info->PixelShaderMinPrecision = 0; info->PixelShaderMinPrecision = 0;
info->AllOtherShaderStagesMinPrecision = 0; info->AllOtherShaderStagesMinPrecision = 0;
} return S_OK; } return S_OK;
case D3D11_FEATURE_D3D9_SHADOW_SUPPORT: { case D3D11_FEATURE_D3D9_SHADOW_SUPPORT: {
if (FeatureSupportDataSize != sizeof(D3D11_FEATURE_DATA_D3D9_SHADOW_SUPPORT)) auto info = static_cast<D3D11_FEATURE_DATA_D3D9_SHADOW_SUPPORT*>(pFeatureSupportData);
if (FeatureSupportDataSize != sizeof(*info))
return E_INVALIDARG; return E_INVALIDARG;
auto info = static_cast<D3D11_FEATURE_DATA_D3D9_SHADOW_SUPPORT*>(pFeatureSupportData);
info->SupportsDepthAsTextureWithLessEqualComparisonFilter = TRUE; info->SupportsDepthAsTextureWithLessEqualComparisonFilter = TRUE;
} return S_OK; } return S_OK;
case D3D11_FEATURE_D3D11_OPTIONS1: { case D3D11_FEATURE_D3D11_OPTIONS1: {
if (FeatureSupportDataSize != sizeof(D3D11_FEATURE_DATA_D3D11_OPTIONS1)) auto info = static_cast<D3D11_FEATURE_DATA_D3D11_OPTIONS1*>(pFeatureSupportData);
if (FeatureSupportDataSize != sizeof(*info))
return E_INVALIDARG; return E_INVALIDARG;
// Min/Max filtering requires Tiled Resources Tier 2 for some reason, // Min/Max filtering requires Tiled Resources Tier 2 for some reason,
// so we cannot support it even though Vulkan exposes this feature // so we cannot support it even though Vulkan exposes this feature
auto info = static_cast<D3D11_FEATURE_DATA_D3D11_OPTIONS1*>(pFeatureSupportData);
info->TiledResourcesTier = D3D11_TILED_RESOURCES_NOT_SUPPORTED; info->TiledResourcesTier = D3D11_TILED_RESOURCES_NOT_SUPPORTED;
info->MinMaxFiltering = FALSE; info->MinMaxFiltering = FALSE;
info->ClearViewAlsoSupportsDepthOnlyFormats = TRUE; info->ClearViewAlsoSupportsDepthOnlyFormats = TRUE;
@ -1608,26 +1619,29 @@ namespace dxvk {
} return S_OK; } return S_OK;
case D3D11_FEATURE_D3D9_SIMPLE_INSTANCING_SUPPORT: { case D3D11_FEATURE_D3D9_SIMPLE_INSTANCING_SUPPORT: {
if (FeatureSupportDataSize != sizeof(D3D11_FEATURE_DATA_D3D9_SIMPLE_INSTANCING_SUPPORT)) auto info = static_cast<D3D11_FEATURE_DATA_D3D9_SIMPLE_INSTANCING_SUPPORT*>(pFeatureSupportData);
if (FeatureSupportDataSize != sizeof(*info))
return E_INVALIDARG; return E_INVALIDARG;
auto info = static_cast<D3D11_FEATURE_DATA_D3D9_SIMPLE_INSTANCING_SUPPORT*>(pFeatureSupportData);
info->SimpleInstancingSupported = TRUE; info->SimpleInstancingSupported = TRUE;
} return S_OK; } return S_OK;
case D3D11_FEATURE_MARKER_SUPPORT: { case D3D11_FEATURE_MARKER_SUPPORT: {
if (FeatureSupportDataSize != sizeof(D3D11_FEATURE_DATA_MARKER_SUPPORT)) auto info = static_cast<D3D11_FEATURE_DATA_MARKER_SUPPORT*>(pFeatureSupportData);
if (FeatureSupportDataSize != sizeof(*info))
return E_INVALIDARG; return E_INVALIDARG;
auto info = static_cast<D3D11_FEATURE_DATA_MARKER_SUPPORT*>(pFeatureSupportData);
info->Profile = FALSE; info->Profile = FALSE;
} return S_OK; } return S_OK;
case D3D11_FEATURE_D3D9_OPTIONS1: { case D3D11_FEATURE_D3D9_OPTIONS1: {
if (FeatureSupportDataSize != sizeof(D3D11_FEATURE_DATA_D3D9_OPTIONS1)) auto info = static_cast<D3D11_FEATURE_DATA_D3D9_OPTIONS1*>(pFeatureSupportData);
if (FeatureSupportDataSize != sizeof(*info))
return E_INVALIDARG; return E_INVALIDARG;
auto info = static_cast<D3D11_FEATURE_DATA_D3D9_OPTIONS1*>(pFeatureSupportData);
info->FullNonPow2TextureSupported = TRUE; info->FullNonPow2TextureSupported = TRUE;
info->DepthAsTextureWithLessEqualComparisonFilterSupported = TRUE; info->DepthAsTextureWithLessEqualComparisonFilterSupported = TRUE;
info->SimpleInstancingSupported = TRUE; info->SimpleInstancingSupported = TRUE;
@ -1635,13 +1649,14 @@ namespace dxvk {
} return S_OK; } return S_OK;
case D3D11_FEATURE_D3D11_OPTIONS2: { case D3D11_FEATURE_D3D11_OPTIONS2: {
if (FeatureSupportDataSize != sizeof(D3D11_FEATURE_DATA_D3D11_OPTIONS2)) auto info = static_cast<D3D11_FEATURE_DATA_D3D11_OPTIONS2*>(pFeatureSupportData);
if (FeatureSupportDataSize != sizeof(*info))
return E_INVALIDARG; return E_INVALIDARG;
const auto& extensions = m_dxvkDevice->extensions(); const auto& extensions = m_dxvkDevice->extensions();
const auto& features = m_dxvkDevice->features(); const auto& features = m_dxvkDevice->features();
auto info = static_cast<D3D11_FEATURE_DATA_D3D11_OPTIONS2*>(pFeatureSupportData);
info->PSSpecifiedStencilRefSupported = extensions.extShaderStencilExport; info->PSSpecifiedStencilRefSupported = extensions.extShaderStencilExport;
info->TypedUAVLoadAdditionalFormats = features.core.features.shaderStorageImageReadWithoutFormat; info->TypedUAVLoadAdditionalFormats = features.core.features.shaderStorageImageReadWithoutFormat;
info->ROVsSupported = FALSE; info->ROVsSupported = FALSE;
@ -1663,28 +1678,28 @@ namespace dxvk {
} return S_OK; } return S_OK;
case D3D11_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT: { case D3D11_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT: {
if (FeatureSupportDataSize != sizeof(D3D11_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT)) auto info = static_cast<D3D11_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT*>(pFeatureSupportData);
if (FeatureSupportDataSize != sizeof(*info))
return E_INVALIDARG; return E_INVALIDARG;
// These numbers are not accurate, but it should not have any effect on D3D11 apps // These numbers are not accurate, but it should not have any effect on D3D11 apps
auto info = static_cast<D3D11_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT*>(pFeatureSupportData);
info->MaxGPUVirtualAddressBitsPerResource = 32; info->MaxGPUVirtualAddressBitsPerResource = 32;
info->MaxGPUVirtualAddressBitsPerProcess = 40; info->MaxGPUVirtualAddressBitsPerProcess = 40;
} return S_OK; } return S_OK;
case D3D11_FEATURE_D3D11_OPTIONS4: { case D3D11_FEATURE_D3D11_OPTIONS4: {
if (FeatureSupportDataSize != sizeof(D3D11_FEATURE_DATA_D3D11_OPTIONS4)) auto info = static_cast<D3D11_FEATURE_DATA_D3D11_OPTIONS4*>(pFeatureSupportData);
if (FeatureSupportDataSize != sizeof(*info))
return E_INVALIDARG; return E_INVALIDARG;
auto info = static_cast<D3D11_FEATURE_DATA_D3D11_OPTIONS4*>(pFeatureSupportData);
info->ExtendedNV12SharedTextureSupported = FALSE; info->ExtendedNV12SharedTextureSupported = FALSE;
} return S_OK; } return S_OK;
default: default:
Logger::err(str::format( Logger::err(str::format("D3D11Device: CheckFeatureSupport: Unknown feature: ", Feature));
"D3D11Device: CheckFeatureSupport: Unknown feature: ", return E_INVALIDARG;
Feature));
return E_NOTIMPL;
} }
} }