diff --git a/MoltenVK/MoltenVK.xcodeproj/project.pbxproj b/MoltenVK/MoltenVK.xcodeproj/project.pbxproj index 29bdd201..e3edc7fb 100644 --- a/MoltenVK/MoltenVK.xcodeproj/project.pbxproj +++ b/MoltenVK/MoltenVK.xcodeproj/project.pbxproj @@ -63,8 +63,6 @@ A94FB7CB1C7DFB4800632CA3 /* MVKCmdDraw.mm in Sources */ = {isa = PBXBuildFile; fileRef = A94FB7751C7DFB4800632CA3 /* MVKCmdDraw.mm */; }; A94FB7CC1C7DFB4800632CA3 /* MVKCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = A94FB7761C7DFB4800632CA3 /* MVKCommand.h */; }; A94FB7CD1C7DFB4800632CA3 /* MVKCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = A94FB7761C7DFB4800632CA3 /* MVKCommand.h */; }; - A94FB7CE1C7DFB4800632CA3 /* MVKCommand.mm in Sources */ = {isa = PBXBuildFile; fileRef = A94FB7771C7DFB4800632CA3 /* MVKCommand.mm */; }; - A94FB7CF1C7DFB4800632CA3 /* MVKCommand.mm in Sources */ = {isa = PBXBuildFile; fileRef = A94FB7771C7DFB4800632CA3 /* MVKCommand.mm */; }; A94FB7D01C7DFB4800632CA3 /* MVKCommandBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = A94FB7781C7DFB4800632CA3 /* MVKCommandBuffer.h */; }; A94FB7D11C7DFB4800632CA3 /* MVKCommandBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = A94FB7781C7DFB4800632CA3 /* MVKCommandBuffer.h */; }; A94FB7D21C7DFB4800632CA3 /* MVKCommandBuffer.mm in Sources */ = {isa = PBXBuildFile; fileRef = A94FB7791C7DFB4800632CA3 /* MVKCommandBuffer.mm */; }; @@ -334,7 +332,6 @@ A94FB7741C7DFB4800632CA3 /* MVKCmdDraw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVKCmdDraw.h; sourceTree = ""; }; A94FB7751C7DFB4800632CA3 /* MVKCmdDraw.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MVKCmdDraw.mm; sourceTree = ""; }; A94FB7761C7DFB4800632CA3 /* MVKCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVKCommand.h; sourceTree = ""; }; - A94FB7771C7DFB4800632CA3 /* MVKCommand.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MVKCommand.mm; sourceTree = ""; }; A94FB7781C7DFB4800632CA3 /* MVKCommandBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVKCommandBuffer.h; sourceTree = ""; }; A94FB7791C7DFB4800632CA3 /* MVKCommandBuffer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MVKCommandBuffer.mm; sourceTree = ""; }; A94FB77A1C7DFB4800632CA3 /* MVKCommandPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVKCommandPool.h; sourceTree = ""; }; @@ -471,7 +468,6 @@ A94FB76C1C7DFB4800632CA3 /* MVKCmdTransfer.h */, A94FB76D1C7DFB4800632CA3 /* MVKCmdTransfer.mm */, A94FB7761C7DFB4800632CA3 /* MVKCommand.h */, - A94FB7771C7DFB4800632CA3 /* MVKCommand.mm */, A94FB7781C7DFB4800632CA3 /* MVKCommandBuffer.h */, A94FB7791C7DFB4800632CA3 /* MVKCommandBuffer.mm */, A95B7D671D3EE486003183D3 /* MVKCommandEncoderState.h */, @@ -1037,7 +1033,6 @@ A95B7D6B1D3EE486003183D3 /* MVKCommandEncoderState.mm in Sources */, A93E83352121F0C8001FEBD4 /* MVKGPUCapture.mm in Sources */, A9B51BD7225E986A00AC74D2 /* MVKOSExtensions.mm in Sources */, - A94FB7CE1C7DFB4800632CA3 /* MVKCommand.mm in Sources */, A94FB80E1C7DFB4800632CA3 /* MVKShaderModule.mm in Sources */, A94FB81A1C7DFB4800632CA3 /* MVKSync.mm in Sources */, 45557A5221C9EFF3008868BD /* MVKCodec.cpp in Sources */, @@ -1095,7 +1090,6 @@ A95B7D6C1D3EE486003183D3 /* MVKCommandEncoderState.mm in Sources */, A93E83362121F0C8001FEBD4 /* MVKGPUCapture.mm in Sources */, A9B51BD8225E986A00AC74D2 /* MVKOSExtensions.mm in Sources */, - A94FB7CF1C7DFB4800632CA3 /* MVKCommand.mm in Sources */, A94FB80F1C7DFB4800632CA3 /* MVKShaderModule.mm in Sources */, A94FB81B1C7DFB4800632CA3 /* MVKSync.mm in Sources */, 45557A5321C9EFF3008868BD /* MVKCodec.cpp in Sources */, diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdDebug.h b/MoltenVK/MoltenVK/Commands/MVKCmdDebug.h index 276a1d6b..19e313c4 100644 --- a/MoltenVK/MoltenVK/Commands/MVKCmdDebug.h +++ b/MoltenVK/MoltenVK/Commands/MVKCmdDebug.h @@ -32,8 +32,6 @@ class MVKCmdDebugMarker : public MVKCommand { public: VkResult setContent(MVKCommandBuffer* cmdBuff, const char* pMarkerName, const float color[4]); - MVKCmdDebugMarker(MVKCommandTypePool* pool); - ~MVKCmdDebugMarker() override; protected: @@ -50,8 +48,6 @@ class MVKCmdDebugMarkerBegin : public MVKCmdDebugMarker { public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdDebugMarkerBegin(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -69,8 +65,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdDebugMarkerEnd(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -86,8 +80,6 @@ class MVKCmdDebugMarkerInsert : public MVKCmdDebugMarker { public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdDebugMarkerInsert(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdDebug.mm b/MoltenVK/MoltenVK/Commands/MVKCmdDebug.mm index 7dfc1bf7..b05a43ea 100644 --- a/MoltenVK/MoltenVK/Commands/MVKCmdDebug.mm +++ b/MoltenVK/MoltenVK/Commands/MVKCmdDebug.mm @@ -34,9 +34,6 @@ VkResult MVKCmdDebugMarker::setContent(MVKCommandBuffer* cmdBuff, return VK_SUCCESS; } -MVKCmdDebugMarker::MVKCmdDebugMarker(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - MVKCmdDebugMarker::~MVKCmdDebugMarker() { [_markerName release]; } @@ -57,9 +54,6 @@ void MVKCmdDebugMarkerBegin::encode(MVKCommandEncoder* cmdEncoder) { } } -MVKCmdDebugMarkerBegin::MVKCmdDebugMarkerBegin(MVKCommandTypePool* pool) - : MVKCmdDebugMarker::MVKCmdDebugMarker((MVKCommandTypePool*)pool) {} - #pragma mark - #pragma mark MVKCmdDebugMarkerEnd @@ -79,9 +73,6 @@ void MVKCmdDebugMarkerEnd::encode(MVKCommandEncoder* cmdEncoder) { } } -MVKCmdDebugMarkerEnd::MVKCmdDebugMarkerEnd(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - #pragma mark - #pragma mark MVKCmdDebugMarkerInsert @@ -92,9 +83,6 @@ void MVKCmdDebugMarkerInsert::encode(MVKCommandEncoder* cmdEncoder) { [cmdEncoder->getMTLEncoder() insertDebugSignpost: _markerName]; } -MVKCmdDebugMarkerInsert::MVKCmdDebugMarkerInsert(MVKCommandTypePool* pool) - : MVKCmdDebugMarker::MVKCmdDebugMarker((MVKCommandTypePool*)pool) {} - #pragma mark - #pragma mark Support functions diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdDispatch.h b/MoltenVK/MoltenVK/Commands/MVKCmdDispatch.h index acad5c76..1dd9afc7 100644 --- a/MoltenVK/MoltenVK/Commands/MVKCmdDispatch.h +++ b/MoltenVK/MoltenVK/Commands/MVKCmdDispatch.h @@ -37,8 +37,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdDispatch(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -57,8 +55,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdDispatchIndirect(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdDispatch.mm b/MoltenVK/MoltenVK/Commands/MVKCmdDispatch.mm index 36103b84..fd4479b8 100644 --- a/MoltenVK/MoltenVK/Commands/MVKCmdDispatch.mm +++ b/MoltenVK/MoltenVK/Commands/MVKCmdDispatch.mm @@ -59,10 +59,6 @@ void MVKCmdDispatch::encode(MVKCommandEncoder* cmdEncoder) { threadsPerThreadgroup: cmdEncoder->_mtlThreadgroupSize]; } -MVKCmdDispatch::MVKCmdDispatch(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) { -} - #pragma mark - #pragma mark MVKCmdDispatchIndirect @@ -86,6 +82,3 @@ void MVKCmdDispatchIndirect::encode(MVKCommandEncoder* cmdEncoder) { threadsPerThreadgroup: cmdEncoder->_mtlThreadgroupSize]; } -MVKCmdDispatchIndirect::MVKCmdDispatchIndirect(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdDraw.h b/MoltenVK/MoltenVK/Commands/MVKCmdDraw.h index 99e6b707..4039a635 100644 --- a/MoltenVK/MoltenVK/Commands/MVKCmdDraw.h +++ b/MoltenVK/MoltenVK/Commands/MVKCmdDraw.h @@ -40,8 +40,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdBindVertexBuffers(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -63,8 +61,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdBindIndexBuffer(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -87,8 +83,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdDraw(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -115,8 +109,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdDrawIndexed(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -143,8 +135,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdDrawIndirect(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -170,8 +160,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdDrawIndexedIndirect(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdDraw.mm b/MoltenVK/MoltenVK/Commands/MVKCmdDraw.mm index 86be4d61..df5de95d 100644 --- a/MoltenVK/MoltenVK/Commands/MVKCmdDraw.mm +++ b/MoltenVK/MoltenVK/Commands/MVKCmdDraw.mm @@ -55,9 +55,6 @@ void MVKCmdBindVertexBuffers::encode(MVKCommandEncoder* cmdEncoder) { for (auto& b : _bindings) { cmdEncoder->_graphicsResourcesState.bindBuffer(kMVKShaderStageVertex, b); } } -MVKCmdBindVertexBuffers::MVKCmdBindVertexBuffers(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - #pragma mark - #pragma mark MVKCmdBindIndexBuffer @@ -80,9 +77,6 @@ void MVKCmdBindIndexBuffer::encode(MVKCommandEncoder* cmdEncoder) { cmdEncoder->_graphicsResourcesState.bindIndexBuffer(_binding); } -MVKCmdBindIndexBuffer::MVKCmdBindIndexBuffer(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - #pragma mark - #pragma mark MVKCmdDraw @@ -273,10 +267,6 @@ void MVKCmdDraw::encode(MVKCommandEncoder* cmdEncoder) { } } -MVKCmdDraw::MVKCmdDraw(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) { -} - #pragma mark - #pragma mark MVKCmdDrawIndexed @@ -514,9 +504,6 @@ void MVKCmdDrawIndexed::encode(MVKCommandEncoder* cmdEncoder) { } } -MVKCmdDrawIndexed::MVKCmdDrawIndexed(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - #pragma mark - #pragma mark MVKCmdDrawIndirect @@ -763,9 +750,6 @@ void MVKCmdDrawIndirect::encode(MVKCommandEncoder* cmdEncoder) { } } -MVKCmdDrawIndirect::MVKCmdDrawIndirect(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - #pragma mark - #pragma mark MVKCmdDrawIndexedIndirect @@ -1026,6 +1010,3 @@ void MVKCmdDrawIndexedIndirect::encode(MVKCommandEncoder* cmdEncoder) { } } -MVKCmdDrawIndexedIndirect::MVKCmdDrawIndexedIndirect(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdPipeline.h b/MoltenVK/MoltenVK/Commands/MVKCmdPipeline.h index 028a6a7f..22471b7e 100644 --- a/MoltenVK/MoltenVK/Commands/MVKCmdPipeline.h +++ b/MoltenVK/MoltenVK/Commands/MVKCmdPipeline.h @@ -49,8 +49,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdPipelineBarrier(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -76,8 +74,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdBindPipeline(MVKCommandTypePool* pool); - bool isTessellationPipeline(); protected: @@ -107,8 +103,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdBindDescriptorSets(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -136,8 +130,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdPushConstants(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -164,8 +156,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdPushDescriptorSet(MVKCommandTypePool* pool); - ~MVKCmdPushDescriptorSet() override; protected: @@ -194,8 +184,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdPushDescriptorSetWithTemplate(MVKCommandTypePool* pool); - ~MVKCmdPushDescriptorSetWithTemplate() override; protected: @@ -222,8 +210,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdSetResetEvent(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -254,8 +240,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdWaitEvents(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdPipeline.mm b/MoltenVK/MoltenVK/Commands/MVKCmdPipeline.mm index 6f449a15..e93e65fb 100644 --- a/MoltenVK/MoltenVK/Commands/MVKCmdPipeline.mm +++ b/MoltenVK/MoltenVK/Commands/MVKCmdPipeline.mm @@ -126,9 +126,6 @@ void MVKCmdPipelineBarrier::encode(MVKCommandEncoder* cmdEncoder) { } } -MVKCmdPipelineBarrier::MVKCmdPipelineBarrier(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - #pragma mark - #pragma mark MVKCmdBindPipeline @@ -150,9 +147,6 @@ void MVKCmdBindPipeline::encode(MVKCommandEncoder* cmdEncoder) { cmdEncoder->bindPipeline(_bindPoint, _pipeline); } -MVKCmdBindPipeline::MVKCmdBindPipeline(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - bool MVKCmdBindPipeline::isTessellationPipeline() { if (_bindPoint == VK_PIPELINE_BIND_POINT_GRAPHICS) return ((MVKGraphicsPipeline*)_pipeline)->isTessellationPipeline(); @@ -199,9 +193,6 @@ void MVKCmdBindDescriptorSets::encode(MVKCommandEncoder* cmdEncoder) { _pipelineLayout->bindDescriptorSets(cmdEncoder, _descriptorSets, _firstSet, _dynamicOffsets); } -MVKCmdBindDescriptorSets::MVKCmdBindDescriptorSets(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - #pragma mark - #pragma mark MVKCmdPushConstants @@ -239,9 +230,6 @@ void MVKCmdPushConstants::encode(MVKCommandEncoder* cmdEncoder) { } } -MVKCmdPushConstants::MVKCmdPushConstants(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - #pragma mark - #pragma mark MVKCmdPushDescriptorSet @@ -311,9 +299,6 @@ void MVKCmdPushDescriptorSet::encode(MVKCommandEncoder* cmdEncoder) { _pipelineLayout->pushDescriptorSet(cmdEncoder, _descriptorWrites, _set); } -MVKCmdPushDescriptorSet::MVKCmdPushDescriptorSet(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - MVKCmdPushDescriptorSet::~MVKCmdPushDescriptorSet() { clearDescriptorWrites(); } @@ -401,10 +386,6 @@ void MVKCmdPushDescriptorSetWithTemplate::encode(MVKCommandEncoder* cmdEncoder) _pipelineLayout->pushDescriptorSet(cmdEncoder, _descUpdateTemplate, _set, _pData); } -MVKCmdPushDescriptorSetWithTemplate::MVKCmdPushDescriptorSetWithTemplate( - MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - MVKCmdPushDescriptorSetWithTemplate::~MVKCmdPushDescriptorSetWithTemplate() { if (_pData) delete[] (char*)_pData; } @@ -429,9 +410,6 @@ void MVKCmdSetResetEvent::encode(MVKCommandEncoder* cmdEncoder) { cmdEncoder->signalEvent(_mvkEvent, _status); } -MVKCmdSetResetEvent::MVKCmdSetResetEvent(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - #pragma mark - #pragma mark MVKCmdWaitEvents @@ -464,6 +442,3 @@ void MVKCmdWaitEvents::encode(MVKCommandEncoder* cmdEncoder) { } } -MVKCmdWaitEvents::MVKCmdWaitEvents(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdQueries.h b/MoltenVK/MoltenVK/Commands/MVKCmdQueries.h index d341f205..ac0d848b 100644 --- a/MoltenVK/MoltenVK/Commands/MVKCmdQueries.h +++ b/MoltenVK/MoltenVK/Commands/MVKCmdQueries.h @@ -35,8 +35,6 @@ public: VkQueryPool queryPool, uint32_t query); - MVKCmdQuery(MVKCommandTypePool* pool); - protected: MVKQueryPool* _queryPool; uint32_t _query; @@ -57,8 +55,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdBeginQuery(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -75,8 +71,6 @@ class MVKCmdEndQuery : public MVKCmdQuery { public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdEndQuery(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -97,8 +91,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdWriteTimestamp(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -120,8 +112,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdResetQueryPool(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -147,8 +137,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdCopyQueryPoolResults(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdQueries.mm b/MoltenVK/MoltenVK/Commands/MVKCmdQueries.mm index f4bef6b2..7fa703ad 100644 --- a/MoltenVK/MoltenVK/Commands/MVKCmdQueries.mm +++ b/MoltenVK/MoltenVK/Commands/MVKCmdQueries.mm @@ -34,8 +34,6 @@ VkResult MVKCmdQuery::setContent(MVKCommandBuffer* cmdBuff, return VK_SUCCESS; } -MVKCmdQuery::MVKCmdQuery(MVKCommandTypePool* pool) : MVKCommand::MVKCommand(pool) {} - #pragma mark - #pragma mark MVKCmdBeginQuery @@ -59,9 +57,6 @@ void MVKCmdBeginQuery::encode(MVKCommandEncoder* cmdEncoder) { _queryPool->beginQuery(_query, _flags, cmdEncoder); } -MVKCmdBeginQuery::MVKCmdBeginQuery(MVKCommandTypePool* pool) - : MVKCmdQuery::MVKCmdQuery((MVKCommandTypePool*)pool) {} - #pragma mark - #pragma mark MVKCmdEndQuery @@ -72,9 +67,6 @@ void MVKCmdEndQuery::encode(MVKCommandEncoder* cmdEncoder) { _queryPool->endQuery(_query, cmdEncoder); } -MVKCmdEndQuery::MVKCmdEndQuery(MVKCommandTypePool* pool) - : MVKCmdQuery::MVKCmdQuery((MVKCommandTypePool*)pool) {} - #pragma mark - #pragma mark MVKCmdWriteTimestamp @@ -97,9 +89,6 @@ void MVKCmdWriteTimestamp::encode(MVKCommandEncoder* cmdEncoder) { cmdEncoder->markTimestamp(_queryPool, _query); } -MVKCmdWriteTimestamp::MVKCmdWriteTimestamp(MVKCommandTypePool* pool) - : MVKCmdQuery::MVKCmdQuery((MVKCommandTypePool*)pool) {} - #pragma mark - #pragma mark MVKCmdResetQueryPool @@ -122,9 +111,6 @@ void MVKCmdResetQueryPool::encode(MVKCommandEncoder* cmdEncoder) { _queryPool->resetResults(_query, _queryCount, cmdEncoder); } -MVKCmdResetQueryPool::MVKCmdResetQueryPool(MVKCommandTypePool* pool) - : MVKCmdQuery::MVKCmdQuery((MVKCommandTypePool*)pool) {} - #pragma mark - #pragma mark MVKCmdCopyQueryPoolResults @@ -161,6 +147,3 @@ void MVKCmdCopyQueryPoolResults::encode(MVKCommandEncoder* cmdEncoder) { } } -MVKCmdCopyQueryPoolResults::MVKCmdCopyQueryPoolResults(MVKCommandTypePool* pool) - : MVKCmdQuery::MVKCmdQuery((MVKCommandTypePool*)pool) {} - diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.h b/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.h index 5500b0c7..42e75f1b 100644 --- a/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.h +++ b/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.h @@ -41,8 +41,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdBeginRenderPass(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -66,8 +64,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdNextSubpass(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -86,8 +82,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdEndRenderPass(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -107,8 +101,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdExecuteCommands(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -129,8 +121,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdSetViewport(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -153,8 +143,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdSetScissor(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -175,8 +163,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdSetLineWidth(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -198,8 +184,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdSetDepthBias(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -221,8 +205,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdSetBlendConstants(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -246,8 +228,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdSetDepthBounds(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -269,8 +249,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdSetStencilCompareMask(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -292,8 +270,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdSetStencilWriteMask(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -315,8 +291,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdSetStencilReference(MVKCommandTypePool* pool); - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.mm b/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.mm index e99f0438..cbf4255a 100644 --- a/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.mm +++ b/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.mm @@ -57,9 +57,6 @@ void MVKCmdBeginRenderPass::encode(MVKCommandEncoder* cmdEncoder) { cmdEncoder->beginRenderpass(_contents, _renderPass, _framebuffer, _info.renderArea, &_clearValues, _loadOverride, _storeOverride); } -MVKCmdBeginRenderPass::MVKCmdBeginRenderPass(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - #pragma mark - #pragma mark MVKCmdNextSubpass @@ -77,9 +74,6 @@ void MVKCmdNextSubpass::encode(MVKCommandEncoder* cmdEncoder) { cmdEncoder->beginNextSubpass(_contents); } -MVKCmdNextSubpass::MVKCmdNextSubpass(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - #pragma mark - #pragma mark MVKCmdEndRenderPass @@ -96,9 +90,6 @@ void MVKCmdEndRenderPass::encode(MVKCommandEncoder* cmdEncoder) { cmdEncoder->endRenderpass(); } -MVKCmdEndRenderPass::MVKCmdEndRenderPass(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - #pragma mark - #pragma mark MVKCmdExecuteCommands @@ -122,9 +113,6 @@ void MVKCmdExecuteCommands::encode(MVKCommandEncoder* cmdEncoder) { for (auto& cb : _secondaryCommandBuffers) { cmdEncoder->encodeSecondary(cb); } } -MVKCmdExecuteCommands::MVKCmdExecuteCommands(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - #pragma mark - #pragma mark MVKCmdSetViewport @@ -149,9 +137,6 @@ void MVKCmdSetViewport::encode(MVKCommandEncoder* cmdEncoder) { cmdEncoder->_viewportState.setViewports(_mtlViewports, _firstViewport, true); } -MVKCmdSetViewport::MVKCmdSetViewport(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - #pragma mark - #pragma mark MVKCmdSetScissor @@ -176,9 +161,6 @@ void MVKCmdSetScissor::encode(MVKCommandEncoder* cmdEncoder) { cmdEncoder->_scissorState.setScissors(_mtlScissors, _firstScissor, true); } -MVKCmdSetScissor::MVKCmdSetScissor(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - #pragma mark - #pragma mark MVKCmdSetLineWidth @@ -199,9 +181,6 @@ VkResult MVKCmdSetLineWidth::setContent(MVKCommandBuffer* cmdBuff, void MVKCmdSetLineWidth::encode(MVKCommandEncoder* cmdEncoder) {} -MVKCmdSetLineWidth::MVKCmdSetLineWidth(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - #pragma mark - #pragma mark MVKCmdSetDepthBias @@ -225,9 +204,6 @@ void MVKCmdSetDepthBias::encode(MVKCommandEncoder* cmdEncoder) { _depthBiasClamp); } -MVKCmdSetDepthBias::MVKCmdSetDepthBias(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - #pragma mark - #pragma mark MVKCmdSetBlendConstants @@ -248,9 +224,6 @@ void MVKCmdSetBlendConstants::encode(MVKCommandEncoder* cmdEncoder) { cmdEncoder->_blendColorState.setBlendColor(_red, _green, _blue, _alpha, true); } -MVKCmdSetBlendConstants::MVKCmdSetBlendConstants(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - #pragma mark - #pragma mark MVKCmdSetDepthBounds @@ -273,9 +246,6 @@ VkResult MVKCmdSetDepthBounds::setContent(MVKCommandBuffer* cmdBuff, void MVKCmdSetDepthBounds::encode(MVKCommandEncoder* cmdEncoder) {} -MVKCmdSetDepthBounds::MVKCmdSetDepthBounds(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - #pragma mark - #pragma mark MVKCmdSetStencilCompareMask @@ -295,9 +265,6 @@ void MVKCmdSetStencilCompareMask::encode(MVKCommandEncoder* cmdEncoder) { cmdEncoder->_depthStencilState.setStencilCompareMask(_faceMask, _stencilCompareMask); } -MVKCmdSetStencilCompareMask::MVKCmdSetStencilCompareMask(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - #pragma mark - #pragma mark MVKCmdSetStencilWriteMask @@ -317,9 +284,6 @@ void MVKCmdSetStencilWriteMask::encode(MVKCommandEncoder* cmdEncoder) { cmdEncoder->_depthStencilState.setStencilWriteMask(_faceMask, _stencilWriteMask); } -MVKCmdSetStencilWriteMask::MVKCmdSetStencilWriteMask(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - #pragma mark - #pragma mark MVKCmdSetStencilReference @@ -339,6 +303,3 @@ void MVKCmdSetStencilReference::encode(MVKCommandEncoder* cmdEncoder) { cmdEncoder->_stencilReferenceValueState.setReferenceValues(_faceMask, _stencilReference); } -MVKCmdSetStencilReference::MVKCmdSetStencilReference(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdTransfer.h b/MoltenVK/MoltenVK/Commands/MVKCmdTransfer.h index 7f0d8ea9..1f73921d 100644 --- a/MoltenVK/MoltenVK/Commands/MVKCmdTransfer.h +++ b/MoltenVK/MoltenVK/Commands/MVKCmdTransfer.h @@ -48,9 +48,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdCopyImage(MVKCommandTypePool* pool) : - MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; VkResult setContent(MVKCommandBuffer* cmdBuff, @@ -111,7 +108,7 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdBlitImage(MVKCommandTypePool* pool); + MVKCmdBlitImage(); ~MVKCmdBlitImage() override; @@ -152,7 +149,7 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdResolveImage(MVKCommandTypePool* pool); + MVKCmdResolveImage(); ~MVKCmdResolveImage() override; @@ -190,9 +187,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdCopyBuffer(MVKCommandTypePool* pool) : - MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -219,9 +213,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdBufferImageCopy(MVKCommandTypePool* pool) : - MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; bool isArrayTexture(); @@ -249,9 +240,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdClearAttachments(MVKCommandTypePool* pool) : - MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; void populateVertices(float attWidth, float attHeight); @@ -285,9 +273,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdClearImage(MVKCommandTypePool* pool) : - MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; uint32_t populateMetalCopyRegions(const VkImageBlit* pRegion, uint32_t cpyRgnIdx); @@ -319,9 +304,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdFillBuffer(MVKCommandTypePool* pool) : - MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; @@ -347,9 +329,6 @@ public: void encode(MVKCommandEncoder* cmdEncoder) override; - MVKCmdUpdateBuffer(MVKCommandTypePool* pool) : - MVKCommand::MVKCommand((MVKCommandTypePool*)pool) {} - protected: MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) override; diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdTransfer.mm b/MoltenVK/MoltenVK/Commands/MVKCmdTransfer.mm index c5a2d556..5af4cae5 100644 --- a/MoltenVK/MoltenVK/Commands/MVKCmdTransfer.mm +++ b/MoltenVK/MoltenVK/Commands/MVKCmdTransfer.mm @@ -205,7 +205,7 @@ void MVKCmdCopyImage::encode(MVKCommandEncoder* cmdEncoder) { tempBuffData.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT; MVKBuffer* tempBuff = cmdEncoder->getCommandEncodingPool()->getTransferMVKBuffer(tempBuffData); - MVKCmdBufferImageCopy cpyCmd(&cmdEncoder->_cmdBuffer->getCommandPool()->_cmdBufferImageCopyPool); + MVKCmdBufferImageCopy cpyCmd; // Copy from source image to buffer // Create and execute a temporary buffer image command. @@ -428,9 +428,7 @@ void MVKCmdBlitImage::encode(MVKCommandEncoder* cmdEncoder) { #pragma mark Construction -MVKCmdBlitImage::MVKCmdBlitImage(MVKCommandTypePool* pool) - : MVKCmdCopyImage::MVKCmdCopyImage((MVKCommandTypePool*)pool) { - +MVKCmdBlitImage::MVKCmdBlitImage() { initMTLRenderPassDescriptor(); } @@ -582,7 +580,7 @@ void MVKCmdResolveImage::encode(MVKCommandEncoder* cmdEncoder) { // To be threadsafe...do NOT acquire and return the command from the pool. uint32_t expRgnCnt = uint32_t(_expansionRegions.size()); if (expRgnCnt > 0) { - MVKCmdBlitImage expandCmd(&cmdEncoder->_cmdBuffer->getCommandPool()->_cmdBlitImagePool); + MVKCmdBlitImage expandCmd; expandCmd.setContent(cmdEncoder->_cmdBuffer, (VkImage)_dstImage, _dstLayout, (VkImage)xfrImage, _dstLayout, expRgnCnt, _expansionRegions.data(), @@ -595,7 +593,7 @@ void MVKCmdResolveImage::encode(MVKCommandEncoder* cmdEncoder) { // To be threadsafe...do NOT acquire and return the command from the pool. uint32_t cpyRgnCnt = uint32_t(_copyRegions.size()); if (cpyRgnCnt > 0) { - MVKCmdCopyImage copyCmd(&cmdEncoder->_cmdBuffer->getCommandPool()->_cmdCopyImagePool); + MVKCmdCopyImage copyCmd; copyCmd.setContent(cmdEncoder->_cmdBuffer, (VkImage)_srcImage, _srcLayout, (VkImage)xfrImage, _dstLayout, cpyRgnCnt, _copyRegions.data(), kMVKCommandUseResolveCopyImage); @@ -624,9 +622,7 @@ void MVKCmdResolveImage::encode(MVKCommandEncoder* cmdEncoder) { } } -MVKCmdResolveImage::MVKCmdResolveImage(MVKCommandTypePool* pool) - : MVKCommand::MVKCommand((MVKCommandTypePool*)pool) { - +MVKCmdResolveImage::MVKCmdResolveImage() { initMTLRenderPassDescriptor(); } diff --git a/MoltenVK/MoltenVK/Commands/MVKCommand.h b/MoltenVK/MoltenVK/Commands/MVKCommand.h index 7a294dc5..29564e98 100644 --- a/MoltenVK/MoltenVK/Commands/MVKCommand.h +++ b/MoltenVK/MoltenVK/Commands/MVKCommand.h @@ -24,8 +24,26 @@ class MVKCommandBuffer; class MVKCommandEncoder; class MVKCommandPool; -//class MVKCommandEncodingPool; -template class MVKCommandTypePool; + + +#pragma mark - +#pragma mark MVKCommandTypePool + +/** A pool of MVKCommand instances of a particular type. */ +template +class MVKCommandTypePool : public MVKObjectPool { + +public: + + /** Returns the Vulkan API opaque object controlling this object. */ + MVKVulkanAPIObject* getVulkanAPIObject() override { return nullptr; } + + /** Returns a new command instance. */ + T* newObject() override { return new T(); } + + MVKCommandTypePool(bool isPooling = true) : MVKObjectPool(isPooling) {} + +}; #pragma mark - @@ -34,8 +52,8 @@ template class MVKCommandTypePool; /** * Abstract class that represents a Vulkan command. * - * To allow the command contents to be populated, all concrete - * subclasses must support a member function of the following form: + * To allow command contents to be populated in a standard way, all concrete + * subclasses must support a public member function of the following form: * * VkResult setContent(MVKCommandBuffer* cmdBuff, ...); */ @@ -49,23 +67,9 @@ public: /** Encodes this command on the specified command encoder. */ virtual void encode(MVKCommandEncoder* cmdEncoder) = 0; - /** - * Returns this object back to the type pool associated with the subclass type, - * contained in the command pool. - * - * This method is not thread-safe. Vulkan Command Pools are externally synchronized. - * For a particular MVKCommandTypePool instance, all calls to pool->aquireObject(), - * and returnToPool() (or pool->returnObject()), MUST be called from the same thread. - * - * Do not call this function if a subclass instance has been created inline to - * perform a transient sub-command operation. Instead, let the instance be destroyed - * automatically at the end of the inline scope, as usual for inline instantiation. - */ - void returnToPool(MVKCommandPool* cmdPool); - - MVKCommand(MVKCommandTypePool* pool) {} - protected: + friend MVKCommandBuffer; + virtual MVKCommandTypePool* getTypePool(MVKCommandPool* cmdPool) = 0; // Macro to implement a subclass override of the getTypePool(MVKCommandPool* cmdPool) function. @@ -76,43 +80,6 @@ protected: }; -#pragma mark - -#pragma mark MVKCommandTypePool - -/** - * Static function for MVKCommandTypePool template to call to resolve its own getVulkanAPIObject() - * from its MVKCommandPool. Needed because MVKCommandTypePool template cannot have a function - * implementation outside the template, and MVKCommandPool is not fully defined in this header file. - */ -MVKVulkanAPIObject* mvkCommandPoolGetVulkanAPIObject(MVKCommandPool* cmdPool); - - -/** A pool of MVKCommand instances of a particular type. */ -template -class MVKCommandTypePool : public MVKObjectPool { - -public: - - /** Returns the Vulkan API opaque object controlling this object. */ - MVKVulkanAPIObject* getVulkanAPIObject() override { return mvkCommandPoolGetVulkanAPIObject(_commandPool); }; - - /** Some commands require access to the command pool to access resources. */ - MVKCommandPool* getCommandPool() { return _commandPool; } - - /** Returns a new command instance. */ - T* newObject() override { return new T(this); } - - /** - * Configures this instance to either use pooling, or not, depending on the - * value of isPooling, which defaults to true if not indicated explicitly. - */ - MVKCommandTypePool(MVKCommandPool* cmdPool, bool isPooling = true) : MVKObjectPool(isPooling), _commandPool(cmdPool) {} - -protected: - MVKCommandPool* _commandPool; -}; - - #pragma mark - #pragma mark MVKLoadStoreOverrideMixin diff --git a/MoltenVK/MoltenVK/Commands/MVKCommand.mm b/MoltenVK/MoltenVK/Commands/MVKCommand.mm deleted file mode 100644 index 67fcaafd..00000000 --- a/MoltenVK/MoltenVK/Commands/MVKCommand.mm +++ /dev/null @@ -1,33 +0,0 @@ -/* - * MVKCommand.mm - * - * Copyright (c) 2015-2020 The Brenwill Workshop Ltd. (http://www.brenwill.com) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "MVKCommand.h" -#include "MVKCommandPool.h" - - -#pragma mark - -#pragma mark MVKCommand - -void MVKCommand::returnToPool(MVKCommandPool* cmdPool) { getTypePool(cmdPool)->returnObject(this); } - - -#pragma mark - -#pragma mark MVKCommandTypePool - -MVKVulkanAPIObject* mvkCommandPoolGetVulkanAPIObject(MVKCommandPool* cmdPool) { return cmdPool->getVulkanAPIObject(); } - diff --git a/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm b/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm index f3530f2c..ec6dbae3 100644 --- a/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm +++ b/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm @@ -58,7 +58,7 @@ void MVKCommandBuffer::releaseCommands() { MVKCommand* cmd = _head; while (cmd) { MVKCommand* nextCmd = cmd->_next; // Establish next before returning current to pool. - cmd->returnToPool(getCommandPool()); + (cmd->getTypePool(getCommandPool()))->returnObject(cmd); cmd = nextCmd; } _head = nullptr; @@ -421,7 +421,7 @@ void MVKCommandEncoder::clearRenderArea() { // Create and execute a temporary clear attachments command. // To be threadsafe...do NOT acquire and return the command from the pool. - MVKCmdClearAttachments cmd(&_cmdBuffer->getCommandPool()->_cmdClearAttachmentsPool); + MVKCmdClearAttachments cmd; cmd.setContent(_cmdBuffer, clearAttCnt, clearAtts.data(), 1, &clearRect); cmd.encode(this); } diff --git a/MoltenVK/MoltenVK/Commands/MVKCommandPool.mm b/MoltenVK/MoltenVK/Commands/MVKCommandPool.mm index 483770b1..c59f5ce9 100644 --- a/MoltenVK/MoltenVK/Commands/MVKCommandPool.mm +++ b/MoltenVK/MoltenVK/Commands/MVKCommandPool.mm @@ -140,52 +140,52 @@ MVKCommandPool::MVKCommandPool(MVKDevice* device, _queueFamilyIndex(pCreateInfo->queueFamilyIndex), _commandBufferPool(device, usePooling), _commandEncodingPool(this), - _cmdPipelineBarrierPool(this, usePooling), - _cmdBindPipelinePool(this, usePooling), - _cmdBeginRenderPassPool(this, usePooling), - _cmdNextSubpassPool(this, usePooling), - _cmdExecuteCommandsPool(this, usePooling), - _cmdEndRenderPassPool(this, usePooling), - _cmdBindDescriptorSetsPool(this, usePooling), - _cmdSetViewportPool(this, usePooling), - _cmdSetScissorPool(this, usePooling), - _cmdSetLineWidthPool(this, usePooling), - _cmdSetDepthBiasPool(this, usePooling), - _cmdSetBlendConstantsPool(this, usePooling), - _cmdSetDepthBoundsPool(this, usePooling), - _cmdSetStencilCompareMaskPool(this, usePooling), - _cmdSetStencilWriteMaskPool(this, usePooling), - _cmdSetStencilReferencePool(this, usePooling), - _cmdBindVertexBuffersPool(this, usePooling), - _cmdBindIndexBufferPool(this, usePooling), - _cmdDrawPool(this, usePooling), - _cmdDrawIndexedPool(this, usePooling), - _cmdDrawIndirectPool(this, usePooling), - _cmdDrawIndexedIndirectPool(this, usePooling), - _cmdCopyImagePool(this, usePooling), - _cmdBlitImagePool(this, usePooling), - _cmdResolveImagePool(this, usePooling), - _cmdFillBufferPool(this, usePooling), - _cmdUpdateBufferPool(this, usePooling), - _cmdCopyBufferPool(this, usePooling), - _cmdBufferImageCopyPool(this, usePooling), - _cmdClearAttachmentsPool(this, usePooling), - _cmdClearImagePool(this, usePooling), - _cmdBeginQueryPool(this, usePooling), - _cmdEndQueryPool(this, usePooling), - _cmdWriteTimestampPool(this, usePooling), - _cmdResetQueryPoolPool(this, usePooling), - _cmdCopyQueryPoolResultsPool(this, usePooling), - _cmdPushConstantsPool(this, usePooling), - _cmdDispatchPool(this, usePooling), - _cmdDispatchIndirectPool(this, usePooling), - _cmdPushDescriptorSetPool(this, usePooling), - _cmdPushDescriptorSetWithTemplatePool(this, usePooling), - _cmdDebugMarkerBeginPool(this, usePooling), - _cmdDebugMarkerEndPool(this, usePooling), - _cmdDebugMarkerInsertPool(this, usePooling), - _cmdSetResetEventPool(this, usePooling), - _cmdWaitEventsPool(this, usePooling) + _cmdPipelineBarrierPool(usePooling), + _cmdBindPipelinePool(usePooling), + _cmdBeginRenderPassPool(usePooling), + _cmdNextSubpassPool(usePooling), + _cmdExecuteCommandsPool(usePooling), + _cmdEndRenderPassPool(usePooling), + _cmdBindDescriptorSetsPool(usePooling), + _cmdSetViewportPool(usePooling), + _cmdSetScissorPool(usePooling), + _cmdSetLineWidthPool(usePooling), + _cmdSetDepthBiasPool(usePooling), + _cmdSetBlendConstantsPool(usePooling), + _cmdSetDepthBoundsPool(usePooling), + _cmdSetStencilCompareMaskPool(usePooling), + _cmdSetStencilWriteMaskPool(usePooling), + _cmdSetStencilReferencePool(usePooling), + _cmdBindVertexBuffersPool(usePooling), + _cmdBindIndexBufferPool(usePooling), + _cmdDrawPool(usePooling), + _cmdDrawIndexedPool(usePooling), + _cmdDrawIndirectPool(usePooling), + _cmdDrawIndexedIndirectPool(usePooling), + _cmdCopyImagePool(usePooling), + _cmdBlitImagePool(usePooling), + _cmdResolveImagePool(usePooling), + _cmdFillBufferPool(usePooling), + _cmdUpdateBufferPool(usePooling), + _cmdCopyBufferPool(usePooling), + _cmdBufferImageCopyPool(usePooling), + _cmdClearAttachmentsPool(usePooling), + _cmdClearImagePool(usePooling), + _cmdBeginQueryPool(usePooling), + _cmdEndQueryPool(usePooling), + _cmdWriteTimestampPool(usePooling), + _cmdResetQueryPoolPool(usePooling), + _cmdCopyQueryPoolResultsPool(usePooling), + _cmdPushConstantsPool(usePooling), + _cmdDispatchPool(usePooling), + _cmdDispatchIndirectPool(usePooling), + _cmdPushDescriptorSetPool(usePooling), + _cmdPushDescriptorSetWithTemplatePool(usePooling), + _cmdDebugMarkerBeginPool(usePooling), + _cmdDebugMarkerEndPool(usePooling), + _cmdDebugMarkerInsertPool(usePooling), + _cmdSetResetEventPool(usePooling), + _cmdWaitEventsPool(usePooling) // when extending be sure to add to trim() as well {}