Skip to content

Commit b45db11

Browse files
bp: Fix BP tests to work with validation
1 parent 3c8c495 commit b45db11

File tree

8 files changed

+122
-260
lines changed

8 files changed

+122
-260
lines changed

layers/best_practices/bp_pipeline.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -146,27 +146,6 @@ bool BestPractices::ValidateCreateGraphicsPipeline(const VkGraphicsPipelineCreat
146146
}
147147
}
148148

149-
for (const auto& stage : pipeline.stage_states) {
150-
if (stage.GetStage() != VK_SHADER_STAGE_FRAGMENT_BIT) {
151-
continue;
152-
}
153-
const auto& rp_state = pipeline.RenderPassState();
154-
if (rp_state && !rp_state->UsesDynamicRendering() && stage.entrypoint) {
155-
auto rpci = rp_state->create_info.ptr();
156-
auto subpass = pipeline.Subpass();
157-
for (const auto& variable : stage.entrypoint->resource_interface_variables) {
158-
if (!variable.decorations.Has(spirv::DecorationSet::input_attachment_bit)) {
159-
continue;
160-
}
161-
auto slot = variable.decorations.input_attachment_index_start;
162-
if (!rpci->pSubpasses[subpass].pInputAttachments || slot >= rpci->pSubpasses[subpass].inputAttachmentCount) {
163-
const LogObjectList objlist(stage.module_state->Handle(), pipeline.PipelineLayoutState()->Handle());
164-
skip |= LogWarning("BestPractices-Shader-MissingInputAttachment", device, create_info_loc,
165-
"Shader consumes input attachment index %" PRIu32 " but not provided in subpass", slot);
166-
}
167-
}
168-
}
169-
}
170149
return skip;
171150
}
172151

layers/best_practices/bp_render_pass.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,6 @@ bool BestPractices::ValidateCmdBeginRenderPass(VkCommandBuffer commandBuffer, co
169169

170170
if (!pRenderPassBegin) return skip;
171171

172-
if (pRenderPassBegin->renderArea.extent.width == 0 || pRenderPassBegin->renderArea.extent.height == 0) {
173-
skip |= LogWarning("BestPractices-Arm-vkCmdBeginRenderPass-zero-size-render-area", commandBuffer, loc,
174-
"This render pass has a zero-size render area. It cannot write to any attachments, "
175-
"and can only be used for side effects such as layout transitions.");
176-
}
177-
178172
auto rp_state = Get<vvl::RenderPass>(pRenderPassBegin->renderPass);
179173
ASSERT_AND_RETURN_SKIP(rp_state);
180174

tests/framework/layer_validation_tests.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,7 @@ class VkBestPracticesLayerTest : public VkLayerTest {
242242

243243
protected:
244244
VkValidationFeatureEnableEXT enables_[1] = {VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT};
245-
VkValidationFeatureDisableEXT disables_[4] = {
246-
VK_VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT, VK_VALIDATION_FEATURE_DISABLE_API_PARAMETERS_EXT,
247-
VK_VALIDATION_FEATURE_DISABLE_OBJECT_LIFETIMES_EXT, VK_VALIDATION_FEATURE_DISABLE_CORE_CHECKS_EXT};
248-
VkValidationFeaturesEXT features_ = {VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT, nullptr, 1, enables_, 4, disables_};
245+
VkValidationFeaturesEXT features_ = {VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT, nullptr, 1, enables_, 0, nullptr};
249246
};
250247

251248
class VkAmdBestPracticesLayerTest : public VkBestPracticesLayerTest {};

tests/unit/amd_best_practices.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ TEST_F(VkAmdBestPracticesLayerTest, UseMutableRT) {
8282
vk::CreateImage(m_device->handle(), &img_info, nullptr, &test_image);
8383
m_errorMonitor->VerifyFound();
8484

85+
m_errorMonitor->SetAllowedFailureMsg("VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251");
8586
m_errorMonitor->SetDesiredFailureMsg(kPerformanceWarningBit, "BestPractices-AMD-vkImage-DontUseMutableRenderTargets");
8687
// create a depth attachment image with mutable bit set
8788
img_info = {VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
@@ -162,6 +163,7 @@ TEST_F(VkAmdBestPracticesLayerTest, UsageConcurentRT) {
162163
vk::CreateImage(m_device->handle(), &img_info, nullptr, &test_image);
163164
m_errorMonitor->VerifyFound();
164165

166+
m_errorMonitor->SetAllowedFailureMsg("VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251");
165167
m_errorMonitor->SetDesiredFailureMsg(kPerformanceWarningBit, "BestPractices-AMD-vkImage-AvoidConcurrentRenderTargets");
166168
// create a render target image with mutable bit set
167169
img_info = {VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
@@ -416,6 +418,7 @@ TEST_F(VkAmdBestPracticesLayerTest, ClearImage) {
416418
0,
417419
nullptr,
418420
VK_IMAGE_LAYOUT_UNDEFINED};
421+
m_errorMonitor->SetAllowedFailureMsg("VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251");
419422
vkt::Image image_1D(*m_device, img_info, vkt::set_layout);
420423

421424
m_commandBuffer->begin();
@@ -462,7 +465,6 @@ TEST_F(VkAmdBestPracticesLayerTest, ImageToImageCopy) {
462465

463466
img_info.tiling = VK_IMAGE_TILING_LINEAR;
464467
img_info.usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT;
465-
img_info.initialLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
466468
vkt::Image image_1D_2(*m_device, img_info, vkt::set_layout);
467469
if (!image_1D_2.initialized()) {
468470
GTEST_SKIP() << "Could not initilize Linear image, skipping image to image copy test";
@@ -636,6 +638,7 @@ TEST_F(VkAmdBestPracticesLayerTest, NumberOfSubmissions) {
636638

637639
m_errorMonitor->SetDesiredFailureMsg(kPerformanceWarningBit, "BestPractices-Submission-ReduceNumberOfSubmissions");
638640
m_errorMonitor->SetUnexpectedError("VUID-VkPresentInfoKHR-pImageIndices-01430");
641+
m_errorMonitor->SetUnexpectedError("UNASSIGNED-VkPresentInfoKHR-pImageIndices-MissingAcquireWait");
639642

640643
vk::QueuePresentKHR(m_default_queue->handle(), &present_info);
641644

tests/unit/arm_best_practices.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ TEST_F(VkArmBestPracticesLayerTest, TooManySamples) {
103103
RETURN_IF_SKIP(InitState());
104104

105105
m_errorMonitor->SetDesiredFailureMsg(kPerformanceWarningBit, "BestPractices-Arm-vkCreateImage-too-large-sample-count");
106+
m_errorMonitor->SetAllowedFailureMsg("VUID-VkImageCreateInfo-samples-02258");
106107

107108
VkImageCreateInfo image_info{};
108109
image_info.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
@@ -245,7 +246,7 @@ TEST_F(VkArmBestPracticesLayerTest, AttachmentNeedsReadback) {
245246
auto image_view = image.CreateView();
246247

247248
RenderPassSingleSubpass rp(*this);
248-
rp.AddAttachmentDescription(VK_FORMAT_R8G8B8A8_UNORM, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_UNDEFINED,
249+
rp.AddAttachmentDescription(VK_FORMAT_R8G8B8A8_UNORM, VK_IMAGE_LAYOUT_GENERAL, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
249250
VK_ATTACHMENT_LOAD_OP_LOAD, VK_ATTACHMENT_STORE_OP_STORE);
250251
rp.AddAttachmentReference({0, VK_IMAGE_LAYOUT_GENERAL});
251252
rp.AddColorAttachment(0);
@@ -781,7 +782,7 @@ TEST_F(VkArmBestPracticesLayerTest, ComputeShaderBadWorkGroupThreadAlignmentTest
781782
m_errorMonitor->VerifyFound();
782783
}
783784

784-
{
785+
if (m_device->phy().limits_.maxComputeWorkGroupInvocations > 128) {
785786
char const* csSource = R"glsl(
786787
#version 450
787788
layout(local_size_x = 16, local_size_y = 9, local_size_z = 1) in;
@@ -960,6 +961,7 @@ TEST_F(VkArmBestPracticesLayerTest, RedundantRenderPassStore) {
960961
render_pass_begin_info.framebuffer = framebuffers[0];
961962
render_pass_begin_info.clearValueCount = 3;
962963
render_pass_begin_info.pClearValues = clear_values;
964+
render_pass_begin_info.renderArea.extent = {32, 32};
963965

964966
const auto execute_work = [&](const std::function<void(vkt::CommandBuffer & command_buffer)>& work) {
965967
vk::ResetCommandPool(device(), m_command_pool.handle(), 0);
@@ -987,6 +989,7 @@ TEST_F(VkArmBestPracticesLayerTest, RedundantRenderPassStore) {
987989
rpbi.framebuffer = framebuffers[1];
988990
rpbi.clearValueCount = 3;
989991
rpbi.pClearValues = clear_values;
992+
rpbi.renderArea.extent = {32, 32};
990993

991994
command_buffer.BeginRenderPass(rpbi);
992995

0 commit comments

Comments
 (0)