Add MVKCmdBeginRenderPass template specializations for 2 framebuffer attachments.
diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.h b/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.h
index 858473b..8a66785 100644
--- a/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.h
+++ b/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.h
@@ -89,9 +89,13 @@
typedef MVKCmdBeginRenderPass<2, 1> MVKCmdBeginRenderPass21;
typedef MVKCmdBeginRenderPass<9, 1> MVKCmdBeginRenderPassMulti1;
-typedef MVKCmdBeginRenderPass<1, 8> MVKCmdBeginRenderPass1Multi;
-typedef MVKCmdBeginRenderPass<2, 8> MVKCmdBeginRenderPass2Multi;
-typedef MVKCmdBeginRenderPass<9, 8> MVKCmdBeginRenderPassMultiMulti;
+typedef MVKCmdBeginRenderPass<1, 2> MVKCmdBeginRenderPass12;
+typedef MVKCmdBeginRenderPass<2, 2> MVKCmdBeginRenderPass22;
+typedef MVKCmdBeginRenderPass<9, 2> MVKCmdBeginRenderPassMulti2;
+
+typedef MVKCmdBeginRenderPass<1, 9> MVKCmdBeginRenderPass1Multi;
+typedef MVKCmdBeginRenderPass<2, 9> MVKCmdBeginRenderPass2Multi;
+typedef MVKCmdBeginRenderPass<9, 9> MVKCmdBeginRenderPassMultiMulti;
#pragma mark -
diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.mm b/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.mm
index 0811310..4fc1146 100644
--- a/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.mm
+++ b/MoltenVK/MoltenVK/Commands/MVKCmdRenderPass.mm
@@ -46,8 +46,8 @@
template <size_t N_CV, size_t N_A>
VkResult MVKCmdBeginRenderPass<N_CV, N_A>::setContent(MVKCommandBuffer* cmdBuff,
- const VkRenderPassBeginInfo* pRenderPassBegin,
- VkSubpassContents contents) {
+ const VkRenderPassBeginInfo* pRenderPassBegin,
+ VkSubpassContents contents) {
MVKCmdBeginRenderPassBase::setContent(cmdBuff, pRenderPassBegin, contents);
// Add clear values
@@ -85,8 +85,8 @@
template <size_t N_CV, size_t N_A>
VkResult MVKCmdBeginRenderPass<N_CV, N_A>::setContent(MVKCommandBuffer* cmdBuff,
- const VkRenderPassBeginInfo* pRenderPassBegin,
- const VkSubpassBeginInfo* pSubpassBeginInfo) {
+ const VkRenderPassBeginInfo* pRenderPassBegin,
+ const VkSubpassBeginInfo* pSubpassBeginInfo) {
return setContent(cmdBuff, pRenderPassBegin, pSubpassBeginInfo->contents);
}
@@ -111,10 +111,13 @@
template class MVKCmdBeginRenderPass<2, 1>;
template class MVKCmdBeginRenderPass<9, 1>;
-template class MVKCmdBeginRenderPass<1, 8>;
-template class MVKCmdBeginRenderPass<2, 8>;
-template class MVKCmdBeginRenderPass<9, 8>;
+template class MVKCmdBeginRenderPass<1, 2>;
+template class MVKCmdBeginRenderPass<2, 2>;
+template class MVKCmdBeginRenderPass<9, 2>;
+template class MVKCmdBeginRenderPass<1, 9>;
+template class MVKCmdBeginRenderPass<2, 9>;
+template class MVKCmdBeginRenderPass<9, 9>;
#pragma mark -
#pragma mark MVKCmdNextSubpass
diff --git a/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm b/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm
index a0aa4cb..125e122 100644
--- a/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm
+++ b/MoltenVK/MoltenVK/Commands/MVKCommandBuffer.mm
@@ -568,6 +568,8 @@
endMetalRenderEncoding();
_renderPass = nullptr;
+ _framebufferExtent = {};
+ _framebufferLayerCount = 0;
_attachments.clear();
_renderSubpassIndex = 0;
}
diff --git a/MoltenVK/MoltenVK/Commands/MVKCommandTypePools.def b/MoltenVK/MoltenVK/Commands/MVKCommandTypePools.def
index 6f74ed4..a6966f4 100644
--- a/MoltenVK/MoltenVK/Commands/MVKCommandTypePools.def
+++ b/MoltenVK/MoltenVK/Commands/MVKCommandTypePools.def
@@ -56,21 +56,26 @@
MVK_TMPLT_DECL MVK_CMD_TYPE_POOL(cmdType ##threshold3) \
MVK_TMPLT_DECL MVK_CMD_TYPE_POOL(cmdType ##Multi)
-#define MVK_CMD_TYPE_POOLS_FROM_4_THRESHOLDS(cmdType, arg1Threshold1, arg1Threshold2, arg2Threshold1, arg2Threshold2) \
- MVK_TMPLT_DECL MVK_CMD_TYPE_POOL(cmdType ##arg1Threshold1 ##arg2Threshold1) \
- MVK_TMPLT_DECL MVK_CMD_TYPE_POOL(cmdType ##arg1Threshold1 ##arg2Threshold2) \
- MVK_TMPLT_DECL MVK_CMD_TYPE_POOL(cmdType ##arg1Threshold1 ##Multi) \
- MVK_TMPLT_DECL MVK_CMD_TYPE_POOL(cmdType ##arg1Threshold2 ##arg2Threshold1) \
- MVK_TMPLT_DECL MVK_CMD_TYPE_POOL(cmdType ##arg1Threshold2 ##arg2Threshold2) \
- MVK_TMPLT_DECL MVK_CMD_TYPE_POOL(cmdType ##arg1Threshold2 ##Multi) \
- MVK_TMPLT_DECL MVK_CMD_TYPE_POOL(cmdType ##Multi ##arg2Threshold1) \
- MVK_TMPLT_DECL MVK_CMD_TYPE_POOL(cmdType ##Multi ##arg2Threshold2) \
+#define MVK_CMD_TYPE_POOLS_FROM_5_THRESHOLDS(cmdType, \
+ arg1Threshold1, arg1Threshold2, \
+ arg2Threshold1, arg2Threshold2, arg2Threshold3) \
+ MVK_TMPLT_DECL MVK_CMD_TYPE_POOL(cmdType ##arg1Threshold1 ##arg2Threshold1) \
+ MVK_TMPLT_DECL MVK_CMD_TYPE_POOL(cmdType ##arg1Threshold1 ##arg2Threshold2) \
+ MVK_TMPLT_DECL MVK_CMD_TYPE_POOL(cmdType ##arg1Threshold1 ##arg2Threshold3) \
+ MVK_TMPLT_DECL MVK_CMD_TYPE_POOL(cmdType ##arg1Threshold1 ##Multi) \
+ MVK_TMPLT_DECL MVK_CMD_TYPE_POOL(cmdType ##arg1Threshold2 ##arg2Threshold1) \
+ MVK_TMPLT_DECL MVK_CMD_TYPE_POOL(cmdType ##arg1Threshold2 ##arg2Threshold2) \
+ MVK_TMPLT_DECL MVK_CMD_TYPE_POOL(cmdType ##arg1Threshold2 ##arg2Threshold3) \
+ MVK_TMPLT_DECL MVK_CMD_TYPE_POOL(cmdType ##arg1Threshold2 ##Multi) \
+ MVK_TMPLT_DECL MVK_CMD_TYPE_POOL(cmdType ##Multi ##arg2Threshold1) \
+ MVK_TMPLT_DECL MVK_CMD_TYPE_POOL(cmdType ##Multi ##arg2Threshold2) \
+ MVK_TMPLT_DECL MVK_CMD_TYPE_POOL(cmdType ##Multi ##arg2Threshold3) \
MVK_TMPLT_DECL MVK_CMD_TYPE_POOL(cmdType ##Multi ##Multi)
MVK_CMD_TYPE_POOLS_FROM_2_THRESHOLDS(PipelineBarrier, 1, 4)
MVK_CMD_TYPE_POOL(BindGraphicsPipeline)
MVK_CMD_TYPE_POOL(BindComputePipeline)
-MVK_CMD_TYPE_POOLS_FROM_4_THRESHOLDS(BeginRenderPass, 1, 2, 0, 1)
+MVK_CMD_TYPE_POOLS_FROM_5_THRESHOLDS(BeginRenderPass, 1, 2, 0, 1, 2)
MVK_CMD_TYPE_POOL(NextSubpass)
MVK_CMD_TYPE_POOL(EndRenderPass)
MVK_CMD_TYPE_POOLS_FROM_THRESHOLD(ExecuteCommands, 1)
diff --git a/MoltenVK/MoltenVK/Vulkan/vulkan.mm b/MoltenVK/MoltenVK/Vulkan/vulkan.mm
index d9070f7..60fc694 100644
--- a/MoltenVK/MoltenVK/Vulkan/vulkan.mm
+++ b/MoltenVK/MoltenVK/Vulkan/vulkan.mm
@@ -132,24 +132,31 @@
}
// Add one of nine commands, based on comparing a command parameter against four threshold values
-#define MVKAddCmdFrom4Thresholds(baseCmdType, value1, arg1Threshold1, arg1Threshold2, \
- value2, arg2Threshold1, arg2Threshold2, vkCmdBuff, ...) \
+#define MVKAddCmdFrom5Thresholds(baseCmdType, value1, arg1Threshold1, arg1Threshold2, \
+ value2, arg2Threshold1, arg2Threshold2, arg2Threshold3, \
+ vkCmdBuff, ...) \
if (value1 <= arg1Threshold1 && value2 <= arg2Threshold1) { \
- MVKAddCmd(baseCmdType ##arg1Threshold1 ##arg2Threshold1, vkCmdBuff, ##__VA_ARGS__); \
- } else if (value1 <= arg1Threshold2 && value2 <= arg2Threshold1) { \
- MVKAddCmd(baseCmdType ##arg1Threshold1 ##arg2Threshold1, vkCmdBuff, ##__VA_ARGS__); \
- } else if (value1 > arg1Threshold2 && value2 <= arg2Threshold1) { \
- MVKAddCmd(baseCmdType ##Multi ##arg2Threshold1, vkCmdBuff, ##__VA_ARGS__); \
- } else if (value1 <= arg1Threshold1 && value2 <= arg2Threshold2) { \
- MVKAddCmd(baseCmdType ##arg1Threshold1 ##arg2Threshold2, vkCmdBuff, ##__VA_ARGS__); \
- } else if (value1 <= arg1Threshold2 && value2 <= arg2Threshold2) { \
- MVKAddCmd(baseCmdType ##arg1Threshold2 ##arg2Threshold2, vkCmdBuff, ##__VA_ARGS__); \
- } else if (value1 > arg1Threshold2 && value2 <= arg2Threshold2) { \
- MVKAddCmd(baseCmdType ##Multi ##arg2Threshold2, vkCmdBuff, ##__VA_ARGS__); \
- } else if (value1 <= arg1Threshold1 && value2 > arg2Threshold2) { \
- MVKAddCmd(baseCmdType ##arg1Threshold1 ##Multi, vkCmdBuff, ##__VA_ARGS__); \
- } else if (value1 <= arg1Threshold2 && value2 > arg2Threshold2) { \
- MVKAddCmd(baseCmdType ##arg1Threshold2 ##Multi, vkCmdBuff, ##__VA_ARGS__); \
+ MVKAddCmd(baseCmdType ##arg1Threshold1 ##arg2Threshold1, vkCmdBuff, ##__VA_ARGS__); \
+ } else if (value1 <= arg1Threshold2 && value2 <= arg2Threshold1) { \
+ MVKAddCmd(baseCmdType ##arg1Threshold1 ##arg2Threshold1, vkCmdBuff, ##__VA_ARGS__); \
+ } else if (value1 > arg1Threshold2 && value2 <= arg2Threshold1) { \
+ MVKAddCmd(baseCmdType ##Multi ##arg2Threshold1, vkCmdBuff, ##__VA_ARGS__); \
+ } else if (value1 <= arg1Threshold1 && value2 <= arg2Threshold2) { \
+ MVKAddCmd(baseCmdType ##arg1Threshold1 ##arg2Threshold2, vkCmdBuff, ##__VA_ARGS__); \
+ } else if (value1 <= arg1Threshold2 && value2 <= arg2Threshold2) { \
+ MVKAddCmd(baseCmdType ##arg1Threshold2 ##arg2Threshold2, vkCmdBuff, ##__VA_ARGS__); \
+ } else if (value1 > arg1Threshold2 && value2 <= arg2Threshold2) { \
+ MVKAddCmd(baseCmdType ##Multi ##arg2Threshold2, vkCmdBuff, ##__VA_ARGS__); \
+ } else if (value1 <= arg1Threshold1 && value2 <= arg2Threshold3) { \
+ MVKAddCmd(baseCmdType ##arg1Threshold1 ##arg2Threshold3, vkCmdBuff, ##__VA_ARGS__); \
+ } else if (value1 <= arg1Threshold2 && value2 <= arg2Threshold3) { \
+ MVKAddCmd(baseCmdType ##arg1Threshold2 ##arg2Threshold3, vkCmdBuff, ##__VA_ARGS__); \
+ } else if (value1 > arg1Threshold2 && value2 <= arg2Threshold3) { \
+ MVKAddCmd(baseCmdType ##Multi ##arg2Threshold3, vkCmdBuff, ##__VA_ARGS__); \
+ } else if (value1 <= arg1Threshold1 && value2 > arg2Threshold3) { \
+ MVKAddCmd(baseCmdType ##arg1Threshold1 ##Multi, vkCmdBuff, ##__VA_ARGS__); \
+ } else if (value1 <= arg1Threshold2 && value2 > arg2Threshold3) { \
+ MVKAddCmd(baseCmdType ##arg1Threshold2 ##Multi, vkCmdBuff, ##__VA_ARGS__); \
} else { \
MVKAddCmd(baseCmdType ##Multi ##Multi, vkCmdBuff, ##__VA_ARGS__); \
}
@@ -1904,9 +1911,9 @@
break;
}
}
- MVKAddCmdFrom4Thresholds(BeginRenderPass,
+ MVKAddCmdFrom5Thresholds(BeginRenderPass,
pRenderPassBegin->clearValueCount, 1, 2,
- attachmentCount, 0, 1,
+ attachmentCount, 0, 1, 2,
commandBuffer,
pRenderPassBegin,
contents);
@@ -2335,9 +2342,9 @@
break;
}
}
- MVKAddCmdFrom4Thresholds(BeginRenderPass,
+ MVKAddCmdFrom5Thresholds(BeginRenderPass,
pRenderPassBegin->clearValueCount, 1, 2,
- attachmentCount, 0, 1,
+ attachmentCount, 0, 1, 2,
commandBuffer,
pRenderPassBegin,
pSubpassBeginInfo);