Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

layers: Cleanup vkCmdBeginRendering #9138

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions layers/best_practices/bp_render_pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,21 +265,20 @@ bool BestPractices::ValidateCmdBeginRenderPass(VkCommandBuffer commandBuffer, co
bool BestPractices::ValidateCmdBeginRendering(VkCommandBuffer commandBuffer, const VkRenderingInfo* pRenderingInfo,
const Location& loc) const {
bool skip = false;
const Location rendering_info = loc.dot(Field::pRenderingInfo);
const Location rendering_info_loc = loc.dot(Field::pRenderingInfo);

for (uint32_t i = 0; i < pRenderingInfo->colorAttachmentCount; ++i) {
const auto& color_attachment = pRenderingInfo->pColorAttachments[i];
const Location color_attachment_info = rendering_info.dot(Field::pColorAttachments, i);
const VkRenderingAttachmentInfo& color_attachment = pRenderingInfo->pColorAttachments[i];
if (color_attachment.imageView == VK_NULL_HANDLE) continue;
const Location color_attachment_loc = rendering_info_loc.dot(Field::pColorAttachments, i);

auto image_view_state = Get<vvl::ImageView>(color_attachment.imageView);
if (!image_view_state) {
continue;
}
ASSERT_AND_CONTINUE(image_view_state);

if (VendorCheckEnabled(kBPVendorNVIDIA)) {
if (color_attachment.loadOp == VK_ATTACHMENT_LOAD_OP_CLEAR) {
const VkFormat format = image_view_state->create_info.format;
skip |= ValidateClearColor(commandBuffer, format, color_attachment.clearValue.color, color_attachment_info);
skip |= ValidateClearColor(commandBuffer, format, color_attachment.clearValue.color, color_attachment_loc);
}
}

Expand All @@ -290,7 +289,7 @@ bool BestPractices::ValidateCmdBeginRendering(VkCommandBuffer commandBuffer, con
image_view_state->image_state->create_info.samples != VK_SAMPLE_COUNT_1_BIT) {
const LogObjectList objlist(commandBuffer, resolve_image_view_state->Handle(), image_view_state->Handle());
skip |= LogWarning("BestPractices-VkRenderingInfo-ResolveModeNone", commandBuffer,
color_attachment_info.dot(Field::resolveMode),
color_attachment_loc.dot(Field::resolveMode),
"is VK_RESOLVE_MODE_NONE but resolveImageView is pointed to a valid VkImageView with "
"VK_SAMPLE_COUNT_1_BIT and imageView is pointed to a VkImageView with %s. If "
"VK_RESOLVE_MODE_NONE is set, the resolveImageView value is ignored.",
Expand Down
18 changes: 9 additions & 9 deletions layers/core_checks/cc_cmd_buffer.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Copyright (c) 2015-2024 The Khronos Group Inc.
* Copyright (c) 2015-2024 Valve Corporation
* Copyright (c) 2015-2024 LunarG, Inc.
* Copyright (C) 2015-2024 Google Inc.
/* Copyright (c) 2015-2025 The Khronos Group Inc.
* Copyright (c) 2015-2025 Valve Corporation
* Copyright (c) 2015-2025 LunarG, Inc.
* Copyright (C) 2015-2025 Google Inc.
* Modifications Copyright (C) 2020-2022 Advanced Micro Devices, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -226,11 +226,11 @@ bool CoreChecks::PreCallValidateBeginCommandBuffer(VkCommandBuffer commandBuffer

if (MostSignificantBit(p_inherited_rendering_info->viewMask) >=
static_cast<int32_t>(phys_dev_props_core11.maxMultiviewViewCount)) {
skip |= LogError("VUID-VkCommandBufferInheritanceRenderingInfo-viewMask-06009", commandBuffer,
inheritance_loc.pNext(Struct::VkCommandBufferInheritanceRenderingInfo, Field::viewMask),
"(0x%" PRIx32 ") most significant bit is superior or equal to maxMultiviewViewCount (%" PRIu32
").",
p_inherited_rendering_info->viewMask, phys_dev_props_core11.maxMultiviewViewCount);
skip |=
LogError("VUID-VkCommandBufferInheritanceRenderingInfo-viewMask-06009", commandBuffer,
inheritance_loc.pNext(Struct::VkCommandBufferInheritanceRenderingInfo, Field::viewMask),
"(0x%" PRIx32 ") most significant bit is greater or equal to maxMultiviewViewCount (%" PRIu32 ").",
p_inherited_rendering_info->viewMask, phys_dev_props_core11.maxMultiviewViewCount);
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions layers/core_checks/cc_image_layout.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Copyright (c) 2015-2024 The Khronos Group Inc.
* Copyright (c) 2015-2024 Valve Corporation
* Copyright (c) 2015-2024 LunarG, Inc.
* Copyright (C) 2015-2024 Google Inc.
/* Copyright (c) 2015-2025 The Khronos Group Inc.
* Copyright (c) 2015-2025 Valve Corporation
* Copyright (c) 2015-2025 LunarG, Inc.
* Copyright (C) 2015-2025 Google Inc.
* Modifications Copyright (C) 2020-2022 Advanced Micro Devices, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -656,13 +656,13 @@ bool CoreChecks::VerifyFramebufferAndRenderPassLayouts(const vvl::CommandBuffer
for (uint32_t k = 0; k < render_pass_info->pSubpasses[j].colorAttachmentCount; ++k) {
auto &attachment_ref = subpass.pColorAttachments[k];
if (attachment_ref.attachment == VK_ATTACHMENT_UNUSED) continue;
const Location color_loc = subpass_loc.dot(Field::pColorAttachments, k);
const Location color_attachment_loc = subpass_loc.dot(Field::pColorAttachments, k);
auto image_view = attachments[attachment_ref.attachment];

if (auto view_state = Get<vvl::ImageView>(image_view)) {
skip |= ValidateRenderPassLayoutAgainstFramebufferImageUsage(attachment_ref.layout, *view_state, framebuffer,
render_pass, attachment_ref.attachment, rp_loc,
color_loc.dot(Field::layout));
color_attachment_loc.dot(Field::layout));
if (subpass.pResolveAttachments) {
skip |= ValidateRenderPassLayoutAgainstFramebufferImageUsage(
attachment_ref.layout, *view_state, framebuffer, render_pass, attachment_ref.attachment, rp_loc,
Expand Down
Loading
Loading