Skip to content

Commit

Permalink
practices: Fix BestPractices-ImageBarrierAccessLayout again
Browse files Browse the repository at this point in the history
It turns out that the table from KhronosGroup#2918 had an implicit "(can be 0)"
on almost every line. The 2 weird cases are:
GENERAL - Any (must not be 0)
PRESENT_SRC_KHR - Must be 0

Fixes KhronosGroup#4735
  • Loading branch information
jeremyg-lunarg committed Nov 2, 2022
1 parent 18a0e59 commit d782e0a
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions layers/best_practices_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1615,18 +1615,18 @@ bool BestPractices::ValidateAccessLayoutCombination(const std::string& api_name,
VkImageAspectFlags aspect) const {
bool skip = false;

const VkAccessFlags all = VK_ACCESS_FLAG_BITS_MAX_ENUM;
bool none_allowed = false;
VkAccessFlags allowed = 0;
const VkAccessFlags2 all = UINT64_MAX; // core validation is responsible for detecting undefined flags.
bool none_allowed = true;
VkAccessFlags2 allowed = 0;

// Combinations taken from https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/2918
switch (layout) {
case VK_IMAGE_LAYOUT_UNDEFINED:
allowed = all;
none_allowed = true;
break;
case VK_IMAGE_LAYOUT_GENERAL:
allowed = all;
none_allowed = false; // PR table says "Any (must not be 0)"
break;
case VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL:
allowed = VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT |
Expand Down Expand Up @@ -1679,12 +1679,10 @@ bool BestPractices::ValidateAccessLayoutCombination(const std::string& api_name,
allowed = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT;
break;
case VK_IMAGE_LAYOUT_PRESENT_SRC_KHR:
allowed = VK_ACCESS_NONE;
none_allowed = true;
allowed = VK_ACCESS_NONE; // PR table says "Must be 0"
break;
case VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR:
allowed = all;
none_allowed = true;
break;
case VK_IMAGE_LAYOUT_SHADING_RATE_OPTIMAL_NV:
allowed = VK_ACCESS_SHADING_RATE_IMAGE_READ_BIT_NV;
Expand Down

0 comments on commit d782e0a

Please sign in to comment.