Merge pull request #979 from billhollings/master
Fix issue where expected buffer-sizes buffer not bound to Metal compute encoder.
diff --git a/Docs/Whats_New.md b/Docs/Whats_New.md
index 81f29f9..07f4544 100644
--- a/Docs/Whats_New.md
+++ b/Docs/Whats_New.md
@@ -41,6 +41,7 @@
- Fix new and unexpected App Store failure on newly deprecated color space values.
- Fix intermittent concurrent shader specialization race condition.
- Fix offsets when flushing buffer data to GPU.
+- Fix issue where expected buffer-sizes buffer not bound to Metal compute encoder.
- Ensure fragment shader inputs to have as many components as vertex shader outputs.
- Include vertex attribute size when testing whether attribute offset exceeds stride.
- Add support for `USCALED/SSCALED` vertex formats.
diff --git a/MoltenVK/MoltenVK/Commands/MVKCommandEncoderState.mm b/MoltenVK/MoltenVK/Commands/MVKCommandEncoderState.mm
index ac055f0..7ac03ea 100644
--- a/MoltenVK/MoltenVK/Commands/MVKCommandEncoderState.mm
+++ b/MoltenVK/MoltenVK/Commands/MVKCommandEncoderState.mm
@@ -781,26 +781,10 @@
void MVKComputeResourcesCommandEncoderState::encodeImpl(uint32_t) {
- bool fullImageViewSwizzle = false;
MVKPipeline* pipeline = _cmdEncoder->_computePipelineState.getPipeline();
- if (pipeline)
- fullImageViewSwizzle = pipeline->fullImageViewSwizzle();
-
- encodeBinding<MVKMTLBufferBinding>(_resourceBindings.bufferBindings, _resourceBindings.areBufferBindingsDirty,
- [](MVKCommandEncoder* cmdEncoder, MVKMTLBufferBinding& b)->void {
- if (b.isInline)
- cmdEncoder->setComputeBytes(cmdEncoder->getMTLComputeEncoder(kMVKCommandUseDispatch),
- b.mtlBytes,
- b.size,
- b.index);
- else
- [cmdEncoder->getMTLComputeEncoder(kMVKCommandUseDispatch) setBuffer: b.mtlBuffer
- offset: b.offset
- atIndex: b.index];
- });
+ bool fullImageViewSwizzle = pipeline ? pipeline->fullImageViewSwizzle() : false;
if (_resourceBindings.swizzleBufferBinding.isDirty) {
-
for (auto& b : _resourceBindings.textureBindings) {
if (b.isDirty) { updateImplicitBuffer(_resourceBindings.swizzleConstants, b.index, b.swizzle); }
}
@@ -826,6 +810,20 @@
}
+ encodeBinding<MVKMTLBufferBinding>(_resourceBindings.bufferBindings, _resourceBindings.areBufferBindingsDirty,
+ [](MVKCommandEncoder* cmdEncoder, MVKMTLBufferBinding& b)->void {
+ if (b.isInline) {
+ cmdEncoder->setComputeBytes(cmdEncoder->getMTLComputeEncoder(kMVKCommandUseDispatch),
+ b.mtlBytes,
+ b.size,
+ b.index);
+ } else {
+ [cmdEncoder->getMTLComputeEncoder(kMVKCommandUseDispatch) setBuffer: b.mtlBuffer
+ offset: b.offset
+ atIndex: b.index];
+ }
+ });
+
encodeBinding<MVKMTLTextureBinding>(_resourceBindings.textureBindings, _resourceBindings.areTextureBindingsDirty,
[](MVKCommandEncoder* cmdEncoder, MVKMTLTextureBinding& b)->void {
[cmdEncoder->getMTLComputeEncoder(kMVKCommandUseDispatch) setTexture: b.mtlTexture