mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-02 10:24:12 +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:
parent
a40d8d49ea
commit
0326258829
@ -5122,9 +5122,13 @@ namespace dxvk {
|
|||||||
|
|
||||||
const uint32_t typeId = getVectorTypeId(result.type);
|
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,
|
result.id = m_module.opIAdd(typeId,
|
||||||
m_module.opIMul(typeId, structId.id, m_module.consti32(structStride / 4)),
|
m_module.opIMul(typeId, structId.id, m_module.consti32(structStride / 4)),
|
||||||
m_module.opShiftRightLogical(typeId, structOffset.id, m_module.consti32(2)));
|
offset);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5134,10 +5138,12 @@ namespace dxvk {
|
|||||||
DxbcRegisterValue result;
|
DxbcRegisterValue result;
|
||||||
result.type.ctype = DxbcScalarType::Sint32;
|
result.type.ctype = DxbcScalarType::Sint32;
|
||||||
result.type.ccount = 1;
|
result.type.ccount = 1;
|
||||||
result.id = m_module.opShiftRightLogical(
|
|
||||||
getVectorTypeId(result.type),
|
uint32_t typeId = getVectorTypeId(result.type);
|
||||||
byteOffset.id,
|
|
||||||
m_module.consti32(2));
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,8 @@ namespace dxvk {
|
|||||||
&& (devInfo.coreSubgroup.supportedOperations & VK_SUBGROUP_FEATURE_BALLOT_BIT);
|
&& (devInfo.coreSubgroup.supportedOperations & VK_SUBGROUP_FEATURE_BALLOT_BIT);
|
||||||
useRawSsbo
|
useRawSsbo
|
||||||
= (devInfo.core.properties.limits.minStorageBufferOffsetAlignment <= sizeof(uint32_t));
|
= (devInfo.core.properties.limits.minStorageBufferOffsetAlignment <= sizeof(uint32_t));
|
||||||
|
useSdivForBufferIndex
|
||||||
|
= adapter->matchesDriver(DxvkGpuVendor::Nvidia, VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR, 0, 0);
|
||||||
|
|
||||||
strictDivision = options.strictDivision;
|
strictDivision = options.strictDivision;
|
||||||
zeroInitWorkgroupMemory = options.zeroInitWorkgroupMemory;
|
zeroInitWorkgroupMemory = options.zeroInitWorkgroupMemory;
|
||||||
|
@ -24,6 +24,10 @@ namespace dxvk {
|
|||||||
/// Use SSBOs instead of texel buffers
|
/// Use SSBOs instead of texel buffers
|
||||||
/// for raw and structured buffers.
|
/// for raw and structured buffers.
|
||||||
bool useRawSsbo = false;
|
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
|
/// Enables sm4-compliant division-by-zero behaviour
|
||||||
bool strictDivision = false;
|
bool strictDivision = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user