Use MVKSmallVector for pipeline stages.

Remove getStages() from MVKPipeline and MVKComputePipeline,
as it applies only to graphics pipelines.
This commit is contained in:
Bill Hollings 2020-05-22 11:49:14 -04:00
parent 67dd89b66a
commit 2e91df7b21
3 changed files with 10 additions and 18 deletions

View File

@ -108,7 +108,7 @@ void MVKCmdDraw::encode(MVKCommandEncoder* cmdEncoder) {
auto* pipeline = (MVKGraphicsPipeline*)cmdEncoder->_graphicsPipelineState.getPipeline();
MVKVectorInline<uint32_t, 4> stages;
MVKPiplineStages stages;
pipeline->getStages(stages);
const MVKMTLBufferAllocation* vtxOutBuff = nullptr;
@ -302,7 +302,7 @@ void MVKCmdDrawIndexed::encode(MVKCommandEncoder* cmdEncoder) {
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 @@ void MVKCmdDrawIndirect::encode(MVKCommandEncoder* cmdEncoder) {
}
}
MVKVectorInline<uint32_t, 4> stages;
MVKPiplineStages stages;
pipeline->getStages(stages);
VkDeviceSize mtlIndBuffOfst = _mtlIndirectBufferOffset;
@ -816,7 +816,7 @@ void MVKCmdDrawIndexedIndirect::encode(MVKCommandEncoder* cmdEncoder) {
tcIndexBuff = cmdEncoder->getTempMTLBuffer(patchCount * outControlPointCount * idxSize);
}
MVKVectorInline<uint32_t, 4> stages;
MVKPiplineStages stages;
pipeline->getStages(stages);
VkDeviceSize mtlIndBuffOfst = _mtlIndirectBufferOffset;

View File

@ -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 @@ public:
/** 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 @@ protected:
#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 @@ class MVKGraphicsPipeline : public MVKPipeline {
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 @@ class MVKComputePipeline : public MVKPipeline {
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;

View File

@ -176,7 +176,7 @@ MVKPipeline::MVKPipeline(MVKDevice* device, MVKPipelineCache* pipelineCache, MVK
#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 @@ MVKGraphicsPipeline::~MVKGraphicsPipeline() {
#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; }