Reduce memory requirements for MVKCmdPushConstants and MVKCmdPushDescriptorSet.

MVKCmdPushConstants convert to a template class based on push constant size.
MVKCmdPushDescriptorSet reduce count of pre-allocated VkWriteDescriptorSets,
in recognition that numerous dynamic allocations necessarily happen anyway.
Cleanup member variable order in commands to avoid internal memory gaps.
diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdPipeline.h b/MoltenVK/MoltenVK/Commands/MVKCmdPipeline.h
index ec12615..53d01e4 100644
--- a/MoltenVK/MoltenVK/Commands/MVKCmdPipeline.h
+++ b/MoltenVK/MoltenVK/Commands/MVKCmdPipeline.h
@@ -190,7 +190,11 @@
 #pragma mark -
 #pragma mark MVKCmdPushConstants
 
-/** Vulkan command to bind push constants. */
+/**
+ * Vulkan command to bind push constants.
+ * Template class to balance vector pre-allocations between very common low counts and fewer larger counts.
+ */
+template <size_t N>
 class MVKCmdPushConstants : public MVKCommand {
 
 public:
@@ -206,12 +210,17 @@
 protected:
 	MVKCommandTypePool<MVKCommand>* getTypePool(MVKCommandPool* cmdPool) override;
 
+	MVKVectorInline<char, N> _pushConstants;
 	MVKPipelineLayout* _pipelineLayout;
 	VkShaderStageFlags _stageFlags;
 	uint32_t _offset;
-	MVKVectorInline<char, 128> _pushConstants;
 };
 
+// Concrete template class implementations.
+typedef MVKCmdPushConstants<64> MVKCmdPushConstants64;
+typedef MVKCmdPushConstants<128> MVKCmdPushConstants128;
+typedef MVKCmdPushConstants<512> MVKCmdPushConstantsMulti;
+
 
 #pragma mark -
 #pragma mark MVKCmdPushDescriptorSet
@@ -235,9 +244,9 @@
 	MVKCommandTypePool<MVKCommand>* getTypePool(MVKCommandPool* cmdPool) override;
 	void clearDescriptorWrites();
 
-	VkPipelineBindPoint _pipelineBindPoint;
+	MVKVectorInline<VkWriteDescriptorSet, 1> _descriptorWrites;
 	MVKPipelineLayout* _pipelineLayout;
-	MVKVectorInline<VkWriteDescriptorSet, 8> _descriptorWrites;
+	VkPipelineBindPoint _pipelineBindPoint;
 	uint32_t _set;
 };
 
@@ -264,8 +273,8 @@
 
 	MVKDescriptorUpdateTemplate* _descUpdateTemplate;
 	MVKPipelineLayout* _pipelineLayout;
-	uint32_t _set;
 	void* _pData = nullptr;
+	uint32_t _set;
 };
 
 
diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdPipeline.mm b/MoltenVK/MoltenVK/Commands/MVKCmdPipeline.mm
index 1658a52..0d6dad8 100644
--- a/MoltenVK/MoltenVK/Commands/MVKCmdPipeline.mm
+++ b/MoltenVK/MoltenVK/Commands/MVKCmdPipeline.mm
@@ -253,12 +253,13 @@
 #pragma mark -
 #pragma mark MVKCmdPushConstants
 
-VkResult MVKCmdPushConstants::setContent(MVKCommandBuffer* cmdBuff,
-										 VkPipelineLayout layout,
-										 VkShaderStageFlags stageFlags,
-										 uint32_t offset,
-										 uint32_t size,
-										 const void* pValues) {
+template <size_t N>
+VkResult MVKCmdPushConstants<N>::setContent(MVKCommandBuffer* cmdBuff,
+											VkPipelineLayout layout,
+											VkShaderStageFlags stageFlags,
+											uint32_t offset,
+											uint32_t size,
+											const void* pValues) {
 	_pipelineLayout = (MVKPipelineLayout*)layout;
 	_stageFlags = stageFlags;
 	_offset = offset;
@@ -269,7 +270,8 @@
 	return VK_SUCCESS;
 }
 
-void MVKCmdPushConstants::encode(MVKCommandEncoder* cmdEncoder) {
+template <size_t N>
+void MVKCmdPushConstants<N>::encode(MVKCommandEncoder* cmdEncoder) {
     VkShaderStageFlagBits stages[] = {
         VK_SHADER_STAGE_VERTEX_BIT,
         VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT,
@@ -284,6 +286,10 @@
     }
 }
 
+template class MVKCmdPushConstants<64>;
+template class MVKCmdPushConstants<128>;
+template class MVKCmdPushConstants<512>;
+
 
 #pragma mark -
 #pragma mark MVKCmdPushDescriptorSet
diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdQueries.h b/MoltenVK/MoltenVK/Commands/MVKCmdQueries.h
index ac0d848..e76d01e 100644
--- a/MoltenVK/MoltenVK/Commands/MVKCmdQueries.h
+++ b/MoltenVK/MoltenVK/Commands/MVKCmdQueries.h
@@ -140,9 +140,9 @@
 protected:
 	MVKCommandTypePool<MVKCommand>* getTypePool(MVKCommandPool* cmdPool) override;
 
-    uint32_t _queryCount;
     MVKBuffer* _destBuffer;
     VkDeviceSize _destOffset;
     VkDeviceSize _destStride;
     VkQueryResultFlags _flags;
+	uint32_t _queryCount;
 };
diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.h b/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.h
index 22fd178..4a4eff7 100644
--- a/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.h
+++ b/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.h
@@ -48,11 +48,11 @@
 protected:
 	MVKCommandTypePool<MVKCommand>* getTypePool(MVKCommandPool* cmdPool) override;
 
+	MVKVectorInline<VkClearValue, N> _clearValues;
 	MVKRenderPass* _renderPass;
 	MVKFramebuffer* _framebuffer;
 	VkRect2D _renderArea;
 	VkSubpassContents _contents;
-	MVKVectorInline<VkClearValue, N> _clearValues;
 };
 
 // Concrete template class implementations.
@@ -146,8 +146,8 @@
 protected:
 	MVKCommandTypePool<MVKCommand>* getTypePool(MVKCommandPool* cmdPool) override;
 
-	uint32_t _firstViewport;
 	MVKVectorInline<VkViewport, N> _viewports;
+	uint32_t _firstViewport;
 };
 
 // Concrete template class implementations.
@@ -176,8 +176,8 @@
 protected:
 	MVKCommandTypePool<MVKCommand>* getTypePool(MVKCommandPool* cmdPool) override;
 
-	uint32_t _firstScissor;
 	MVKVectorInline<VkRect2D, N> _scissors;
+	uint32_t _firstScissor;
 };
 
 // Concrete template class implementations.
diff --git a/MoltenVK/MoltenVK/Commands/MVKCommandTypePools.def b/MoltenVK/MoltenVK/Commands/MVKCommandTypePools.def
index 815ed97..afdd719 100644
--- a/MoltenVK/MoltenVK/Commands/MVKCommandTypePools.def
+++ b/MoltenVK/MoltenVK/Commands/MVKCommandTypePools.def
@@ -89,7 +89,7 @@
 MVK_CMD_TYPE_POOL(WriteTimestamp)
 MVK_CMD_TYPE_POOL(ResetQueryPool)
 MVK_CMD_TYPE_POOL(CopyQueryPoolResults)
-MVK_CMD_TYPE_POOL(PushConstants)
+MVK_CMD_TYPE_POOLS_FROM_TWO_THRESHOLDS(PushConstants, 64, 128)
 MVK_CMD_TYPE_POOL(Dispatch)
 MVK_CMD_TYPE_POOL(DispatchIndirect)
 MVK_CMD_TYPE_POOL(PushDescriptorSet)
diff --git a/MoltenVK/MoltenVK/Vulkan/vulkan.mm b/MoltenVK/MoltenVK/Vulkan/vulkan.mm
index 6428509..5e63108 100644
--- a/MoltenVK/MoltenVK/Vulkan/vulkan.mm
+++ b/MoltenVK/MoltenVK/Vulkan/vulkan.mm
@@ -1832,7 +1832,7 @@
     const void*                                 pValues) {
 	
 	MVKTraceVulkanCallStart();
-	MVKAddCmd(PushConstants, commandBuffer, layout, stageFlags, offset, size, pValues);
+	MVKAddCmdFromTwoThresholds(PushConstants, size, 64, 128, commandBuffer, layout, stageFlags, offset, size, pValues);
 	MVKTraceVulkanCallEnd();
 }