diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdDraw.mm b/MoltenVK/MoltenVK/Commands/MVKCmdDraw.mm index 4a4a061d..bce57b70 100644 --- a/MoltenVK/MoltenVK/Commands/MVKCmdDraw.mm +++ b/MoltenVK/MoltenVK/Commands/MVKCmdDraw.mm @@ -94,6 +94,8 @@ void MVKCmdDraw::setContent(MVKCommandBuffer* cmdBuff, if ((_firstInstance != 0) && !(getDevice()->_pMetalFeatures->baseVertexInstanceDrawing)) { setConfigurationResult(reportError(VK_ERROR_FEATURE_NOT_PRESENT, "vkCmdDraw(): The current device does not support drawing with a non-zero base instance.")); } + + cmdBuff->recordDraw(this); } void MVKCmdDraw::encode(MVKCommandEncoder* cmdEncoder) { @@ -288,6 +290,8 @@ void MVKCmdDrawIndexed::setContent(MVKCommandBuffer* cmdBuff, if ((_vertexOffset != 0) && !(getDevice()->_pMetalFeatures->baseVertexInstanceDrawing)) { setConfigurationResult(reportError(VK_ERROR_FEATURE_NOT_PRESENT, "vkCmdDrawIndexed(): The current device does not support drawing with a non-zero base vertex.")); } + + cmdBuff->recordDraw(this); } void MVKCmdDrawIndexed::encode(MVKCommandEncoder* cmdEncoder) { @@ -518,6 +522,8 @@ void MVKCmdDrawIndirect::setContent(MVKCommandBuffer* cmdBuff, if ( !(getDevice()->_pMetalFeatures->indirectDrawing) ) { setConfigurationResult(reportError(VK_ERROR_FEATURE_NOT_PRESENT, "vkCmdDrawIndirect(): The current device does not support indirect drawing.")); } + + cmdBuff->recordDraw(this); } // This is totally arbitrary, but we're forced to do this because we don't know how many vertices @@ -762,6 +768,8 @@ void MVKCmdDrawIndexedIndirect::setContent(MVKCommandBuffer* cmdBuff, if ( !(getDevice()->_pMetalFeatures->indirectDrawing) ) { setConfigurationResult(reportError(VK_ERROR_FEATURE_NOT_PRESENT, "vkCmdDrawIndexedIndirect(): The current device does not support indirect drawing.")); } + + cmdBuff->recordDraw(this); } void MVKCmdDrawIndexedIndirect::encode(MVKCommandEncoder* cmdEncoder) { @@ -1020,7 +1028,6 @@ void mvkCmdDraw(MVKCommandBuffer* cmdBuff, uint32_t firstInstance) { MVKCmdDraw* cmd = cmdBuff->_commandPool->_cmdDrawPool.acquireObject(); cmd->setContent(cmdBuff, vertexCount, instanceCount, firstVertex, firstInstance); - cmdBuff->recordDraw(cmd); cmdBuff->addCommand(cmd); } @@ -1032,7 +1039,6 @@ void mvkCmdDrawIndexed(MVKCommandBuffer* cmdBuff, uint32_t firstInstance) { MVKCmdDrawIndexed* cmd = cmdBuff->_commandPool->_cmdDrawIndexedPool.acquireObject(); cmd->setContent(cmdBuff, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance); - cmdBuff->recordDraw(cmd); cmdBuff->addCommand(cmd); } @@ -1052,7 +1058,6 @@ void mvkCmdDrawIndirect(MVKCommandBuffer* cmdBuff, uint32_t stride) { MVKCmdDrawIndirect* cmd = cmdBuff->_commandPool->_cmdDrawIndirectPool.acquireObject(); cmd->setContent(cmdBuff, buffer, offset, drawCount, stride); - cmdBuff->recordDraw(cmd); cmdBuff->addCommand(cmd); } @@ -1063,7 +1068,6 @@ void mvkCmdDrawIndexedIndirect(MVKCommandBuffer* cmdBuff, uint32_t stride) { MVKCmdDrawIndexedIndirect* cmd = cmdBuff->_commandPool->_cmdDrawIndexedIndirectPool.acquireObject(); cmd->setContent(cmdBuff, buffer, offset, drawCount, stride); - cmdBuff->recordDraw(cmd); cmdBuff->addCommand(cmd); } diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdPipeline.mm b/MoltenVK/MoltenVK/Commands/MVKCmdPipeline.mm index 6df4bdbb..f0e3c26a 100644 --- a/MoltenVK/MoltenVK/Commands/MVKCmdPipeline.mm +++ b/MoltenVK/MoltenVK/Commands/MVKCmdPipeline.mm @@ -133,6 +133,8 @@ void MVKCmdBindPipeline::setContent(MVKCommandBuffer* cmdBuff, VkPipeline pipeline) { _bindPoint = pipelineBindPoint; _pipeline = (MVKPipeline*)pipeline; + + cmdBuff->recordBindPipeline(this); } void MVKCmdBindPipeline::encode(MVKCommandEncoder* cmdEncoder) { @@ -466,7 +468,6 @@ void mvkCmdBindPipeline(MVKCommandBuffer* cmdBuff, VkPipeline pipeline) { MVKCmdBindPipeline* cmd = cmdBuff->_commandPool->_cmdBindPipelinePool.acquireObject(); cmd->setContent(cmdBuff, pipelineBindPoint, pipeline); - cmdBuff->recordBindPipeline(cmd); cmdBuff->addCommand(cmd); } diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.h b/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.h index f2675a02..43688057 100644 --- a/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.h +++ b/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.h @@ -77,6 +77,8 @@ private: class MVKCmdEndRenderPass : public MVKCommand { public: + void setContent(MVKCommandBuffer* cmdBuff); + void encode(MVKCommandEncoder* cmdEncoder) override; MVKCmdEndRenderPass(MVKCommandTypePool* pool); diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.mm b/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.mm index 06247259..41a3fa2e 100644 --- a/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.mm +++ b/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.mm @@ -44,6 +44,8 @@ void MVKCmdBeginRenderPass::setContent(MVKCommandBuffer* cmdBuff, for (uint32_t i = 0; i < _info.clearValueCount; i++) { _clearValues.push_back(_info.pClearValues[i]); } + + cmdBuff->recordBeginRenderPass(this); } void MVKCmdBeginRenderPass::encode(MVKCommandEncoder* cmdEncoder) { @@ -74,6 +76,10 @@ MVKCmdNextSubpass::MVKCmdNextSubpass(MVKCommandTypePool* pool #pragma mark - #pragma mark MVKCmdEndRenderPass +void MVKCmdEndRenderPass::setContent(MVKCommandBuffer* cmdBuff) { + cmdBuff->recordEndRenderPass(this); +} + void MVKCmdEndRenderPass::encode(MVKCommandEncoder* cmdEncoder) { // MVKLogDebug("Encoding vkCmdEndRenderPass(). Elapsed time: %.6f ms.", mvkGetElapsedMilliseconds()); cmdEncoder->endRenderpass(); @@ -294,7 +300,6 @@ void mvkCmdBeginRenderPass(MVKCommandBuffer* cmdBuff, VkSubpassContents contents) { MVKCmdBeginRenderPass* cmd = cmdBuff->_commandPool->_cmdBeginRenderPassPool.acquireObject(); cmd->setContent(cmdBuff, pRenderPassBegin, contents); - cmdBuff->recordBeginRenderPass(cmd); cmdBuff->addCommand(cmd); } @@ -306,7 +311,7 @@ void mvkCmdNextSubpass(MVKCommandBuffer* cmdBuff, VkSubpassContents contents) { void mvkCmdEndRenderPass(MVKCommandBuffer* cmdBuff) { MVKCmdEndRenderPass* cmd = cmdBuff->_commandPool->_cmdEndRenderPassPool.acquireObject(); - cmdBuff->recordEndRenderPass(cmd); + cmd->setContent(cmdBuff); cmdBuff->addCommand(cmd); } diff --git a/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.h b/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.h index ec20b341..19ab8bb4 100644 --- a/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.h +++ b/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.h @@ -98,7 +98,7 @@ public: id _initialVisibilityResultMTLBuffer; -#pragma mark Constituent render pass management +#pragma mark Tessellation constituent command management /** Preps metadata for recording render pass */ void recordBeginRenderPass(MVKCmdBeginRenderPass* mvkBeginRenderPass); diff --git a/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm b/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm index 15165fc8..2eb56d26 100644 --- a/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm +++ b/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm @@ -197,7 +197,7 @@ MVKCommandBuffer::~MVKCommandBuffer() { #pragma mark - -#pragma mark Constituent render pass management +#pragma mark Tessellation constituent command management void MVKCommandBuffer::recordBeginRenderPass(MVKCmdBeginRenderPass* mvkBeginRenderPass) { _lastBeginRenderPass = mvkBeginRenderPass;