mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 11:52:12 +01:00
[dxbc] Repurpose useRawSsbo option
Basically, abuse the minSsboAlignment property to convince the compiler to always/never emit raw SSBOs for raw and structured buffers, and use the actual device limit by default.
This commit is contained in:
parent
0f7c23c022
commit
d755b18ccb
@ -1077,8 +1077,7 @@ namespace dxvk {
|
||||
: computeSrvBinding(m_programInfo.type(), registerId);
|
||||
|
||||
// Test whether we should use a raw SSBO for this resource
|
||||
bool useRawSsbo = m_moduleInfo.options.useRawSsbo
|
||||
&& m_moduleInfo.options.minSsboAlignment <= resAlign;
|
||||
bool useRawSsbo = m_moduleInfo.options.minSsboAlignment <= resAlign;
|
||||
|
||||
if (useRawSsbo) {
|
||||
uint32_t elemType = getScalarTypeId(DxbcScalarType::Uint32);
|
||||
@ -2696,8 +2695,7 @@ namespace dxvk {
|
||||
// (src0) The buffer register to query
|
||||
const DxbcBufferInfo bufferInfo = getBufferInfo(ins.src[0]);
|
||||
|
||||
bool isSsbo = m_moduleInfo.options.useRawSsbo
|
||||
&& m_moduleInfo.options.minSsboAlignment <= bufferInfo.align
|
||||
bool isSsbo = m_moduleInfo.options.minSsboAlignment <= bufferInfo.align
|
||||
&& bufferInfo.type != DxbcResourceType::Typed;
|
||||
|
||||
// We'll store this as a scalar unsigned integer
|
||||
@ -4839,8 +4837,7 @@ namespace dxvk {
|
||||
// For UAVs and shared memory, different methods
|
||||
// of obtaining the final pointer are used.
|
||||
bool isTgsm = operand.type == DxbcOperandType::ThreadGroupSharedMemory;
|
||||
bool isSsbo = m_moduleInfo.options.useRawSsbo
|
||||
&& m_moduleInfo.options.minSsboAlignment <= resourceInfo.align
|
||||
bool isSsbo = m_moduleInfo.options.minSsboAlignment <= resourceInfo.align
|
||||
&& resourceInfo.type != DxbcResourceType::Typed
|
||||
&& !isTgsm;
|
||||
|
||||
@ -4905,8 +4902,7 @@ namespace dxvk {
|
||||
// Shared memory is the only type of buffer that
|
||||
// is not accessed through a texel buffer view
|
||||
bool isTgsm = operand.type == DxbcOperandType::ThreadGroupSharedMemory;
|
||||
bool isSsbo = m_moduleInfo.options.useRawSsbo
|
||||
&& m_moduleInfo.options.minSsboAlignment <= bufferInfo.align
|
||||
bool isSsbo = m_moduleInfo.options.minSsboAlignment <= bufferInfo.align
|
||||
&& !isTgsm;
|
||||
|
||||
// Common types and IDs used while loading the data
|
||||
@ -4993,8 +4989,7 @@ namespace dxvk {
|
||||
|
||||
// Thread Group Shared Memory is not accessed through a texel buffer view
|
||||
bool isTgsm = operand.type == DxbcOperandType::ThreadGroupSharedMemory;
|
||||
bool isSsbo = m_moduleInfo.options.useRawSsbo
|
||||
&& m_moduleInfo.options.minSsboAlignment <= bufferInfo.align
|
||||
bool isSsbo = m_moduleInfo.options.minSsboAlignment <= bufferInfo.align
|
||||
&& !isTgsm;
|
||||
|
||||
// Perform UAV writes only if the UAV is bound and if there
|
||||
|
@ -28,11 +28,14 @@ namespace dxvk {
|
||||
= (devInfo.coreSubgroup.subgroupSize >= 4)
|
||||
&& (devInfo.coreSubgroup.supportedStages & VK_SHADER_STAGE_FRAGMENT_BIT)
|
||||
&& (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);
|
||||
minSsboAlignment = devInfo.core.properties.limits.minStorageBufferOffsetAlignment;
|
||||
|
||||
switch (device->config().useRawSsbo) {
|
||||
case Tristate::Auto: minSsboAlignment = devInfo.core.properties.limits.minStorageBufferOffsetAlignment; break;
|
||||
case Tristate::True: minSsboAlignment = 4u;
|
||||
case Tristate::False: minSsboAlignment = ~0u;
|
||||
}
|
||||
|
||||
strictDivision = options.strictDivision;
|
||||
zeroInitWorkgroupMemory = options.zeroInitWorkgroupMemory;
|
||||
@ -48,7 +51,6 @@ namespace dxvk {
|
||||
|
||||
// Apply shader-related options
|
||||
applyTristate(useSubgroupOpsForEarlyDiscard, device->config().useEarlyDiscard);
|
||||
applyTristate(useRawSsbo, device->config().useRawSsbo);
|
||||
}
|
||||
|
||||
}
|
@ -25,10 +25,6 @@ namespace dxvk {
|
||||
/// shader invocations if derivatives remain valid.
|
||||
bool useSubgroupOpsForEarlyDiscard = false;
|
||||
|
||||
/// 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;
|
||||
|
@ -44,7 +44,7 @@ int WINAPI WinMain(HINSTANCE hInstance,
|
||||
DxbcModuleInfo moduleInfo;
|
||||
moduleInfo.options.useSubgroupOpsForAtomicCounters = true;
|
||||
moduleInfo.options.useSubgroupOpsForEarlyDiscard = true;
|
||||
moduleInfo.options.useRawSsbo = true;
|
||||
moduleInfo.options.minSsboAlignment = 4;
|
||||
moduleInfo.xfb = nullptr;
|
||||
|
||||
Rc<DxvkShader> shader = module.compile(moduleInfo, ifileName);
|
||||
|
Loading…
x
Reference in New Issue
Block a user