mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-20 19:54:19 +01:00
[dxbc] Add option to enable strict sm4-compliat division
SM4 is defined to return the first source operand if the divisor is zero. Windows drivers don't do this by default, so we shouldn't do it either.
This commit is contained in:
parent
a4378996d9
commit
c0b325b483
@ -7,6 +7,7 @@ namespace dxvk {
|
||||
D3D11Options::D3D11Options(const Config& config) {
|
||||
this->allowMapFlagNoWait = config.getOption<bool>("d3d11.allowMapFlagNoWait", false);
|
||||
this->dcSingleUseMode = config.getOption<bool>("d3d11.dcSingleUseMode", true);
|
||||
this->strictDivision = config.getOption<bool>("d3d11.strictDivision", false);
|
||||
this->zeroInitWorkgroupMemory = config.getOption<bool>("d3d11.zeroInitWorkgroupMemory", false);
|
||||
this->maxTessFactor = config.getOption<int32_t>("d3d11.maxTessFactor", 0);
|
||||
this->samplerAnisotropy = config.getOption<int32_t>("d3d11.samplerAnisotropy", -1);
|
||||
|
@ -25,6 +25,11 @@ namespace dxvk {
|
||||
/// than once.
|
||||
bool dcSingleUseMode;
|
||||
|
||||
/// Enables sm4-compliant division-by-zero behaviour
|
||||
/// Windows drivers don't normally do this, but some
|
||||
/// games may expect correct behaviour.
|
||||
bool strictDivision;
|
||||
|
||||
/// Zero-initialize workgroup memory
|
||||
///
|
||||
/// Workargound for games that don't initialize
|
||||
|
@ -1519,6 +1519,21 @@ namespace dxvk {
|
||||
break;
|
||||
|
||||
case DxbcOpcode::Div:
|
||||
dst.id = m_module.opFDiv(typeId,
|
||||
src.at(0).id, src.at(1).id);
|
||||
|
||||
if (m_moduleInfo.options.strictDivision) {
|
||||
uint32_t boolType = dst.type.ccount > 1
|
||||
? m_module.defVectorType(m_module.defBoolType(), dst.type.ccount)
|
||||
: m_module.defBoolType();
|
||||
|
||||
dst.id = m_module.opSelect(typeId,
|
||||
m_module.opFOrdNotEqual(boolType, src.at(1).id,
|
||||
emitBuildConstVecf32(0.0f, 0.0f, 0.0f, 0.0f, ins.dst[0].mask).id),
|
||||
dst.id, src.at(0).id);
|
||||
}
|
||||
break;
|
||||
|
||||
case DxbcOpcode::DDiv:
|
||||
dst.id = m_module.opFDiv(typeId,
|
||||
src.at(0).id, src.at(1).id);
|
||||
|
@ -24,6 +24,7 @@ namespace dxvk {
|
||||
useRawSsbo
|
||||
= (devInfo.core.properties.limits.minStorageBufferOffsetAlignment <= sizeof(uint32_t));
|
||||
|
||||
strictDivision = options.strictDivision;
|
||||
zeroInitWorkgroupMemory = options.zeroInitWorkgroupMemory;
|
||||
|
||||
// Disable early discard on RADV due to GPU hangs
|
||||
|
@ -21,6 +21,9 @@ namespace dxvk {
|
||||
/// for raw and structured buffers.
|
||||
bool useRawSsbo = false;
|
||||
|
||||
/// Enables sm4-compliant division-by-zero behaviour
|
||||
bool strictDivision = false;
|
||||
|
||||
/// Clear thread-group shared memory to zero
|
||||
bool zeroInitWorkgroupMemory = false;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user