Skip to content

Commit 8f6edef

Browse files
authored
Merge pull request KhronosGroup#979 from billhollings/master
Fix issue where expected buffer-sizes buffer not bound to Metal compute encoder.
2 parents 1e993f8 + 2c7734e commit 8f6edef

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

Docs/Whats_New.md

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Released 2020/07/28
4141
- Fix new and unexpected App Store failure on newly deprecated color space values.
4242
- Fix intermittent concurrent shader specialization race condition.
4343
- Fix offsets when flushing buffer data to GPU.
44+
- Fix issue where expected buffer-sizes buffer not bound to Metal compute encoder.
4445
- Ensure fragment shader inputs to have as many components as vertex shader outputs.
4546
- Include vertex attribute size when testing whether attribute offset exceeds stride.
4647
- Add support for `USCALED/SSCALED` vertex formats.

MoltenVK/MoltenVK/Commands/MVKCommandEncoderState.mm

+15-17
Original file line numberDiff line numberDiff line change
@@ -781,26 +781,10 @@
781781

782782
void MVKComputeResourcesCommandEncoderState::encodeImpl(uint32_t) {
783783

784-
bool fullImageViewSwizzle = false;
785784
MVKPipeline* pipeline = _cmdEncoder->_computePipelineState.getPipeline();
786-
if (pipeline)
787-
fullImageViewSwizzle = pipeline->fullImageViewSwizzle();
788-
789-
encodeBinding<MVKMTLBufferBinding>(_resourceBindings.bufferBindings, _resourceBindings.areBufferBindingsDirty,
790-
[](MVKCommandEncoder* cmdEncoder, MVKMTLBufferBinding& b)->void {
791-
if (b.isInline)
792-
cmdEncoder->setComputeBytes(cmdEncoder->getMTLComputeEncoder(kMVKCommandUseDispatch),
793-
b.mtlBytes,
794-
b.size,
795-
b.index);
796-
else
797-
[cmdEncoder->getMTLComputeEncoder(kMVKCommandUseDispatch) setBuffer: b.mtlBuffer
798-
offset: b.offset
799-
atIndex: b.index];
800-
});
785+
bool fullImageViewSwizzle = pipeline ? pipeline->fullImageViewSwizzle() : false;
801786

802787
if (_resourceBindings.swizzleBufferBinding.isDirty) {
803-
804788
for (auto& b : _resourceBindings.textureBindings) {
805789
if (b.isDirty) { updateImplicitBuffer(_resourceBindings.swizzleConstants, b.index, b.swizzle); }
806790
}
@@ -826,6 +810,20 @@
826810

827811
}
828812

813+
encodeBinding<MVKMTLBufferBinding>(_resourceBindings.bufferBindings, _resourceBindings.areBufferBindingsDirty,
814+
[](MVKCommandEncoder* cmdEncoder, MVKMTLBufferBinding& b)->void {
815+
if (b.isInline) {
816+
cmdEncoder->setComputeBytes(cmdEncoder->getMTLComputeEncoder(kMVKCommandUseDispatch),
817+
b.mtlBytes,
818+
b.size,
819+
b.index);
820+
} else {
821+
[cmdEncoder->getMTLComputeEncoder(kMVKCommandUseDispatch) setBuffer: b.mtlBuffer
822+
offset: b.offset
823+
atIndex: b.index];
824+
}
825+
});
826+
829827
encodeBinding<MVKMTLTextureBinding>(_resourceBindings.textureBindings, _resourceBindings.areTextureBindingsDirty,
830828
[](MVKCommandEncoder* cmdEncoder, MVKMTLTextureBinding& b)->void {
831829
[cmdEncoder->getMTLComputeEncoder(kMVKCommandUseDispatch) setTexture: b.mtlTexture

0 commit comments

Comments
 (0)