Skip to content

Commit 99d3e57

Browse files
committed
[d3d11] Add compile-time debug flag for lazy binding
1 parent 7031a44 commit 99d3e57

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

src/d3d11/d3d11_context.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3548,7 +3548,7 @@ namespace dxvk {
35483548
m_state.lazy.shadersUsed.set(ShaderStage);
35493549
m_state.lazy.bindingsUsed[ShaderStage] = pShaderModule->GetBindingMask();
35503550

3551-
if (!m_state.lazy.shadersDirty.test(ShaderStage)) {
3551+
if (!m_state.lazy.shadersDirty.test(ShaderStage) && (DebugLazyBinding != Tristate::False)) {
35523552
if (!(m_state.lazy.bindingsDirty[ShaderStage] & m_state.lazy.bindingsUsed[ShaderStage]).empty())
35533553
m_state.lazy.shadersDirty.set(ShaderStage);
35543554
}
@@ -4368,11 +4368,15 @@ namespace dxvk {
43684368
T& DirtyMask,
43694369
T DirtyBit,
43704370
bool IsNull) {
4371+
// Forward immediately if lazy binding is forced off
4372+
if (DebugLazyBinding == Tristate::False)
4373+
return false;
4374+
43714375
if ((BoundMask & ~DirtyMask) & DirtyBit) {
43724376
// If we're binding a non-null resource to an active slot that has not been
43734377
// marked for lazy binding yet, forward the call immediately in order to
43744378
// avoid tracking overhead. This is by far the most common case.
4375-
if (likely(!IsNull))
4379+
if (likely(!IsNull && DebugLazyBinding != Tristate::True))
43764380
return false;
43774381

43784382
// If we are binding a null resource to an active slot, the app will likely

src/d3d11/d3d11_context.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ namespace dxvk {
7575
// Use a local staging buffer to handle tiny uploads, most
7676
// of the time we're fine with hitting the global allocator
7777
constexpr static VkDeviceSize StagingBufferSize = 256ull << 10;
78+
79+
protected:
80+
// Compile-time debug flag to force lazy binding on (True) or off (False)
81+
constexpr static Tristate DebugLazyBinding = Tristate::Auto;
82+
7883
public:
7984

8085
D3D11CommonContext(

src/d3d11/d3d11_context_imm.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,6 +1053,10 @@ namespace dxvk {
10531053

10541054
void D3D11ImmediateContext::ConsiderFlush(
10551055
GpuFlushType FlushType) {
1056+
// In stress test mode, behave as if this would always flush
1057+
if (DebugLazyBinding == Tristate::True)
1058+
ApplyDirtyNullBindings();
1059+
10561060
uint64_t chunkId = GetCurrentSequenceNumber();
10571061
uint64_t submissionId = m_submissionFence->value();
10581062

0 commit comments

Comments
 (0)