Merge pull request #2001 from billhollings/fix-unbound-vtx-attr-buff

Fix rare case where vertex attribute buffers are not bound to Metal.
This commit is contained in:
Bill Hollings 2023-08-24 10:47:26 -04:00 committed by GitHub
commit fd418aa7fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View File

@ -13,6 +13,16 @@ Copyright (c) 2015-2023 [The Brenwill Workshop Ltd.](http://www.brenwill.com)
MoltenVK 1.2.6
--------------
Released TBD
- Fix rare case where vertex attribute buffers are not bound to Metal
when no other bindings change between pipelines.
MoltenVK 1.2.5
--------------

View File

@ -81,6 +81,8 @@ public:
/**
* If the content of this instance is dirty, marks this instance as no longer dirty
* and calls the encodeImpl() function to encode the content onto the Metal encoder.
* Marking dirty is done in advance so that subclass encodeImpl() implementations
* can override to leave this instance in a dirty state.
* Subclasses must override the encodeImpl() function to do the actual work.
*/
void encode(uint32_t stage = 0) {
@ -430,7 +432,8 @@ protected:
// Template function that executes a lambda expression on each dirty element of
// a vector of bindings, and marks the bindings and the vector as no longer dirty.
// Clear isDirty flag before operation to allow operation to possibly override.
// Clear binding isDirty flag before operation to allow operation to possibly override.
// If it does override, leave both the bindings and this instance as dirty.
template<class T, class V>
void encodeBinding(V& bindings,
bool& bindingsDirtyFlag,
@ -441,7 +444,7 @@ protected:
if (b.isDirty) {
b.isDirty = false;
mtlOperation(_cmdEncoder, b);
if (b.isDirty) { bindingsDirtyFlag = true; }
if (b.isDirty) { _isDirty = bindingsDirtyFlag = true; }
}
}
}