1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-02 01:24:11 +01:00

[dxbc] Use SDiv instead of ShiftRightLogical for index calc on Nvidia

Reportedly fixes Resident Evil 2 and Devil May Cry 5 on Nvidia.
This commit is contained in:
Philip Rebohle 2019-03-09 19:59:56 +01:00
parent a40d8d49ea
commit 0326258829
3 changed files with 17 additions and 5 deletions

View File

@ -5122,9 +5122,13 @@ namespace dxvk {
const uint32_t typeId = getVectorTypeId(result.type);
uint32_t offset = m_moduleInfo.options.useSdivForBufferIndex
? m_module.opSDiv (typeId, structOffset.id, m_module.consti32(4))
: m_module.opShiftRightLogical(typeId, structOffset.id, m_module.consti32(2));
result.id = m_module.opIAdd(typeId,
m_module.opIMul(typeId, structId.id, m_module.consti32(structStride / 4)),
m_module.opShiftRightLogical(typeId, structOffset.id, m_module.consti32(2)));
offset);
return result;
}
@ -5134,10 +5138,12 @@ namespace dxvk {
DxbcRegisterValue result;
result.type.ctype = DxbcScalarType::Sint32;
result.type.ccount = 1;
result.id = m_module.opShiftRightLogical(
getVectorTypeId(result.type),
byteOffset.id,
m_module.consti32(2));
uint32_t typeId = getVectorTypeId(result.type);
result.id = m_moduleInfo.options.useSdivForBufferIndex
? m_module.opSDiv (typeId, byteOffset.id, m_module.consti32(4))
: m_module.opShiftRightLogical(typeId, byteOffset.id, m_module.consti32(2));
return result;
}

View File

@ -25,6 +25,8 @@ namespace dxvk {
&& (devInfo.coreSubgroup.supportedOperations & VK_SUBGROUP_FEATURE_BALLOT_BIT);
useRawSsbo
= (devInfo.core.properties.limits.minStorageBufferOffsetAlignment <= sizeof(uint32_t));
useSdivForBufferIndex
= adapter->matchesDriver(DxvkGpuVendor::Nvidia, VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR, 0, 0);
strictDivision = options.strictDivision;
zeroInitWorkgroupMemory = options.zeroInitWorkgroupMemory;

View File

@ -24,6 +24,10 @@ namespace dxvk {
/// Use SSBOs instead of texel buffers
/// for raw and structured buffers.
bool useRawSsbo = false;
/// Use SDiv instead of SHR to converte byte offsets to
/// dword offsets. Fixes RE2 and DMC5 on Nvidia drivers.
bool useSdivForBufferIndex = false;
/// Enables sm4-compliant division-by-zero behaviour
bool strictDivision = false;