Skip to content

Commit b7b12ef

Browse files
always rebind because of a bug
1 parent 16e9df0 commit b7b12ef

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

source/Nabla/COpenGLDriver.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2030,15 +2030,25 @@ count = (first_count.resname.count - std::max(0, static_cast<int32_t>(first_coun
20302030
}
20312031

20322032
//if prev and curr pipeline layouts are compatible for set N, currState.set[N]==nextState.set[N] and the sets were bound with same dynamic offsets, then binding set N would be redundant
2033+
/*
2034+
// @Crisspl this is BUGGY.
2035+
// Imagine I have desc sets A, B, C
2036+
// I do some compute work while binding a pipeline layout with {A,B,C,nullptr}
2037+
// then I do some graphics work while binding a pipeline layout with {nullptr,B,nullptr}, I only ever use one pipeline
2038+
// when I do the graphics flush, the bindings will not be updated because prevLayout and currentLayout come from graphics (and are the same)
2039+
// AND the effectivelyBoundDescriptor matches with the only descriptor of the graphics bind point (both are B) this leads to problems
2040+
// you need to detect if switching effective pipelines (graphics to compute and back) will cause offsets to shift
2041+
// my suggestion is to track `current.effectivelyBoundDescriptors` and `next.effectivelyBoundDescriptors` then work from that instead of compare the next state for a pipeline with "previous" effectivelyBoundDescriptors
20332042
if ((i < compatibilityLimit) &&
20342043
(effectivelyBoundDescriptors.descSets[i].set == nextState.descriptorsParams[_pbp].descSets[i].set) &&
20352044
(effectivelyBoundDescriptors.descSets[i].dynamicOffsets == nextState.descriptorsParams[_pbp].descSets[i].dynamicOffsets)
20362045
)
20372046
{
20382047
continue;
20392048
}
2049+
*/
20402050

2041-
const auto& multibind_params = nextState.descriptorsParams[_pbp].descSets[i].set ?
2051+
const auto multibind_params = nextState.descriptorsParams[_pbp].descSets[i].set ?
20422052
nextState.descriptorsParams[_pbp].descSets[i].set->getMultibindParams() :
20432053
COpenGLDescriptorSet::SMultibindParams{};//all nullptr
20442054

@@ -2057,7 +2067,7 @@ count = (first_count.resname.count - std::max(0, static_cast<int32_t>(first_coun
20572067
extGlBindSamplers(first_count.textures.first, localTextureCount, multibind_params.textures.samplers);
20582068
}
20592069

2060-
bool nonNullSet = !!nextState.descriptorsParams[_pbp].descSets[i].set;
2070+
const bool nonNullSet = !!nextState.descriptorsParams[_pbp].descSets[i].set;
20612071
const bool useDynamicOffsets = !!nextState.descriptorsParams[_pbp].descSets[i].dynamicOffsets;
20622072
//not entirely sure those MAXes are right
20632073
constexpr size_t MAX_UBO_COUNT = 96ull;

0 commit comments

Comments
 (0)