Merge pull request #1020 from billhollings/master

Fix Metal validation error when occlusion query and renderpass are in separate Vulkan command buffers.
This commit is contained in:
Bill Hollings 2020-09-10 18:22:12 -04:00 committed by GitHub
commit 19ebc7778b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 0 deletions

View File

@ -40,6 +40,8 @@ Released TBD
within each descriptor set.
- `vkCmdCopyImage` on macOS flush non-coherent image memory before copy operation.
- Re-add support for bitcode generation on *iOS* and *tvOS*.
- Fix Metal validation error when occlusion query and renderpass are in separate
Vulkan command buffers.

View File

@ -118,6 +118,7 @@ VkResult MVKCmdExecuteCommands<N>::setContent(MVKCommandBuffer* cmdBuff,
for (uint32_t cbIdx = 0; cbIdx < commandBuffersCount; cbIdx++) {
_secondaryCommandBuffers.push_back(MVKCommandBuffer::getMVKCommandBuffer(pCommandBuffers[cbIdx]));
}
cmdBuff->recordExecuteCommands(_secondaryCommandBuffers.contents());
return VK_SUCCESS;
}

View File

@ -97,6 +97,8 @@ public:
*/
id<MTLBuffer> _initialVisibilityResultMTLBuffer;
/** Called when a MVKCmdExecuteCommands is added to this command buffer. */
void recordExecuteCommands(const MVKArrayRef<MVKCommandBuffer*> secondaryCommandBuffers);
#pragma mark Tessellation constituent command management

View File

@ -195,6 +195,19 @@ MVKCommandBuffer::~MVKCommandBuffer() {
reset(0);
}
// If the initial visibility result buffer has not been set, promote the first visibility result buffer
// found among any of the secondary command buffers, to support the case where a render pass is started in
// the primary command buffer but the visibility query is started inside one of the secondary command buffers.
void MVKCommandBuffer::recordExecuteCommands(const MVKArrayRef<MVKCommandBuffer*> secondaryCommandBuffers) {
if (_initialVisibilityResultMTLBuffer == nil) {
for (MVKCommandBuffer* cmdBuff : secondaryCommandBuffers) {
if (cmdBuff->_initialVisibilityResultMTLBuffer) {
_initialVisibilityResultMTLBuffer = cmdBuff->_initialVisibilityResultMTLBuffer;
break;
}
}
}
}
#pragma mark -
#pragma mark Tessellation constituent command management