aboutsummaryrefslogtreecommitdiff
path: root/layers
diff options
context:
space:
mode:
authorChia-I Wu <olv@lunarg.com>2015-10-26 17:32:47 +0800
committerCourtney Goeltzenleuchter <courtney@LunarG.com>2015-11-02 14:17:21 -0700
commit6555f3f867ff897affd8eeb892dc445b4e9ac5f7 (patch)
tree608c3b766b5ce25cb0583383ace9edfa6df1b31d /layers
parentfbb7a1c331cc86f44f6505bc7d65ca8910a6b8c3 (diff)
downloadusermoji-6555f3f867ff897affd8eeb892dc445b4e9ac5f7.tar.xz
MR 542: Remaining items from the cleanup bug (WIP)
depthStencilAttachment is replaced by pDepthStencilAttachment. s/VK_CULL_MODE_FRONT\b/VK_CULL_MODE_FRONT_BIT/g s/VK_CULL_MODE_BACK\b/VK_CULL_MODE_BACK_BIT/g s/VK_SAMPLER_ADDRESS_MODE_WRAP\b/VK_SAMPLER_ADDRESS_MODE_REPEAT/g s/VK_SAMPLER_ADDRESS_MODE_MIRROR\b/VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT/g s/VK_SAMPLER_ADDRESS_MODE_CLAMP\b/VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE/g s/VK_SAMPLER_ADDRESS_MODE_MIRROR_ONCE\b/VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE/g s/VK_SAMPLER_ADDRESS_MODE_CLAMP_BORDER\b/VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER/g https://gitlab.khronos.org/vulkan/vulkan/merge_requests/542
Diffstat (limited to 'layers')
-rwxr-xr-xlayers/draw_state.cpp32
-rw-r--r--layers/image.cpp3
-rw-r--r--layers/param_checker.cpp28
3 files changed, 28 insertions, 35 deletions
diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp
index 154d285d..cf733696 100755
--- a/layers/draw_state.cpp
+++ b/layers/draw_state.cpp
@@ -614,8 +614,8 @@ static VkBool32 validatePipelineState(layer_data* my_data, const GLOBAL_CB_NODE*
break;
}
}
- if (pSD->depthStencilAttachment.attachment != VK_ATTACHMENT_UNUSED) {
- const uint32_t samples = pRPCI->pAttachments[pSD->depthStencilAttachment.attachment].samples;
+ if (pSD->pDepthStencilAttachment && pSD->pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED) {
+ const uint32_t samples = pRPCI->pAttachments[pSD->pDepthStencilAttachment->attachment].samples;
if (subpassNumSamples == 0)
subpassNumSamples = samples;
else if (subpassNumSamples != samples)
@@ -3034,11 +3034,13 @@ VK_LAYER_EXPORT void VKAPI vkCmdClearAttachments(
}
} else if (attachment->aspectMask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) {
/* TODO: Is this a good test for depth/stencil? */
- if (pSD->depthStencilAttachment.attachment != attachment->colorAttachment) {
+ if (!pSD->pDepthStencilAttachment || pSD->pDepthStencilAttachment->attachment != attachment->colorAttachment) {
skipCall |= log_msg(dev_data->report_data, VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_COMMAND_BUFFER,
(uint64_t)cmdBuffer, 0, DRAWSTATE_MISSING_ATTACHMENT_REFERENCE, "DS",
"vkCmdClearAttachments() attachment index %d does not match depthStencilAttachment.attachment (%d) found in active subpass %d",
- attachment->colorAttachment, pSD->depthStencilAttachment.attachment, pCB->activeSubpass);
+ attachment->colorAttachment,
+ (pSD->pDepthStencilAttachment) ? pSD->pDepthStencilAttachment->attachment : VK_ATTACHMENT_UNUSED,
+ pCB->activeSubpass);
}
}
}
@@ -3351,8 +3353,9 @@ bool CheckPreserved(const layer_data* my_data, VkDevice device, const VkRenderPa
if (attachment == subpass.pColorAttachments[j].attachment)
return true;
}
- if (subpass.depthStencilAttachment.attachment != VK_ATTACHMENT_UNUSED) {
- if (attachment == subpass.depthStencilAttachment.attachment)
+ if (subpass.pDepthStencilAttachment &&
+ subpass.pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED) {
+ if (attachment == subpass.pDepthStencilAttachment->attachment)
return true;
}
bool result = false;
@@ -3406,8 +3409,8 @@ bool validateDependencies(const layer_data* my_data, VkDevice device, const VkRe
for (uint32_t j = 0; j < subpass.colorAttachmentCount; ++j) {
output_attachment_to_subpass[subpass.pColorAttachments[j].attachment].push_back(i);
}
- if (subpass.depthStencilAttachment.attachment != VK_ATTACHMENT_UNUSED) {
- output_attachment_to_subpass[subpass.depthStencilAttachment.attachment].push_back(i);
+ if (subpass.pDepthStencilAttachment && subpass.pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED) {
+ output_attachment_to_subpass[subpass.pDepthStencilAttachment->attachment].push_back(i);
}
}
// If there is a dependency needed make sure one exists
@@ -3424,8 +3427,8 @@ bool validateDependencies(const layer_data* my_data, VkDevice device, const VkRe
CheckDependencyExists(my_data, device, i, output_attachment_to_subpass[attachment], subpass_to_node, skip_call);
CheckDependencyExists(my_data, device, i, input_attachment_to_subpass[attachment], subpass_to_node, skip_call);
}
- if (subpass.depthStencilAttachment.attachment != VK_ATTACHMENT_UNUSED) {
- const uint32_t& attachment = subpass.depthStencilAttachment.attachment;
+ if (subpass.pDepthStencilAttachment && subpass.pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED) {
+ const uint32_t& attachment = subpass.pDepthStencilAttachment->attachment;
CheckDependencyExists(my_data, device, i, output_attachment_to_subpass[attachment], subpass_to_node, skip_call);
CheckDependencyExists(my_data, device, i, input_attachment_to_subpass[attachment], subpass_to_node, skip_call);
}
@@ -3462,7 +3465,7 @@ VK_LAYER_EXPORT VkResult VKAPI vkCreateRenderPass(VkDevice device, const VkRende
VkSubpassDescription *subpass = (VkSubpassDescription *) &localRPCI->pSubpasses[i];
const uint32_t attachmentCount = subpass->inputAttachmentCount +
subpass->colorAttachmentCount * (1 + (subpass->pResolveAttachments?1:0)) +
- subpass->preserveAttachmentCount;
+ ((subpass->pDepthStencilAttachment) ? 1 : 0) + subpass->preserveAttachmentCount;
VkAttachmentReference *attachments = new VkAttachmentReference[attachmentCount];
memcpy(attachments, subpass->pInputAttachments,
@@ -3482,6 +3485,13 @@ VK_LAYER_EXPORT VkResult VKAPI vkCreateRenderPass(VkDevice device, const VkRende
attachments += subpass->colorAttachmentCount;
}
+ if (subpass->pDepthStencilAttachment) {
+ memcpy(attachments, subpass->pDepthStencilAttachment,
+ sizeof(attachments[0]) * 1);
+ subpass->pDepthStencilAttachment = attachments;
+ attachments += 1;
+ }
+
memcpy(attachments, subpass->pPreserveAttachments,
sizeof(attachments[0]) * subpass->preserveAttachmentCount);
subpass->pPreserveAttachments = attachments;
diff --git a/layers/image.cpp b/layers/image.cpp
index af8bef49..b9d49b32 100644
--- a/layers/image.cpp
+++ b/layers/image.cpp
@@ -336,7 +336,8 @@ VK_LAYER_EXPORT VkResult VKAPI vkCreateRenderPass(VkDevice device, const VkRende
if (depthFormatPresent == VK_FALSE) {
// No depth attachment is present, validate that subpasses set depthStencilAttachment to VK_ATTACHMENT_UNUSED;
for (uint32_t i = 0; i < pCreateInfo->subpassCount; i++) {
- if (pCreateInfo->pSubpasses[i].depthStencilAttachment.attachment != VK_ATTACHMENT_UNUSED) {
+ if (pCreateInfo->pSubpasses[i].pDepthStencilAttachment &&
+ pCreateInfo->pSubpasses[i].pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED) {
std::stringstream ss;
ss << "vkCreateRenderPass has no depth/stencil attachment, yet subpass[" << i << "] has VkSubpassDescription::depthStencilAttachment value that is not VK_ATTACHMENT_UNUSED";
skipCall |= log_msg(my_data->report_data, VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType)0, 0, 0, IMAGE_RENDERPASS_INVALID_DS_ATTACHMENT, "IMAGE", ss.str().c_str());
diff --git a/layers/param_checker.cpp b/layers/param_checker.cpp
index fa304f37..2181e44f 100644
--- a/layers/param_checker.cpp
+++ b/layers/param_checker.cpp
@@ -3855,8 +3855,7 @@ bool PreCreateGraphicsPipelines(
"vkCreateGraphicsPipelines parameter, VkFillMode pCreateInfos->pRasterState->fillMode, is an unrecognized enumerator");
return false;
}
- if(pCreateInfos->pRasterState->cullMode < VK_CULL_MODE_BEGIN_RANGE ||
- pCreateInfos->pRasterState->cullMode > VK_CULL_MODE_END_RANGE)
+ if(pCreateInfos->pRasterState->cullMode & ~VK_CULL_MODE_FRONT_AND_BACK)
{
log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType)0, 0, 0, 1, "PARAMCHECK",
"vkCreateGraphicsPipelines parameter, VkCullMode pCreateInfos->pRasterState->cullMode, is an unrecognized enumerator");
@@ -4683,12 +4682,6 @@ bool PreCreateRenderPass(
}
if(pCreateInfo->pAttachments != nullptr)
{
- if(pCreateInfo->pAttachments->sType != VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION)
- {
- log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType)0, 0, 0, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, VkStructureType pCreateInfo->pAttachments->sType, is an invalid enumerator");
- return false;
- }
if(pCreateInfo->pAttachments->format < VK_FORMAT_BEGIN_RANGE ||
pCreateInfo->pAttachments->format > VK_FORMAT_END_RANGE)
{
@@ -4741,12 +4734,6 @@ bool PreCreateRenderPass(
}
if(pCreateInfo->pSubpasses != nullptr)
{
- if(pCreateInfo->pSubpasses->sType != VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION)
- {
- log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType)0, 0, 0, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, VkStructureType pCreateInfo->pSubpasses->sType, is an invalid enumerator");
- return false;
- }
if(pCreateInfo->pSubpasses->pipelineBindPoint < VK_PIPELINE_BIND_POINT_BEGIN_RANGE ||
pCreateInfo->pSubpasses->pipelineBindPoint > VK_PIPELINE_BIND_POINT_END_RANGE)
{
@@ -4784,11 +4771,12 @@ bool PreCreateRenderPass(
return false;
}
}
- if(pCreateInfo->pSubpasses->depthStencilAttachment.layout < VK_IMAGE_LAYOUT_BEGIN_RANGE ||
- pCreateInfo->pSubpasses->depthStencilAttachment.layout > VK_IMAGE_LAYOUT_END_RANGE)
+ if(pCreateInfo->pSubpasses->pDepthStencilAttachment &&
+ (pCreateInfo->pSubpasses->pDepthStencilAttachment->layout < VK_IMAGE_LAYOUT_BEGIN_RANGE ||
+ pCreateInfo->pSubpasses->pDepthStencilAttachment->layout > VK_IMAGE_LAYOUT_END_RANGE))
{
log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType)0, 0, 0, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, VkImageLayout pCreateInfo->pSubpasses->depthStencilAttachment.layout, is an unrecognized enumerator");
+ "vkCreateRenderPass parameter, VkImageLayout pCreateInfo->pSubpasses->pDepthStencilAttachment->layout, is an unrecognized enumerator");
return false;
}
if(pCreateInfo->pSubpasses->pPreserveAttachments != nullptr)
@@ -4804,12 +4792,6 @@ bool PreCreateRenderPass(
}
if(pCreateInfo->pDependencies != nullptr)
{
- if(pCreateInfo->pDependencies->sType != VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY)
- {
- log_msg(mdd(device), VK_DBG_REPORT_ERROR_BIT, (VkDbgObjectType)0, 0, 0, 1, "PARAMCHECK",
- "vkCreateRenderPass parameter, VkStructureType pCreateInfo->pDependencies->sType, is an invalid enumerator");
- return false;
- }
}
}