Use MVKSmallVector for pipeline stages.
Remove getStages() from MVKPipeline and MVKComputePipeline,
as it applies only to graphics pipelines.
diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdDraw.mm b/MoltenVK/MoltenVK/Commands/MVKCmdDraw.mm
index 26f833e..14abfc7 100644
--- a/MoltenVK/MoltenVK/Commands/MVKCmdDraw.mm
+++ b/MoltenVK/MoltenVK/Commands/MVKCmdDraw.mm
@@ -108,7 +108,7 @@
auto* pipeline = (MVKGraphicsPipeline*)cmdEncoder->_graphicsPipelineState.getPipeline();
- MVKVectorInline<uint32_t, 4> stages;
+ MVKPiplineStages stages;
pipeline->getStages(stages);
const MVKMTLBufferAllocation* vtxOutBuff = nullptr;
@@ -302,7 +302,7 @@
auto* pipeline = (MVKGraphicsPipeline*)cmdEncoder->_graphicsPipelineState.getPipeline();
- MVKVectorInline<uint32_t, 4> stages;
+ MVKPiplineStages stages;
pipeline->getStages(stages);
MVKIndexMTLBufferBinding& ibb = cmdEncoder->_graphicsResourcesState._mtlIndexBufferBinding;
@@ -588,7 +588,7 @@
}
}
- MVKVectorInline<uint32_t, 4> stages;
+ MVKPiplineStages stages;
pipeline->getStages(stages);
VkDeviceSize mtlIndBuffOfst = _mtlIndirectBufferOffset;
@@ -816,7 +816,7 @@
tcIndexBuff = cmdEncoder->getTempMTLBuffer(patchCount * outControlPointCount * idxSize);
}
- MVKVectorInline<uint32_t, 4> stages;
+ MVKPiplineStages stages;
pipeline->getStages(stages);
VkDeviceSize mtlIndBuffOfst = _mtlIndirectBufferOffset;
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.h b/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.h
index 14e1be2..8f53dd5 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.h
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.h
@@ -22,7 +22,7 @@
#include "MVKDescriptorSet.h"
#include "MVKShaderModule.h"
#include "MVKSync.h"
-#include "MVKVector.h"
+#include "MVKSmallVector.h"
#include <MoltenVKSPIRVToMSLConverter/SPIRVReflection.h>
#include <MoltenVKSPIRVToMSLConverter/SPIRVToMSLConverter.h>
#include <unordered_set>
@@ -143,9 +143,6 @@
/** Returns the debug report object type of this object. */
VkDebugReportObjectTypeEXT getVkDebugReportObjectType() override { return VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT; }
- /** Returns the order of stages in this pipeline. Draws and dispatches must encode this pipeline once per stage. */
- virtual void getStages(MVKVector<uint32_t>& stages) = 0;
-
/** Binds this pipeline to the specified command encoder. */
virtual void encode(MVKCommandEncoder* cmdEncoder, uint32_t stage = 0) = 0;
@@ -187,6 +184,8 @@
#pragma mark -
#pragma mark MVKGraphicsPipeline
+typedef MVKSmallVector<MVKGraphicsStage, 4> MVKPiplineStages;
+
/** The number of dynamic states possible in Vulkan. */
static const uint32_t kMVKVkDynamicStateCount = 32;
@@ -195,8 +194,8 @@
public:
- /** Returns the number and order of stages in this pipeline. Draws and dispatches must encode this pipeline once per stage. */
- void getStages(MVKVector<uint32_t>& stages) override;
+ /** Returns the number and order of stages in this pipeline. Draws commands must encode this pipeline once per stage. */
+ void getStages(MVKPiplineStages& stages);
/** Binds this pipeline to the specified command encoder. */
void encode(MVKCommandEncoder* cmdEncoder, uint32_t stage = 0) override;
@@ -316,9 +315,6 @@
public:
- /** Returns the number and order of stages in this pipeline. Draws and dispatches must encode this pipeline once per stage. */
- void getStages(MVKVector<uint32_t>& stages) override;
-
/** Binds this pipeline to the specified command encoder. */
void encode(MVKCommandEncoder* cmdEncoder, uint32_t = 0) override;
diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm b/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm
index 394b6dd..912159e 100644
--- a/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm
+++ b/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm
@@ -176,7 +176,7 @@
#pragma mark -
#pragma mark MVKGraphicsPipeline
-void MVKGraphicsPipeline::getStages(MVKVector<uint32_t>& stages) {
+void MVKGraphicsPipeline::getStages(MVKPiplineStages& stages) {
if (isTessellationPipeline()) {
stages.push_back(kMVKGraphicsStageVertex);
stages.push_back(kMVKGraphicsStageTessControl);
@@ -1288,10 +1288,6 @@
#pragma mark -
#pragma mark MVKComputePipeline
-void MVKComputePipeline::getStages(MVKVector<uint32_t>& stages) {
- stages.push_back(0);
-}
-
void MVKComputePipeline::encode(MVKCommandEncoder* cmdEncoder, uint32_t) {
if ( !_hasValidMTLPipelineStates ) { return; }