1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-27 13:54:16 +01:00

[d3d11] Add compile-time debug flag for lazy binding

This commit is contained in:
Philip Rebohle 2025-02-19 16:16:13 +01:00 committed by Philip Rebohle
parent c0983a32be
commit 69171873fa
3 changed files with 15 additions and 2 deletions

View File

@ -3548,7 +3548,7 @@ namespace dxvk {
m_state.lazy.shadersUsed.set(ShaderStage); m_state.lazy.shadersUsed.set(ShaderStage);
m_state.lazy.bindingsUsed[ShaderStage] = pShaderModule->GetBindingMask(); m_state.lazy.bindingsUsed[ShaderStage] = pShaderModule->GetBindingMask();
if (!m_state.lazy.shadersDirty.test(ShaderStage)) { if (!m_state.lazy.shadersDirty.test(ShaderStage) && (DebugLazyBinding != Tristate::False)) {
if (!(m_state.lazy.bindingsDirty[ShaderStage] & m_state.lazy.bindingsUsed[ShaderStage]).empty()) if (!(m_state.lazy.bindingsDirty[ShaderStage] & m_state.lazy.bindingsUsed[ShaderStage]).empty())
m_state.lazy.shadersDirty.set(ShaderStage); m_state.lazy.shadersDirty.set(ShaderStage);
} }
@ -4368,11 +4368,15 @@ namespace dxvk {
T& DirtyMask, T& DirtyMask,
T DirtyBit, T DirtyBit,
bool IsNull) { bool IsNull) {
// Forward immediately if lazy binding is forced off
if (DebugLazyBinding == Tristate::False)
return false;
if ((BoundMask & ~DirtyMask) & DirtyBit) { if ((BoundMask & ~DirtyMask) & DirtyBit) {
// If we're binding a non-null resource to an active slot that has not been // If we're binding a non-null resource to an active slot that has not been
// marked for lazy binding yet, forward the call immediately in order to // marked for lazy binding yet, forward the call immediately in order to
// avoid tracking overhead. This is by far the most common case. // avoid tracking overhead. This is by far the most common case.
if (likely(!IsNull)) if (likely(!IsNull && DebugLazyBinding != Tristate::True))
return false; return false;
// If we are binding a null resource to an active slot, the app will likely // If we are binding a null resource to an active slot, the app will likely

View File

@ -75,6 +75,11 @@ namespace dxvk {
// Use a local staging buffer to handle tiny uploads, most // Use a local staging buffer to handle tiny uploads, most
// of the time we're fine with hitting the global allocator // of the time we're fine with hitting the global allocator
constexpr static VkDeviceSize StagingBufferSize = 256ull << 10; constexpr static VkDeviceSize StagingBufferSize = 256ull << 10;
protected:
// Compile-time debug flag to force lazy binding on (True) or off (False)
constexpr static Tristate DebugLazyBinding = Tristate::Auto;
public: public:
D3D11CommonContext( D3D11CommonContext(

View File

@ -1053,6 +1053,10 @@ namespace dxvk {
void D3D11ImmediateContext::ConsiderFlush( void D3D11ImmediateContext::ConsiderFlush(
GpuFlushType FlushType) { GpuFlushType FlushType) {
// In stress test mode, behave as if this would always flush
if (DebugLazyBinding == Tristate::True)
ApplyDirtyNullBindings();
uint64_t chunkId = GetCurrentSequenceNumber(); uint64_t chunkId = GetCurrentSequenceNumber();
uint64_t submissionId = m_submissionFence->value(); uint64_t submissionId = m_submissionFence->value();