1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-19 05:52:11 +01:00

[d3d11,dxbc] Rework check for TypedUAVLoadAdditionalFormats

This commit is contained in:
Philip Rebohle 2022-08-17 14:37:18 +02:00
parent 653a98f01b
commit 3717922381
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
5 changed files with 43 additions and 11 deletions

View File

@ -1681,10 +1681,9 @@ namespace dxvk {
return E_INVALIDARG; return E_INVALIDARG;
const auto& extensions = m_dxvkDevice->extensions(); const auto& extensions = m_dxvkDevice->extensions();
const auto& features = m_dxvkDevice->features();
info->PSSpecifiedStencilRefSupported = extensions.extShaderStencilExport; info->PSSpecifiedStencilRefSupported = extensions.extShaderStencilExport;
info->TypedUAVLoadAdditionalFormats = features.core.features.shaderStorageImageReadWithoutFormat; info->TypedUAVLoadAdditionalFormats = m_dxbcOptions.supportsTypedUavLoadExtended;
info->ROVsSupported = FALSE; info->ROVsSupported = FALSE;
info->ConservativeRasterizationTier = D3D11_CONSERVATIVE_RASTERIZATION_NOT_SUPPORTED; info->ConservativeRasterizationTier = D3D11_CONSERVATIVE_RASTERIZATION_NOT_SUPPORTED;
info->MapOnDefaultTextures = TRUE; info->MapOnDefaultTextures = TRUE;
@ -1977,7 +1976,6 @@ namespace dxvk {
enabled.core.features.multiDrawIndirect = VK_TRUE; enabled.core.features.multiDrawIndirect = VK_TRUE;
enabled.core.features.shaderFloat64 = supported.core.features.shaderFloat64; enabled.core.features.shaderFloat64 = supported.core.features.shaderFloat64;
enabled.core.features.shaderInt64 = supported.core.features.shaderInt64; enabled.core.features.shaderInt64 = supported.core.features.shaderInt64;
enabled.core.features.shaderStorageImageReadWithoutFormat = supported.core.features.shaderStorageImageReadWithoutFormat;
enabled.core.features.tessellationShader = VK_TRUE; enabled.core.features.tessellationShader = VK_TRUE;
} }

View File

@ -454,7 +454,7 @@ namespace dxvk {
D3D11StateObjectSet<D3D11RasterizerState> m_rsStateObjects; D3D11StateObjectSet<D3D11RasterizerState> m_rsStateObjects;
D3D11StateObjectSet<D3D11SamplerState> m_samplerObjects; D3D11StateObjectSet<D3D11SamplerState> m_samplerObjects;
D3D11ShaderModuleSet m_shaderModules; D3D11ShaderModuleSet m_shaderModules;
HRESULT CreateShaderModule( HRESULT CreateShaderModule(
D3D11CommonShader* pShaderModule, D3D11CommonShader* pShaderModule,
DxvkShaderKey ShaderKey, DxvkShaderKey ShaderKey,

View File

@ -876,7 +876,7 @@ namespace dxvk {
const bool isUav = ins.op == DxbcOpcode::DclUavTyped; const bool isUav = ins.op == DxbcOpcode::DclUavTyped;
if (isUav) { if (isUav) {
if (m_moduleInfo.options.useStorageImageReadWithoutFormat) if (m_moduleInfo.options.supportsTypedUavLoadR32)
m_module.enableCapability(spv::CapabilityStorageImageReadWithoutFormat); m_module.enableCapability(spv::CapabilityStorageImageReadWithoutFormat);
m_module.enableCapability(spv::CapabilityStorageImageWriteWithoutFormat); m_module.enableCapability(spv::CapabilityStorageImageWriteWithoutFormat);
} }
@ -951,7 +951,7 @@ namespace dxvk {
if (isUav) { if (isUav) {
if ((m_analysis->uavInfos[registerId].accessAtomicOp) if ((m_analysis->uavInfos[registerId].accessAtomicOp)
|| (m_analysis->uavInfos[registerId].accessTypedLoad || (m_analysis->uavInfos[registerId].accessTypedLoad
&& !m_moduleInfo.options.useStorageImageReadWithoutFormat)) && !m_moduleInfo.options.supportsTypedUavLoadR32))
imageFormat = getScalarImageFormat(sampledType); imageFormat = getScalarImageFormat(sampledType);
} }

View File

@ -17,8 +17,6 @@ namespace dxvk {
useDepthClipWorkaround useDepthClipWorkaround
= !devFeatures.extDepthClipEnable.depthClipEnable; = !devFeatures.extDepthClipEnable.depthClipEnable;
useStorageImageReadWithoutFormat
= devFeatures.core.features.shaderStorageImageReadWithoutFormat;
useSubgroupOpsForAtomicCounters useSubgroupOpsForAtomicCounters
= (devInfo.vk11.subgroupSupportedStages & VK_SHADER_STAGE_COMPUTE_BIT) = (devInfo.vk11.subgroupSupportedStages & VK_SHADER_STAGE_COMPUTE_BIT)
&& (devInfo.vk11.subgroupSupportedOperations & VK_SUBGROUP_FEATURE_BALLOT_BIT); && (devInfo.vk11.subgroupSupportedOperations & VK_SUBGROUP_FEATURE_BALLOT_BIT);
@ -28,7 +26,41 @@ namespace dxvk {
= (devInfo.vk11.subgroupSize >= 4) = (devInfo.vk11.subgroupSize >= 4)
&& (devInfo.vk11.subgroupSupportedStages & VK_SHADER_STAGE_FRAGMENT_BIT) && (devInfo.vk11.subgroupSupportedStages & VK_SHADER_STAGE_FRAGMENT_BIT)
&& (devInfo.vk11.subgroupSupportedOperations & VK_SUBGROUP_FEATURE_BALLOT_BIT); && (devInfo.vk11.subgroupSupportedOperations & VK_SUBGROUP_FEATURE_BALLOT_BIT);
supportsTypedUavLoadR32 = true;
supportsTypedUavLoadExtended = true;
static const std::array<std::pair<VkFormat, bool>, 18> s_typedUavFormats = {
std::make_pair(VK_FORMAT_R32_SFLOAT, false),
std::make_pair(VK_FORMAT_R32_UINT, false),
std::make_pair(VK_FORMAT_R32_SINT, false),
std::make_pair(VK_FORMAT_R32G32B32A32_SFLOAT, true),
std::make_pair(VK_FORMAT_R32G32B32A32_UINT, true),
std::make_pair(VK_FORMAT_R32G32B32A32_SINT, true),
std::make_pair(VK_FORMAT_R16G16B16A16_SFLOAT, true),
std::make_pair(VK_FORMAT_R16G16B16A16_UINT, true),
std::make_pair(VK_FORMAT_R16G16B16A16_SINT, true),
std::make_pair(VK_FORMAT_R8G8B8A8_UNORM, true),
std::make_pair(VK_FORMAT_R8G8B8A8_UINT, true),
std::make_pair(VK_FORMAT_R8G8B8A8_SINT, true),
std::make_pair(VK_FORMAT_R16_SFLOAT, true),
std::make_pair(VK_FORMAT_R16_UINT, true),
std::make_pair(VK_FORMAT_R16_SINT, true),
std::make_pair(VK_FORMAT_R8_UNORM, true),
std::make_pair(VK_FORMAT_R8_UINT, true),
std::make_pair(VK_FORMAT_R8_SINT, true),
};
for (const auto& f : s_typedUavFormats) {
DxvkFormatFeatures features = device->getFormatFeatures(f.first);
VkFormatFeatureFlags2 imgFeatures = features.optimal | features.linear;
if (!(imgFeatures & VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT)) {
supportsTypedUavLoadR32 &= f.second;
supportsTypedUavLoadExtended = false;
}
}
switch (device->config().useRawSsbo) { switch (device->config().useRawSsbo) {
case Tristate::Auto: minSsboAlignment = devInfo.core.properties.limits.minStorageBufferOffsetAlignment; break; case Tristate::Auto: minSsboAlignment = devInfo.core.properties.limits.minStorageBufferOffsetAlignment; break;
case Tristate::True: minSsboAlignment = 4u; break; case Tristate::True: minSsboAlignment = 4u; break;

View File

@ -23,8 +23,10 @@ namespace dxvk {
// clip device feature is not supported // clip device feature is not supported
bool useDepthClipWorkaround = false; bool useDepthClipWorkaround = false;
/// Use the ShaderImageReadWithoutFormat capability. /// Determines whether format qualifiers
bool useStorageImageReadWithoutFormat = false; /// on typed UAV loads are required
bool supportsTypedUavLoadR32 = false;
bool supportsTypedUavLoadExtended = false;
/// Use subgroup operations to reduce the number of /// Use subgroup operations to reduce the number of
/// atomic operations for append/consume buffers. /// atomic operations for append/consume buffers.