update vulkan.h for multi-pass command buffers (V131, #14075)
Minimal changes to keep everything building and functioning.
TODO: Need to port draw_state to use new VkAttachmentView structure.
diff --git a/layers/CMakeLists.txt b/layers/CMakeLists.txt
index 8fc23d6..958387d 100644
--- a/layers/CMakeLists.txt
+++ b/layers/CMakeLists.txt
@@ -135,7 +135,9 @@
add_vk_layer(Basic basic.cpp vk_layer_table.cpp)
add_vk_layer(Multi multi.cpp)
-add_vk_layer(DrawState draw_state.cpp vk_layer_debug_marker_table.cpp vk_layer_table.cpp)
+# TODO: Port DrawState to use VkAttachmentView structure as
+# defined in bug 14075: tiling across render passes
+#add_vk_layer(DrawState draw_state.cpp vk_layer_debug_marker_table.cpp vk_layer_table.cpp)
add_vk_layer(MemTracker mem_tracker.cpp vk_layer_table.cpp)
add_vk_layer(ShaderChecker shader_checker.cpp vk_layer_table.cpp)
add_vk_layer(Image image.cpp vk_layer_table.cpp)
diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp
index 0be0af7..cab178b 100644
--- a/layers/draw_state.cpp
+++ b/layers/draw_state.cpp
@@ -651,11 +651,36 @@
// Verify that any MSAA request in PSO matches sample# in bound FB
uint32_t psoNumSamples = getNumSamples(pipeline);
if (pCB->activeRenderPass) {
- VkRenderPassCreateInfo* pRPCI = renderPassMap[pCB->activeRenderPass];
- VkFramebufferCreateInfo* pFBCI = frameBufferMap[pCB->framebuffer];
- if ((psoNumSamples != pFBCI->sampleCount) || (psoNumSamples != pRPCI->sampleCount)) {
+ const VkRenderPassCreateInfo* pRPCI = renderPassMap[pCB->activeRenderPass];
+ const VkSubpassDescription* pSD = &pRPCI->pSubpasses[pCB->activeSubpass];
+ int subpassNumSamples = 0;
+ uint32_t i;
+
+ for (i = 0; i < pSD->colorCount; i++) {
+ uint32_t samples;
+
+ if (pSD->colorAttachments[i].attachment == VK_ATTACHMENT_UNUSED)
+ continue;
+
+ samples = pRPCI->pAttachments[pSD->colorAttachments[i].attachment].samples;
+ if (subpassNumSamples == 0) {
+ subpassNumSamples = samples;
+ } else if (subpassNumSamples != samples) {
+ subpassNumSamples = -1;
+ break;
+ }
+ }
+ if (pSD->depthStencilAttachment.attachment != VK_ATTACHMENT_UNUSED) {
+ const uint32_t samples = pRPCI->pAttachments[pSD->depthStencilAttachment.attachment].samples;
+ if (subpassNumSamples == 0)
+ subpassNumSamples = samples;
+ else if (subpassNumSamples != samples)
+ subpassNumSamples = -1;
+ }
+
+ if (psoNumSamples != subpassNumSamples) {
log_msg(mdd(pCB->cmdBuffer), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_PIPELINE, pipeline, 0, DRAWSTATE_NUM_SAMPLES_MISMATCH, "DS",
- "Num samples mismatch! Binding PSO (%p) with %u samples while current RenderPass (%p) w/ %u samples uses FB (%p) with %u samples!", (void*)pipeline, psoNumSamples, (void*)pCB->activeRenderPass, pRPCI->sampleCount, (void*)pCB->framebuffer, pFBCI->sampleCount);
+ "Num samples mismatch! Binding PSO (%p) with %u samples while current RenderPass (%p) w/ %u samples!", (void*)pipeline, psoNumSamples, (void*)pCB->activeRenderPass, subpassNumSamples);
}
} else {
// TODO : I believe it's an error if we reach this point and don't have an activeRenderPass
@@ -2523,13 +2548,9 @@
if (VK_SUCCESS == result) {
// Shadow create info and store in map
VkFramebufferCreateInfo* localFBCI = new VkFramebufferCreateInfo(*pCreateInfo);
- if (pCreateInfo->pColorAttachments) {
- localFBCI->pColorAttachments = new VkColorAttachmentBindInfo[localFBCI->colorAttachmentCount];
- memcpy((void*)localFBCI->pColorAttachments, pCreateInfo->pColorAttachments, localFBCI->colorAttachmentCount*sizeof(VkColorAttachmentBindInfo));
- }
- if (pCreateInfo->pDepthStencilAttachment) {
- localFBCI->pDepthStencilAttachment = new VkDepthStencilBindInfo[localFBCI->colorAttachmentCount];
- memcpy((void*)localFBCI->pDepthStencilAttachment, pCreateInfo->pDepthStencilAttachment, localFBCI->colorAttachmentCount*sizeof(VkDepthStencilBindInfo));
+ if (pCreateInfo->pAttachments) {
+ localFBCI->pAttachments = new VkAttachmentBindInfo[localFBCI->attachmentCount];
+ memcpy((void*)localFBCI->pAttachments, pCreateInfo->pAttachments, localFBCI->attachmentCount*sizeof(VkAttachmentBindInfo));
}
frameBufferMap[*pFramebuffer] = localFBCI;
}
@@ -2542,24 +2563,53 @@
if (VK_SUCCESS == result) {
// Shadow create info and store in map
VkRenderPassCreateInfo* localRPCI = new VkRenderPassCreateInfo(*pCreateInfo);
- if (pCreateInfo->pColorLoadOps) {
- localRPCI->pColorLoadOps = new VkAttachmentLoadOp[localRPCI->colorAttachmentCount];
- memcpy((void*)localRPCI->pColorLoadOps, pCreateInfo->pColorLoadOps, localRPCI->colorAttachmentCount*sizeof(VkAttachmentLoadOp));
+ if (pCreateInfo->pAttachments) {
+ localRPCI->pAttachments = new VkAttachmentDescription[localRPCI->attachmentCount];
+ memcpy((void*)localRPCI->pAttachments, pCreateInfo->pAttachments, localRPCI->attachmentCount*sizeof(VkAttachmentDescription));
}
- if (pCreateInfo->pColorStoreOps) {
- localRPCI->pColorStoreOps = new VkAttachmentStoreOp[localRPCI->colorAttachmentCount];
- memcpy((void*)localRPCI->pColorStoreOps, pCreateInfo->pColorStoreOps, localRPCI->colorAttachmentCount*sizeof(VkAttachmentStoreOp));
+ if (pCreateInfo->pSubpasses) {
+ localRPCI->pSubpasses = new VkSubpassDescription[localRPCI->subpassCount];
+ memcpy((void*)localRPCI->pSubpasses, pCreateInfo->pSubpasses, localRPCI->subpassCount*sizeof(VkSubpassDescription));
+
+ for (uint32_t i = 0; i < localRPCI->subpassCount; i++) {
+ VkSubpassDescription *subpass = (VkSubpassDescription *) &localRPCI->pSubpasses[i];
+ const uint32_t attachmentCount = subpass->inputCount +
+ subpass->colorCount * (1 + (bool) subpass->resolveAttachments) +
+ subpass->preserveCount;
+ VkAttachmentReference *attachments = new VkAttachmentReference[attachmentCount];
+
+ memcpy(attachments, subpass->inputAttachments,
+ sizeof(attachments[0]) * subpass->inputCount);
+ subpass->inputAttachments = attachments;
+ attachments += subpass->inputCount;
+
+ memcpy(attachments, subpass->colorAttachments,
+ sizeof(attachments[0]) * subpass->colorCount);
+ subpass->colorAttachments = attachments;
+ attachments += subpass->colorCount;
+
+ if (subpass->resolveAttachments) {
+ memcpy(attachments, subpass->resolveAttachments,
+ sizeof(attachments[0]) * subpass->colorCount);
+ subpass->resolveAttachments = attachments;
+ attachments += subpass->colorCount;
+ }
+
+ memcpy(attachments, subpass->preserveAttachments,
+ sizeof(attachments[0]) * subpass->preserveCount);
+ subpass->preserveAttachments = attachments;
+ }
}
- if (pCreateInfo->pColorLoadClearValues) {
- localRPCI->pColorLoadClearValues = new VkClearColorValue[localRPCI->colorAttachmentCount];
- memcpy((void*)localRPCI->pColorLoadClearValues, pCreateInfo->pColorLoadClearValues, localRPCI->colorAttachmentCount*sizeof(VkClearColorValue));
+ if (pCreateInfo->pDependencies) {
+ localRPCI->pDependencies = new VkSubpassDependency[localRPCI->dependencyCount];
+ memcpy((void*)localRPCI->pDependencies, pCreateInfo->pDependencies, localRPCI->dependencyCount*sizeof(VkSubpassDependency));
}
renderPassMap[*pRenderPass] = localRPCI;
}
return result;
}
-VK_LAYER_EXPORT void VKAPI vkCmdBeginRenderPass(VkCmdBuffer cmdBuffer, const VkRenderPassBegin *pRenderPassBegin)
+VK_LAYER_EXPORT void VKAPI vkCmdBeginRenderPass(VkCmdBuffer cmdBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, VkRenderPassContents contents)
{
GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer);
if (pCB) {
@@ -2571,11 +2621,12 @@
updateCBTracking(cmdBuffer);
addCmd(pCB, CMD_BEGINRENDERPASS);
pCB->activeRenderPass = pRenderPassBegin->renderPass;
+ pCB->activeSubpass = 0;
pCB->framebuffer = pRenderPassBegin->framebuffer;
if (pCB->lastBoundPipeline) {
validatePipelineState(pCB, VK_PIPELINE_BIND_POINT_GRAPHICS, pCB->lastBoundPipeline);
}
- get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdBeginRenderPass(cmdBuffer, pRenderPassBegin);
+ get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdBeginRenderPass(cmdBuffer, pRenderPassBegin, contents);
}
} else {
log_msg(mdd(cmdBuffer), VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, DRAWSTATE_INVALID_RENDERPASS, "DS",
@@ -2584,6 +2635,25 @@
}
}
+VK_LAYER_EXPORT void VKAPI vkCmdNextSubpass(VkCmdBuffer cmdBuffer, VkRenderPassContents contents)
+{
+ GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer);
+ if (pCB) {
+ if (!pCB->activeRenderPass) {
+ log_msg(mdd(pCB->cmdBuffer), VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, DRAWSTATE_NO_ACTIVE_RENDERPASS, "DS",
+ "Incorrect call to vkCmdNextSubpass() without an active RenderPass.");
+ } else {
+ updateCBTracking(cmdBuffer);
+ addCmd(pCB, CMD_NEXTSUBPASS);
+ pCB->activeSubpass++;
+ if (pCB->lastBoundPipeline) {
+ validatePipelineState(pCB, VK_PIPELINE_BIND_POINT_GRAPHICS, pCB->lastBoundPipeline);
+ }
+ get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdNextSubpass(cmdBuffer, contents);
+ }
+ }
+}
+
VK_LAYER_EXPORT void VKAPI vkCmdEndRenderPass(VkCmdBuffer cmdBuffer)
{
GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer);
@@ -2595,6 +2665,7 @@
updateCBTracking(cmdBuffer);
addCmd(pCB, CMD_ENDRENDERPASS);
pCB->activeRenderPass = 0;
+ pCB->activeSubpass = 0;
get_dispatch_table(draw_state_device_table_map, cmdBuffer)->CmdEndRenderPass(cmdBuffer);
}
}
@@ -2828,6 +2899,8 @@
return (void*) vkCreateRenderPass;
if (!strcmp(funcName, "vkCmdBeginRenderPass"))
return (void*) vkCmdBeginRenderPass;
+ if (!strcmp(funcName, "vkCmdNextSubpass"))
+ return (void*) vkCmdNextSubpass;
if (!strcmp(funcName, "vkCmdEndRenderPass"))
return (void*) vkCmdEndRenderPass;
diff --git a/layers/draw_state.h b/layers/draw_state.h
index 6df743d..dcebaa2 100644
--- a/layers/draw_state.h
+++ b/layers/draw_state.h
@@ -122,8 +122,8 @@
typedef struct _IMAGE_NODE {
union {
VkImageViewCreateInfo ivci;
- VkColorAttachmentViewCreateInfo cvci;
- VkDepthStencilViewCreateInfo dsvci;
+ VkAttachmentViewCreateInfo cvci;
+ VkAttachmentViewCreateInfo dsvci;
} createInfo;
} IMAGE_NODE;
@@ -214,6 +214,7 @@
CMD_LOADATOMICCOUNTERS,
CMD_SAVEATOMICCOUNTERS,
CMD_BEGINRENDERPASS,
+ CMD_NEXTSUBPASS,
CMD_ENDRENDERPASS,
CMD_EXECUTECOMMANDS,
CMD_DBGMARKERBEGIN,
@@ -264,6 +265,7 @@
VkDescriptorSet lastBoundDescriptorSet;
VkPipelineLayout lastBoundPipelineLayout;
VkRenderPass activeRenderPass;
+ uint32_t activeSubpass;
VkFramebuffer framebuffer;
vector<VkDescriptorSet> boundDescriptorSets;
} GLOBAL_CB_NODE;
diff --git a/layers/image.cpp b/layers/image.cpp
index 5310567..224a5dd 100644
--- a/layers/image.cpp
+++ b/layers/image.cpp
@@ -274,18 +274,18 @@
VK_LAYER_EXPORT VkResult VKAPI vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, VkRenderPass* pRenderPass)
{
- for(uint32_t i = 0; i < pCreateInfo->colorAttachmentCount; ++i)
+ for(uint32_t i = 0; i < pCreateInfo->attachmentCount; ++i)
{
- if(pCreateInfo->pColorFormats[i] != VK_FORMAT_UNDEFINED)
+ if(pCreateInfo->pAttachments[i].format != VK_FORMAT_UNDEFINED)
{
layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
VkFormatProperties properties;
VkResult result = get_dispatch_table(image_instance_table_map, device_data->physicalDevice)->GetPhysicalDeviceFormatInfo(
- device_data->physicalDevice, pCreateInfo->pColorFormats[i], &properties);
+ device_data->physicalDevice, pCreateInfo->pAttachments[i].format, &properties);
if(result != VK_SUCCESS)
{
std::stringstream ss;
- ss << "vkCreateRenderPass parameter, VkFormat pCreateInfo->pColorFormats[" << i << "], cannot be validated";
+ ss << "vkCreateRenderPass parameter, VkFormat in pCreateInfo->pAttachments[" << i << "], cannot be validated";
log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "IMAGE", ss.str().c_str());
continue;
}
@@ -293,71 +293,43 @@
if((properties.linearTilingFeatures) == 0 && (properties.optimalTilingFeatures == 0))
{
std::stringstream ss;
- ss << "vkCreateRenderPass parameter, VkFormat pCreateInfo->pColorFormats[" << i << "], contains unsupported format";
+ ss << "vkCreateRenderPass parameter, VkFormat in pCreateInfo->pAttachments[" << i << "], contains unsupported format";
log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "IMAGE", ss.str().c_str());
}
}
}
- for(uint32_t i = 0; i < pCreateInfo->colorAttachmentCount; ++i)
+ for(uint32_t i = 0; i < pCreateInfo->attachmentCount; ++i)
{
- if(!validate_VkImageLayout(pCreateInfo->pColorLayouts[i]))
+ if(!validate_VkImageLayout(pCreateInfo->pAttachments[i].initialLayout) ||
+ !validate_VkImageLayout(pCreateInfo->pAttachments[i].finalLayout))
{
std::stringstream ss;
- ss << "vkCreateRenderPass parameter, VkImageLayout pCreateInfo->pColorLayouts[" << i << "], is unrecognized";
+ ss << "vkCreateRenderPass parameter, VkImageLayout in pCreateInfo->pAttachments[" << i << "], is unrecognized";
log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "IMAGE", ss.str().c_str());
}
}
- for(uint32_t i = 0; i < pCreateInfo->colorAttachmentCount; ++i)
+ for(uint32_t i = 0; i < pCreateInfo->attachmentCount; ++i)
{
- if(!validate_VkAttachmentLoadOp(pCreateInfo->pColorLoadOps[i]))
+ if(!validate_VkAttachmentLoadOp(pCreateInfo->pAttachments[i].loadOp))
{
std::stringstream ss;
- ss << "vkCreateRenderPass parameter, VkAttachmentLoadOp pCreateInfo->pColorLoadOps[" << i << "], is unrecognized";
+ ss << "vkCreateRenderPass parameter, VkAttachmentLoadOp in pCreateInfo->pAttachments[" << i << "], is unrecognized";
log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "IMAGE", ss.str().c_str());
}
}
- for(uint32_t i = 0; i < pCreateInfo->colorAttachmentCount; ++i)
+ for(uint32_t i = 0; i < pCreateInfo->attachmentCount; ++i)
{
- if(!validate_VkAttachmentStoreOp(pCreateInfo->pColorStoreOps[i]))
+ if(!validate_VkAttachmentStoreOp(pCreateInfo->pAttachments[i].storeOp))
{
std::stringstream ss;
- ss << "vkCreateRenderPass parameter, VkAttachmentStoreOp pCreateInfo->pColorStoreOps[" << i << "], is unrecognized";
+ ss << "vkCreateRenderPass parameter, VkAttachmentStoreOp in pCreateInfo->pAttachments[" << i << "], is unrecognized";
log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "IMAGE", ss.str().c_str());
}
}
- for(uint32_t i = 0; i < pCreateInfo->colorAttachmentCount; ++i)
- {
- if(!vk_validate_vkclearcolorvalue(&(pCreateInfo->pColorLoadClearValues[i])))
- {
- std::stringstream ss;
- ss << "vkCreateRenderPass parameter, VkClearColorValue pCreateInfo->pColorLoadClearValues[" << i << "], is invalid";
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "IMAGE", ss.str().c_str());
- }
- }
-
- if(pCreateInfo->depthStencilFormat != VK_FORMAT_UNDEFINED)
- {
- layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
- VkFormatProperties properties;
- VkResult result = get_dispatch_table(image_instance_table_map, device_data->physicalDevice)->GetPhysicalDeviceFormatInfo(
- device_data->physicalDevice, pCreateInfo->depthStencilFormat, &properties);
- if(result != VK_SUCCESS)
- {
- char const str[] = "vkCreateRenderPass parameter, VkFormat pCreateInfo->depthStencilFormat, cannot be validated";
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "IMAGE", str);
- }
-
- if((properties.linearTilingFeatures) == 0 && (properties.optimalTilingFeatures == 0))
- {
- char const str[] = "vkCreateRenderPass parameter, VkFormat pCreateInfo->depthStencilFormat, contains unsupported format";
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "IMAGE", str);
- }
- }
-
VkResult result = get_dispatch_table(image_device_table_map, device)->CreateRenderPass(device, pCreateInfo, pRenderPass);
return result;
diff --git a/layers/mem_tracker.cpp b/layers/mem_tracker.cpp
index 22d6ef3..0ae84f4 100644
--- a/layers/mem_tracker.cpp
+++ b/layers/mem_tracker.cpp
@@ -1455,15 +1455,15 @@
return result;
}
-VK_LAYER_EXPORT VkResult VKAPI vkCreateColorAttachmentView(
+VK_LAYER_EXPORT VkResult VKAPI vkCreateAttachmentView(
VkDevice device,
- const VkColorAttachmentViewCreateInfo *pCreateInfo,
- VkColorAttachmentView *pView)
+ const VkAttachmentViewCreateInfo *pCreateInfo,
+ VkAttachmentView *pView)
{
- VkResult result = get_dispatch_table(mem_tracker_device_table_map, device)->CreateColorAttachmentView(device, pCreateInfo, pView);
+ VkResult result = get_dispatch_table(mem_tracker_device_table_map, device)->CreateAttachmentView(device, pCreateInfo, pView);
if (result == VK_SUCCESS) {
loader_platform_thread_lock_mutex(&globalLock);
- add_object_info(*pView, pCreateInfo->sType, pCreateInfo, sizeof(VkColorAttachmentViewCreateInfo), "color_attachment_view");
+ add_object_info(*pView, pCreateInfo->sType, pCreateInfo, sizeof(VkAttachmentViewCreateInfo), "attachment_view");
// Validate that img has correct usage flags set
// We don't use the image helper function here as it's a special case that checks struct type
MT_OBJ_INFO* pInfo = get_object_info(pCreateInfo->image);
@@ -1481,23 +1481,6 @@
return result;
}
-VK_LAYER_EXPORT VkResult VKAPI vkCreateDepthStencilView(
- VkDevice device,
- const VkDepthStencilViewCreateInfo *pCreateInfo,
- VkDepthStencilView *pView)
-{
- VkResult result = get_dispatch_table(mem_tracker_device_table_map, device)->CreateDepthStencilView(device, pCreateInfo, pView);
- if (result == VK_SUCCESS) {
- loader_platform_thread_lock_mutex(&globalLock);
- add_object_info(*pView, pCreateInfo->sType, pCreateInfo, sizeof(VkDepthStencilViewCreateInfo), "ds_view");
- // Validate that img has correct usage flags set
- validate_image_usage_flags(device, pCreateInfo->image, VK_IMAGE_USAGE_DEPTH_STENCIL_BIT,
- true, "vkCreateDepthStencilView()", "VK_IMAGE_USAGE_DEPTH_STENCIL_BIT");
- loader_platform_thread_unlock_mutex(&globalLock);
- }
- return result;
-}
-
VK_LAYER_EXPORT VkResult VKAPI vkCreateShader(
VkDevice device,
const VkShaderCreateInfo *pCreateInfo,
@@ -2244,10 +2227,8 @@
return (void*) vkCreateImage;
if (!strcmp(funcName, "vkCreateImageView"))
return (void*) vkCreateImageView;
- if (!strcmp(funcName, "vkCreateColorAttachmentView"))
- return (void*) vkCreateColorAttachmentView;
- if (!strcmp(funcName, "vkCreateDepthStencilView"))
- return (void*) vkCreateDepthStencilView;
+ if (!strcmp(funcName, "vkCreateAttachmentView"))
+ return (void*) vkCreateAttachmentView;
if (!strcmp(funcName, "vkCreateShader"))
return (void*) vkCreateShader;
if (!strcmp(funcName, "vkCreateGraphicsPipelines"))
diff --git a/layers/mem_tracker.h b/layers/mem_tracker.h
index 3f6a0fe..f833c3a 100644
--- a/layers/mem_tracker.h
+++ b/layers/mem_tracker.h
@@ -99,8 +99,7 @@
// The only objects that are guaranteed to have no external memory
// requirements are devices, queues, command buffers, shaders and memory objects.
union {
- VkColorAttachmentViewCreateInfo color_attachment_view_create_info;
- VkDepthStencilViewCreateInfo ds_view_create_info;
+ VkAttachmentViewCreateInfo attachment_view_create_info;
VkImageViewCreateInfo image_view_create_info;
VkImageCreateInfo image_create_info;
VkGraphicsPipelineCreateInfo graphics_pipeline_create_info;
@@ -118,8 +117,7 @@
VkCmdBufferCreateInfo createInfo;
MT_OBJ_INFO* pDynamicState[VK_NUM_STATE_BIND_POINT];
VkPipeline pipelines[VK_NUM_PIPELINE_BIND_POINT];
- uint32_t colorAttachmentCount;
- VkDepthStencilBindInfo dsBindInfo;
+ uint32_t attachmentCount;
VkCmdBuffer cmdBuffer;
uint64_t fenceId;
VkFence lastSubmittedFence;
diff --git a/layers/param_checker.cpp b/layers/param_checker.cpp
index 3c3361d..4658cfe 100644
--- a/layers/param_checker.cpp
+++ b/layers/param_checker.cpp
@@ -971,10 +971,10 @@
}
static
-bool ValidateEnumerator(VkDepthStencilViewCreateFlagBits const& enumerator)
+bool ValidateEnumerator(VkAttachmentViewCreateFlagBits const& enumerator)
{
- VkDepthStencilViewCreateFlagBits allFlags = (VkDepthStencilViewCreateFlagBits)(VK_DEPTH_STENCIL_VIEW_CREATE_READ_ONLY_STENCIL_BIT |
- VK_DEPTH_STENCIL_VIEW_CREATE_READ_ONLY_DEPTH_BIT);
+ VkAttachmentViewCreateFlagBits allFlags = (VkAttachmentViewCreateFlagBits)(VK_ATTACHMENT_VIEW_CREATE_READ_ONLY_STENCIL_BIT |
+ VK_ATTACHMENT_VIEW_CREATE_READ_ONLY_DEPTH_BIT);
if(enumerator & (~allFlags))
{
return false;
@@ -984,7 +984,7 @@
}
static
-std::string EnumeratorString(VkDepthStencilViewCreateFlagBits const& enumerator)
+std::string EnumeratorString(VkAttachmentViewCreateFlagBits const& enumerator)
{
if(!ValidateEnumerator(enumerator))
{
@@ -992,13 +992,13 @@
}
std::vector<std::string> strings;
- if(enumerator & VK_DEPTH_STENCIL_VIEW_CREATE_READ_ONLY_STENCIL_BIT)
+ if(enumerator & VK_ATTACHMENT_VIEW_CREATE_READ_ONLY_STENCIL_BIT)
{
- strings.push_back("VK_DEPTH_STENCIL_VIEW_CREATE_READ_ONLY_STENCIL_BIT");
+ strings.push_back("VK_ATTACHMENT_VIEW_CREATE_READ_ONLY_STENCIL_BIT");
}
- if(enumerator & VK_DEPTH_STENCIL_VIEW_CREATE_READ_ONLY_DEPTH_BIT)
+ if(enumerator & VK_ATTACHMENT_VIEW_CREATE_READ_ONLY_DEPTH_BIT)
{
- strings.push_back("VK_DEPTH_STENCIL_VIEW_CREATE_READ_ONLY_DEPTH_BIT");
+ strings.push_back("VK_ATTACHMENT_VIEW_CREATE_READ_ONLY_DEPTH_BIT");
}
std::string enumeratorString;
@@ -4295,184 +4295,93 @@
return result;
}
-void PreCreateColorAttachmentView(
+void PreCreateAttachmentView(
VkDevice device,
- const VkColorAttachmentViewCreateInfo* pCreateInfo)
+ const VkAttachmentViewCreateInfo* pCreateInfo)
{
if(device == nullptr)
{
log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateColorAttachmentView parameter, VkDevice device, is null pointer");
+ "vkCreateAttachmentView parameter, VkDevice device, is null pointer");
return;
}
if(pCreateInfo == nullptr)
{
log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateColorAttachmentView parameter, const VkColorAttachmentViewCreateInfo* pCreateInfo, is null pointer");
+ "vkCreateAttachmentView parameter, const VkAttachmentViewCreateInfo* pCreateInfo, is null pointer");
return;
}
if(pCreateInfo->sType < VK_STRUCTURE_TYPE_BEGIN_RANGE ||
pCreateInfo->sType > VK_STRUCTURE_TYPE_END_RANGE)
{
log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateColorAttachmentView parameter, VkStructureType pCreateInfo->sType, is unrecognized enumerator");
+ "vkCreateAttachmentView parameter, VkStructureType pCreateInfo->sType, is unrecognized enumerator");
return;
}
if(pCreateInfo->image == nullptr)
{
log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateColorAttachmentView parameter, VkImage pCreateInfo->image, is null pointer");
+ "vkCreateAttachmentView parameter, VkImage pCreateInfo->image, is null pointer");
return;
}
if(pCreateInfo->format < VK_FORMAT_BEGIN_RANGE ||
pCreateInfo->format > VK_FORMAT_END_RANGE)
{
log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateColorAttachmentView parameter, VkFormat pCreateInfo->format, is unrecognized enumerator");
+ "vkCreateAttachmentView parameter, VkFormat pCreateInfo->format, is unrecognized enumerator");
return;
}
- if(pCreateInfo->msaaResolveImage == nullptr)
+ if(!ValidateEnumerator((VkAttachmentViewCreateFlagBits)pCreateInfo->flags))
{
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateColorAttachmentView parameter, VkImage pCreateInfo->msaaResolveImage, is null pointer");
- return;
- }
- if(pCreateInfo->msaaResolveSubResource.aspect < VK_IMAGE_ASPECT_BEGIN_RANGE ||
- pCreateInfo->msaaResolveSubResource.aspect > VK_IMAGE_ASPECT_END_RANGE)
- {
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateColorAttachmentView parameter, VkImageAspect pCreateInfo->msaaResolveSubResource.aspect, is unrecognized enumerator");
+ std::string reason = "vkCreateAttachmentView parameter, VkAttachmentViewCreateFlags pCreateInfo->flags, is " + EnumeratorString((VkAttachmentViewCreateFlagBits)pCreateInfo->flags);
+ log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK", reason.c_str());
return;
}
}
-void PostCreateColorAttachmentView(
+void PostCreateAttachmentView(
VkDevice device,
- VkColorAttachmentView* pView,
+ VkAttachmentView* pView,
VkResult result)
{
if(device == nullptr)
{
log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateColorAttachmentView parameter, VkDevice device, is null pointer");
+ "vkCreateAttachmentView parameter, VkDevice device, is null pointer");
return;
}
if(pView == nullptr)
{
log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateColorAttachmentView parameter, VkColorAttachmentView* pView, is null pointer");
+ "vkCreateAttachmentView parameter, VkAttachmentView* pView, is null pointer");
return;
}
if((*pView) == nullptr)
{
log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateColorAttachmentView parameter, VkColorAttachmentView* pView, is null pointer");
+ "vkCreateAttachmentView parameter, VkAttachmentView* pView, is null pointer");
return;
}
if(result != VK_SUCCESS)
{
- std::string reason = "vkCreateColorAttachmentView parameter, VkResult result, is " + EnumeratorString(result);
+ std::string reason = "vkCreateAttachmentView parameter, VkResult result, is " + EnumeratorString(result);
log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK", reason.c_str());
return;
}
}
-VK_LAYER_EXPORT VkResult VKAPI vkCreateColorAttachmentView(
+VK_LAYER_EXPORT VkResult VKAPI vkCreateAttachmentView(
VkDevice device,
- const VkColorAttachmentViewCreateInfo* pCreateInfo,
- VkColorAttachmentView* pView)
+ const VkAttachmentViewCreateInfo* pCreateInfo,
+ VkAttachmentView* pView)
{
- PreCreateColorAttachmentView(device, pCreateInfo);
- VkResult result = get_dispatch_table(pc_device_table_map, device)->CreateColorAttachmentView(device, pCreateInfo, pView);
+ PreCreateAttachmentView(device, pCreateInfo);
+ VkResult result = get_dispatch_table(pc_device_table_map, device)->CreateAttachmentView(device, pCreateInfo, pView);
- PostCreateColorAttachmentView(device, pView, result);
-
- return result;
-}
-
-void PreCreateDepthStencilView(
- VkDevice device,
- const VkDepthStencilViewCreateInfo* pCreateInfo)
-{
- if(device == nullptr)
- {
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateDepthStencilView parameter, VkDevice device, is null pointer");
- return;
- }
-
- if(pCreateInfo == nullptr)
- {
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateDepthStencilView parameter, const VkDepthStencilViewCreateInfo* pCreateInfo, is null pointer");
- return;
- }
- if(pCreateInfo->sType < VK_STRUCTURE_TYPE_BEGIN_RANGE ||
- pCreateInfo->sType > VK_STRUCTURE_TYPE_END_RANGE)
- {
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateDepthStencilView parameter, VkStructureType pCreateInfo->sType, is unrecognized enumerator");
- return;
- }
- if(pCreateInfo->image == nullptr)
- {
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateDepthStencilView parameter, VkImage pCreateInfo->image, is null pointer");
- return;
- }
- if(!ValidateEnumerator((VkDepthStencilViewCreateFlagBits)pCreateInfo->flags))
- {
- std::string reason = "vkCreateDepthStencilView parameter, VkDepthStencilViewCreateFlags pCreateInfo->flags, is " + EnumeratorString((VkDepthStencilViewCreateFlagBits)pCreateInfo->flags);
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK", reason.c_str());
- return;
- }
-}
-
-void PostCreateDepthStencilView(
- VkDevice device,
- VkDepthStencilView* pView,
- VkResult result)
-{
- if(device == nullptr)
- {
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateDepthStencilView parameter, VkDevice device, is null pointer");
- return;
- }
-
- if(pView == nullptr)
- {
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateDepthStencilView parameter, VkDepthStencilView* pView, is null pointer");
- return;
- }
- if((*pView) == nullptr)
- {
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateDepthStencilView parameter, VkDepthStencilView* pView, is null pointer");
- return;
- }
-
- if(result != VK_SUCCESS)
- {
- std::string reason = "vkCreateDepthStencilView parameter, VkResult result, is " + EnumeratorString(result);
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK", reason.c_str());
- return;
- }
-}
-
-VK_LAYER_EXPORT VkResult VKAPI vkCreateDepthStencilView(
- VkDevice device,
- const VkDepthStencilViewCreateInfo* pCreateInfo,
- VkDepthStencilView* pView)
-{
- PreCreateDepthStencilView(device, pCreateInfo);
- VkResult result = get_dispatch_table(pc_device_table_map, device)->CreateDepthStencilView(device, pCreateInfo, pView);
-
- PostCreateDepthStencilView(device, pView, result);
+ PostCreateAttachmentView(device, pView, result);
return result;
}
@@ -4948,13 +4857,6 @@
"vkCreateGraphicsPipeline parameter, const void* pCreateInfo->pDsState->pNext, is null pointer");
return;
}
- if(pCreateInfo->pDsState->format < VK_FORMAT_BEGIN_RANGE ||
- pCreateInfo->pDsState->format > VK_FORMAT_END_RANGE)
- {
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateGraphicsPipeline parameter, VkFormat pCreateInfo->pDsState->format, is unrecognized enumerator");
- return;
- }
if(pCreateInfo->pDsState->depthCompareOp < VK_COMPARE_OP_BEGIN_RANGE ||
pCreateInfo->pDsState->depthCompareOp > VK_COMPARE_OP_END_RANGE)
{
@@ -5050,13 +4952,6 @@
"vkCreateGraphicsPipeline parameter, const VkPipelineCbAttachmentState* pCreateInfo->pCbState->pAttachments, is null pointer");
return;
}
- if(pCreateInfo->pCbState->pAttachments->format < VK_FORMAT_BEGIN_RANGE ||
- pCreateInfo->pCbState->pAttachments->format > VK_FORMAT_END_RANGE)
- {
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateGraphicsPipeline parameter, VkFormat pCreateInfo->pCbState->pAttachments->format, is unrecognized enumerator");
- return;
- }
if(pCreateInfo->pCbState->pAttachments->srcBlendColor < VK_BLEND_BEGIN_RANGE ||
pCreateInfo->pCbState->pAttachments->srcBlendColor > VK_BLEND_END_RANGE)
{
@@ -8379,42 +8274,23 @@
"vkCreateFramebuffer parameter, VkStructureType pCreateInfo->sType, is unrecognized enumerator");
return;
}
- if(pCreateInfo->pColorAttachments == nullptr)
+ if(pCreateInfo->pAttachments == nullptr)
{
log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateFramebuffer parameter, const VkColorAttachmentBindInfo* pCreateInfo->pColorAttachments, is null pointer");
+ "vkCreateFramebuffer parameter, const VkAttachmentBindInfo* pCreateInfo->pAttachments, is null pointer");
return;
}
- if(pCreateInfo->pColorAttachments->view == nullptr)
+ if(pCreateInfo->pAttachments->view == nullptr)
{
log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateFramebuffer parameter, VkColorAttachmentView pCreateInfo->pColorAttachments->view, is null pointer");
+ "vkCreateFramebuffer parameter, VkAttachmentView pCreateInfo->pAttachments->view, is null pointer");
return;
}
- if(pCreateInfo->pColorAttachments->layout < VK_IMAGE_LAYOUT_BEGIN_RANGE ||
- pCreateInfo->pColorAttachments->layout > VK_IMAGE_LAYOUT_END_RANGE)
+ if(pCreateInfo->pAttachments->layout < VK_IMAGE_LAYOUT_BEGIN_RANGE ||
+ pCreateInfo->pAttachments->layout > VK_IMAGE_LAYOUT_END_RANGE)
{
log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateFramebuffer parameter, VkImageLayout pCreateInfo->pColorAttachments->layout, is unrecognized enumerator");
- return;
- }
- if(pCreateInfo->pDepthStencilAttachment == nullptr)
- {
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateFramebuffer parameter, const VkDepthStencilBindInfo* pCreateInfo->pDepthStencilAttachment, is null pointer");
- return;
- }
- if(pCreateInfo->pDepthStencilAttachment->view == nullptr)
- {
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateFramebuffer parameter, VkDepthStencilView pCreateInfo->pDepthStencilAttachment->view, is null pointer");
- return;
- }
- if(pCreateInfo->pDepthStencilAttachment->layout < VK_IMAGE_LAYOUT_BEGIN_RANGE ||
- pCreateInfo->pDepthStencilAttachment->layout > VK_IMAGE_LAYOUT_END_RANGE)
- {
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateFramebuffer parameter, VkImageLayout pCreateInfo->pDepthStencilAttachment->layout, is unrecognized enumerator");
+ "vkCreateFramebuffer parameter, VkImageLayout pCreateInfo->pAttachments->layout, is unrecognized enumerator");
return;
}
}
@@ -8469,6 +8345,8 @@
VkDevice device,
const VkRenderPassCreateInfo* pCreateInfo)
{
+ uint32_t i;
+
if(device == nullptr)
{
log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
@@ -8489,105 +8367,48 @@
"vkCreateRenderPass parameter, VkStructureType pCreateInfo->sType, is unrecognized enumerator");
return;
}
- if(pCreateInfo->pColorFormats == nullptr)
+
+ for (i = 0; i < pCreateInfo->attachmentCount; i++)
{
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, const VkFormat* pCreateInfo->pColorFormats, is null pointer");
- return;
- }
- if((*pCreateInfo->pColorFormats) < VK_FORMAT_BEGIN_RANGE ||
- (*pCreateInfo->pColorFormats) > VK_FORMAT_END_RANGE)
- {
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, const VkFormat* pCreateInfo->pColorFormats, is unrecognized enumerator");
- return;
- }
- if(pCreateInfo->pColorLayouts == nullptr)
- {
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, const VkImageLayout* pCreateInfo->pColorLayouts, is null pointer");
- return;
- }
- if((*pCreateInfo->pColorLayouts) < VK_IMAGE_LAYOUT_BEGIN_RANGE ||
- (*pCreateInfo->pColorLayouts) > VK_IMAGE_LAYOUT_END_RANGE)
- {
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, const VkImageLayout* pCreateInfo->pColorLayouts, is unrecognized enumerator");
- return;
- }
- if(pCreateInfo->pColorLoadOps == nullptr)
- {
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, const VkAttachmentLoadOp* pCreateInfo->pColorLoadOps, is null pointer");
- return;
- }
- if((*pCreateInfo->pColorLoadOps) < VK_ATTACHMENT_LOAD_OP_BEGIN_RANGE ||
- (*pCreateInfo->pColorLoadOps) > VK_ATTACHMENT_LOAD_OP_END_RANGE)
- {
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, const VkAttachmentLoadOp* pCreateInfo->pColorLoadOps, is unrecognized enumerator");
- return;
- }
- if(pCreateInfo->pColorStoreOps == nullptr)
- {
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, const VkAttachmentStoreOp* pCreateInfo->pColorStoreOps, is null pointer");
- return;
- }
- if((*pCreateInfo->pColorStoreOps) < VK_ATTACHMENT_STORE_OP_BEGIN_RANGE ||
- (*pCreateInfo->pColorStoreOps) > VK_ATTACHMENT_STORE_OP_END_RANGE)
- {
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, const VkAttachmentStoreOp* pCreateInfo->pColorStoreOps, is unrecognized enumerator");
- return;
- }
- if(pCreateInfo->pColorLoadClearValues == nullptr)
- {
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, const VkClearColor* pCreateInfo->pColorLoadClearValues, is null pointer");
- return;
- }
- if(pCreateInfo->depthStencilFormat < VK_FORMAT_BEGIN_RANGE ||
- pCreateInfo->depthStencilFormat > VK_FORMAT_END_RANGE)
- {
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, VkFormat pCreateInfo->depthStencilFormat, is unrecognized enumerator");
- return;
- }
- if(pCreateInfo->depthStencilLayout < VK_IMAGE_LAYOUT_BEGIN_RANGE ||
- pCreateInfo->depthStencilLayout > VK_IMAGE_LAYOUT_END_RANGE)
- {
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, VkImageLayout pCreateInfo->depthStencilLayout, is unrecognized enumerator");
- return;
- }
- if(pCreateInfo->depthLoadOp < VK_ATTACHMENT_LOAD_OP_BEGIN_RANGE ||
- pCreateInfo->depthLoadOp > VK_ATTACHMENT_LOAD_OP_END_RANGE)
- {
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, VkAttachmentLoadOp pCreateInfo->depthLoadOp, is unrecognized enumerator");
- return;
- }
- if(pCreateInfo->depthStoreOp < VK_ATTACHMENT_STORE_OP_BEGIN_RANGE ||
- pCreateInfo->depthStoreOp > VK_ATTACHMENT_STORE_OP_END_RANGE)
- {
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, VkAttachmentStoreOp pCreateInfo->depthStoreOp, is unrecognized enumerator");
- return;
- }
- if(pCreateInfo->stencilLoadOp < VK_ATTACHMENT_LOAD_OP_BEGIN_RANGE ||
- pCreateInfo->stencilLoadOp > VK_ATTACHMENT_LOAD_OP_END_RANGE)
- {
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, VkAttachmentLoadOp pCreateInfo->stencilLoadOp, is unrecognized enumerator");
- return;
- }
- if(pCreateInfo->stencilStoreOp < VK_ATTACHMENT_STORE_OP_BEGIN_RANGE ||
- pCreateInfo->stencilStoreOp > VK_ATTACHMENT_STORE_OP_END_RANGE)
- {
- log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, VkAttachmentStoreOp pCreateInfo->stencilStoreOp, is unrecognized enumerator");
- return;
+ const VkAttachmentDescription *att = &pCreateInfo->pAttachments[i];
+
+ if(att->format < VK_FORMAT_BEGIN_RANGE || att->format > VK_FORMAT_END_RANGE)
+ {
+ log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
+ "vkCreateRenderPass parameter, VkFormat in pCreateInfo->pAttachments, is unrecognized enumerator");
+ return;
+ }
+ if(att->initialLayout < VK_IMAGE_LAYOUT_BEGIN_RANGE || att->initialLayout > VK_IMAGE_LAYOUT_END_RANGE ||
+ att->finalLayout < VK_IMAGE_LAYOUT_BEGIN_RANGE || att->finalLayout > VK_IMAGE_LAYOUT_END_RANGE)
+ {
+ log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
+ "vkCreateRenderPass parameter, VkImageLayout in pCreateInfo->pAttachments, is unrecognized enumerator");
+ return;
+ }
+ if(att->loadOp < VK_ATTACHMENT_LOAD_OP_BEGIN_RANGE || att->loadOp > VK_ATTACHMENT_LOAD_OP_END_RANGE)
+ {
+ log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
+ "vkCreateRenderPass parameter, VkAttachmentLoadOp in pCreateInfo->pAttachments, is unrecognized enumerator");
+ return;
+ }
+ if(att->storeOp < VK_ATTACHMENT_STORE_OP_BEGIN_RANGE || att->storeOp > VK_ATTACHMENT_STORE_OP_END_RANGE)
+ {
+ log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
+ "vkCreateRenderPass parameter, VkAttachmentStoreOp in pCreateInfo->pAttachments, is unrecognized enumerator");
+ return;
+ }
+ if(att->stencilLoadOp < VK_ATTACHMENT_LOAD_OP_BEGIN_RANGE || att->stencilLoadOp > VK_ATTACHMENT_LOAD_OP_END_RANGE)
+ {
+ log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
+ "vkCreateRenderPass parameter, VkAttachmentLoadOp in pCreateInfo->pAttachments, is unrecognized enumerator");
+ return;
+ }
+ if(att->stencilStoreOp < VK_ATTACHMENT_STORE_OP_BEGIN_RANGE || att->stencilStoreOp > VK_ATTACHMENT_STORE_OP_END_RANGE)
+ {
+ log_msg(mdd(device), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
+ "vkCreateRenderPass parameter, VkAttachmentStoreOp in pCreateInfo->pAttachments, is unrecognized enumerator");
+ return;
+ }
}
}
@@ -8639,7 +8460,8 @@
void PreCmdBeginRenderPass(
VkCmdBuffer cmdBuffer,
- const VkRenderPassBegin* pRenderPassBegin)
+ const VkRenderPassBeginInfo* pRenderPassBegin,
+ VkRenderPassContents contents)
{
if(cmdBuffer == nullptr)
{
@@ -8681,14 +8503,48 @@
VK_LAYER_EXPORT void VKAPI vkCmdBeginRenderPass(
VkCmdBuffer cmdBuffer,
- const VkRenderPassBegin* pRenderPassBegin)
+ const VkRenderPassBeginInfo* pRenderPassBegin,
+ VkRenderPassContents contents)
{
- PreCmdBeginRenderPass(cmdBuffer, pRenderPassBegin);
- get_dispatch_table(pc_device_table_map, cmdBuffer)->CmdBeginRenderPass(cmdBuffer, pRenderPassBegin);
+ PreCmdBeginRenderPass(cmdBuffer, pRenderPassBegin, contents);
+ get_dispatch_table(pc_device_table_map, cmdBuffer)->CmdBeginRenderPass(cmdBuffer, pRenderPassBegin, contents);
PostCmdBeginRenderPass(cmdBuffer);
}
+void PreCmdNextSubpass(
+ VkCmdBuffer cmdBuffer,
+ VkRenderPassContents contents)
+{
+ if(cmdBuffer == nullptr)
+ {
+ log_msg(mdd(cmdBuffer), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
+ "vkCmdNextSubpass parameter, VkCmdBuffer cmdBuffer, is null pointer");
+ return;
+ }
+}
+
+void PostCmdNextSubpass(
+ VkCmdBuffer cmdBuffer)
+{
+ if(cmdBuffer == nullptr)
+ {
+ log_msg(mdd(cmdBuffer), VK_DBG_REPORT_WARN_BIT, (VkObjectType)0, NULL, 0, 1, "PARAMCHECK",
+ "vkCmdNextSubpass parameter, VkCmdBuffer cmdBuffer, is null pointer");
+ return;
+ }
+}
+
+VK_LAYER_EXPORT void VKAPI vkCmdNextSubpass(
+ VkCmdBuffer cmdBuffer,
+ VkRenderPassContents contents)
+{
+ PreCmdNextSubpass(cmdBuffer, contents);
+ get_dispatch_table(pc_device_table_map, cmdBuffer)->CmdNextSubpass(cmdBuffer, contents);
+
+ PostCmdNextSubpass(cmdBuffer);
+}
+
void PreCmdEndRenderPass(
VkCmdBuffer cmdBuffer)
{
@@ -8711,6 +8567,15 @@
}
}
+VK_LAYER_EXPORT void VKAPI vkCmdEndRenderPass(
+ VkCmdBuffer cmdBuffer)
+{
+ PreCmdEndRenderPass(cmdBuffer);
+ get_dispatch_table(pc_device_table_map, cmdBuffer)->CmdEndRenderPass(cmdBuffer);
+
+ PostCmdEndRenderPass(cmdBuffer);
+}
+
void PreCmdExecuteCommands(
VkCmdBuffer cmdBuffer)
{
@@ -8733,15 +8598,6 @@
}
}
-VK_LAYER_EXPORT void VKAPI vkCmdEndRenderPass(
- VkCmdBuffer cmdBuffer)
-{
- PreCmdEndRenderPass(cmdBuffer);
- get_dispatch_table(pc_device_table_map, cmdBuffer)->CmdEndRenderPass(cmdBuffer);
-
- PostCmdEndRenderPass(cmdBuffer);
-}
-
VK_LAYER_EXPORT void VKAPI vkCmdExecuteCommands(
VkCmdBuffer cmdBuffer,
uint32_t cmdBuffersCount,
@@ -8829,10 +8685,8 @@
return (void*) vkGetImageSubresourceLayout;
if (!strcmp(funcName, "vkCreateImageView"))
return (void*) vkCreateImageView;
- if (!strcmp(funcName, "vkCreateColorAttachmentView"))
- return (void*) vkCreateColorAttachmentView;
- if (!strcmp(funcName, "vkCreateDepthStencilView"))
- return (void*) vkCreateDepthStencilView;
+ if (!strcmp(funcName, "vkCreateAttachmentView"))
+ return (void*) vkCreateAttachmentView;
if (!strcmp(funcName, "vkCreateShader"))
return (void*) vkCreateShader;
if (!strcmp(funcName, "vkCreateGraphicsPipelines"))
@@ -8933,6 +8787,8 @@
return (void*) vkCreateRenderPass;
if (!strcmp(funcName, "vkCmdBeginRenderPass"))
return (void*) vkCmdBeginRenderPass;
+ if (!strcmp(funcName, "vkCmdNextSubpass"))
+ return (void*) vkCmdNextSubpass;
if (!strcmp(funcName, "vkCmdEndRenderPass"))
return (void*) vkCmdEndRenderPass;
diff --git a/layers/shader_checker.cpp b/layers/shader_checker.cpp
index 8d1a865..23b0c10 100644
--- a/layers/shader_checker.cpp
+++ b/layers/shader_checker.cpp
@@ -171,6 +171,33 @@
};
static std::unordered_map<void *, shader_object *> shader_object_map;
+struct render_pass {
+ std::vector<std::vector<VkFormat>> subpass_color_formats;
+
+ render_pass(VkRenderPassCreateInfo const *pCreateInfo)
+ {
+ uint32_t i;
+
+ subpass_color_formats.reserve(pCreateInfo->subpassCount);
+ for (i = 0; i < pCreateInfo->subpassCount; i++) {
+ const VkSubpassDescription *subpass = &pCreateInfo->pSubpasses[i];
+ std::vector<VkFormat> color_formats;
+ uint32_t j;
+
+ color_formats.reserve(subpass->colorCount);
+ for (j = 0; j < subpass->colorCount; j++) {
+ const uint32_t att = subpass->colorAttachments[j].attachment;
+ const VkFormat format = pCreateInfo->pAttachments[att].format;
+
+ color_formats.push_back(pCreateInfo->pAttachments[att].format);
+ }
+
+ subpass_color_formats.push_back(color_formats);
+ }
+ }
+};
+static std::unordered_map<void *, render_pass *> render_pass_map;
+
static void
init_shader_checker(layer_data *my_data)
@@ -519,6 +546,19 @@
return res;
}
+VK_LAYER_EXPORT VkResult VKAPI vkCreateRenderPass(
+ VkDevice device,
+ const VkRenderPassCreateInfo *pCreateInfo,
+ VkRenderPass *pRenderPass)
+{
+ loader_platform_thread_lock_mutex(&globalLock);
+ VkResult res = get_dispatch_table(shader_checker_device_table_map, device)->CreateRenderPass(device, pCreateInfo, pRenderPass);
+
+ render_pass_map[(VkBaseLayerObject *) *pRenderPass] = new render_pass(pCreateInfo);
+ loader_platform_thread_unlock_mutex(&globalLock);
+ return res;
+}
+
static bool
validate_interface_between_stages(VkDevice dev,
shader_module const *producer, char const *producer_name,
@@ -755,8 +795,9 @@
static bool
-validate_fs_outputs_against_cb(VkDevice dev, shader_module const *fs, VkPipelineCbStateCreateInfo const *cb)
+validate_fs_outputs_against_render_pass(VkDevice dev, shader_module const *fs, render_pass const *rp, uint32_t subpass)
{
+ const std::vector<VkFormat> &color_formats = rp->subpass_color_formats[subpass];
std::map<uint32_t, interface_var> outputs;
std::map<uint32_t, interface_var> builtin_outputs;
bool pass = true;
@@ -775,8 +816,8 @@
pass = false;
}
- for (unsigned i = 0; i < cb->attachmentCount; i++) {
- unsigned attachmentType = get_format_type(cb->pAttachments[i].format);
+ for (unsigned i = 0; i < color_formats.size(); i++) {
+ unsigned attachmentType = get_format_type(color_formats[i]);
if (attachmentType == FORMAT_TYPE_SINT || attachmentType == FORMAT_TYPE_UINT) {
log_msg(mdd(dev), VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, SHADER_CHECKER_INTERFACE_TYPE_MISMATCH, "SC",
"CB format should not be SINT or UINT when using broadcast");
@@ -794,8 +835,8 @@
* are currently dense, but the parallel with matching between shader stages is nice.
*/
- while ((outputs.size() > 0 && it != outputs.end()) || attachment < cb->attachmentCount) {
- if (attachment == cb->attachmentCount || ( it != outputs.end() && it->first < attachment)) {
+ while ((outputs.size() > 0 && it != outputs.end()) || attachment < color_formats.size()) {
+ if (attachment == color_formats.size() || ( it != outputs.end() && it->first < attachment)) {
log_msg(mdd(dev), VK_DBG_REPORT_WARN_BIT, (VkObjectType) 0, NULL, 0, SHADER_CHECKER_OUTPUT_NOT_CONSUMED, "SC",
"FS writes to output location %d with no matching attachment", it->first);
it++;
@@ -808,7 +849,7 @@
}
else {
unsigned output_type = get_fundamental_type(fs, it->second.type_id);
- unsigned att_type = get_format_type(cb->pAttachments[attachment].format);
+ unsigned att_type = get_format_type(color_formats[attachment]);
/* type checking */
if (att_type != FORMAT_TYPE_UNDEFINED && output_type != FORMAT_TYPE_UNDEFINED && att_type != output_type) {
@@ -816,7 +857,7 @@
describe_type(fs_type, fs, it->second.type_id);
log_msg(mdd(dev), VK_DBG_REPORT_ERROR_BIT, (VkObjectType) 0, NULL, 0, SHADER_CHECKER_INTERFACE_TYPE_MISMATCH, "SC",
"Attachment %d of type `%s` does not match FS output type of `%s`",
- attachment, string_VkFormat(cb->pAttachments[attachment].format), fs_type);
+ attachment, string_VkFormat(color_formats[attachment]), fs_type);
pass = false;
}
@@ -855,7 +896,7 @@
shader_module const *shaders[VK_SHADER_STAGE_FRAGMENT + 1]; /* exclude CS */
memset(shaders, 0, sizeof(shaders));
- VkPipelineCbStateCreateInfo const *cb = 0;
+ render_pass const *rp = 0;
VkPipelineVertexInputStateCreateInfo const *vi = 0;
bool pass = true;
@@ -876,7 +917,9 @@
}
}
- cb = pCreateInfo->pCbState;
+ if (pCreateInfo->renderPass != VK_NULL_HANDLE)
+ rp = render_pass_map[(void *) pCreateInfo->renderPass];
+
vi = pCreateInfo->pVertexInputState;
if (vi) {
@@ -910,8 +953,8 @@
}
}
- if (shaders[VK_SHADER_STAGE_FRAGMENT] && shaders[VK_SHADER_STAGE_FRAGMENT]->is_spirv && cb) {
- pass = validate_fs_outputs_against_cb(dev, shaders[VK_SHADER_STAGE_FRAGMENT], cb) && pass;
+ if (shaders[VK_SHADER_STAGE_FRAGMENT] && shaders[VK_SHADER_STAGE_FRAGMENT]->is_spirv && rp) {
+ pass = validate_fs_outputs_against_render_pass(dev, shaders[VK_SHADER_STAGE_FRAGMENT], rp, pCreateInfo->subpass) && pass;
}
loader_platform_thread_unlock_mutex(&globalLock);
@@ -1048,6 +1091,7 @@
ADD_HOOK(vkCreateDevice);
ADD_HOOK(vkCreateShaderModule);
ADD_HOOK(vkCreateShader);
+ ADD_HOOK(vkCreateRenderPass);
ADD_HOOK(vkDestroyDevice);
ADD_HOOK(vkCreateGraphicsPipelines);
#undef ADD_HOOK