layers: Remove validation errors for CmdBindPipeline during active render pass
CmdBindPipeline can be inside OR outside a render pass.
diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp
index 812b8fc..a9f30fb 100644
--- a/layers/draw_state.cpp
+++ b/layers/draw_state.cpp
@@ -3566,29 +3566,18 @@
if (pCB) {
if (pCB->state == CB_RECORDING) {
skipCall |= addCmd(dev_data, pCB, CMD_BINDPIPELINE);
- if ((VK_PIPELINE_BIND_POINT_COMPUTE == pipelineBindPoint) && (pCB->activeRenderPass)) {
- skipCall |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_PIPELINE, (uint64_t) pipeline,
- 0, DRAWSTATE_INVALID_RENDERPASS_CMD, "DS",
- "Incorrectly binding compute pipeline (%#" PRIxLEAST64 ") during active RenderPass (%#" PRIxLEAST64 ")",
- (uint64_t) pipeline, (uint64_t) pCB->activeRenderPass);
- } else if ((VK_PIPELINE_BIND_POINT_GRAPHICS == pipelineBindPoint) && (!pCB->activeRenderPass)) {
- skipCall |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_PIPELINE, (uint64_t) pipeline,
- 0, DRAWSTATE_NO_ACTIVE_RENDERPASS, "DS", "Incorrectly binding graphics pipeline "
- " (%#" PRIxLEAST64 ") without an active RenderPass", (uint64_t) pipeline);
+ PIPELINE_NODE* pPN = getPipeline(dev_data, pipeline);
+ if (pPN) {
+ pCB->lastBoundPipeline = pipeline;
+ loader_platform_thread_lock_mutex(&globalLock);
+ set_cb_pso_status(pCB, pPN);
+ g_lastBoundPipeline = pPN;
+ loader_platform_thread_unlock_mutex(&globalLock);
+ skipCall |= validatePipelineState(dev_data, pCB, pipelineBindPoint, pipeline);
} else {
- PIPELINE_NODE* pPN = getPipeline(dev_data, pipeline);
- if (pPN) {
- pCB->lastBoundPipeline = pipeline;
- loader_platform_thread_lock_mutex(&globalLock);
- set_cb_pso_status(pCB, pPN);
- g_lastBoundPipeline = pPN;
- loader_platform_thread_unlock_mutex(&globalLock);
- skipCall |= validatePipelineState(dev_data, pCB, pipelineBindPoint, pipeline);
- } else {
- skipCall |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_PIPELINE, (uint64_t) pipeline,
- 0, DRAWSTATE_INVALID_PIPELINE, "DS",
- "Attempt to bind Pipeline %#" PRIxLEAST64 " that doesn't exist!", reinterpret_cast<uint64_t>(pipeline));
- }
+ skipCall |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_PIPELINE, (uint64_t) pipeline,
+ 0, DRAWSTATE_INVALID_PIPELINE, "DS",
+ "Attempt to bind Pipeline %#" PRIxLEAST64 " that doesn't exist!", reinterpret_cast<uint64_t>(pipeline));
}
} else {
skipCall |= report_error_no_cb_begin(dev_data, commandBuffer, "vkCmdBindPipeline()");
diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp
index 7e0e50f..dac9776 100644
--- a/tests/layer_validation_tests.cpp
+++ b/tests/layer_validation_tests.cpp
@@ -1313,105 +1313,6 @@
}
}
-TEST_F(VkLayerTest, BindPipelineNoRenderPass)
-{
- // Initiate Draw w/o a PSO bound
- VkResult err;
-
- m_errorMonitor->SetDesiredFailureMsg(VK_DEBUG_REPORT_ERROR_BIT,
- "Incorrectly binding graphics pipeline ");
-
- ASSERT_NO_FATAL_FAILURE(InitState());
- ASSERT_NO_FATAL_FAILURE(InitRenderTarget());
-
- VkDescriptorPoolSize ds_type_count = {};
- ds_type_count.type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
- ds_type_count.descriptorCount = 1;
-
- VkDescriptorPoolCreateInfo ds_pool_ci = {};
- ds_pool_ci.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
- ds_pool_ci.pNext = NULL;
- ds_pool_ci.maxSets = 1;
- ds_pool_ci.poolSizeCount = 1;
- ds_pool_ci.pPoolSizes = &ds_type_count;
-
- VkDescriptorPool ds_pool;
- err = vkCreateDescriptorPool(m_device->device(), &ds_pool_ci, NULL, &ds_pool);
- ASSERT_VK_SUCCESS(err);
-
- VkDescriptorSetLayoutBinding dsl_binding = {};
- dsl_binding.binding = 0;
- dsl_binding.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
- dsl_binding.descriptorCount = 1;
- dsl_binding.stageFlags = VK_SHADER_STAGE_ALL;
- dsl_binding.pImmutableSamplers = NULL;
-
- VkDescriptorSetLayoutCreateInfo ds_layout_ci = {};
- ds_layout_ci.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
- ds_layout_ci.pNext = NULL;
- ds_layout_ci.bindingCount = 1;
- ds_layout_ci.pBinding = &dsl_binding;
-
- VkDescriptorSetLayout ds_layout;
- err = vkCreateDescriptorSetLayout(m_device->device(), &ds_layout_ci, NULL, &ds_layout);
- ASSERT_VK_SUCCESS(err);
-
- VkDescriptorSet descriptorSet;
- VkDescriptorSetAllocateInfo alloc_info = {};
- alloc_info.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
- alloc_info.setLayoutCount = 1;
- alloc_info.descriptorPool = ds_pool;
- alloc_info.pSetLayouts = &ds_layout;
- err = vkAllocateDescriptorSets(m_device->device(), &alloc_info, &descriptorSet);
- ASSERT_VK_SUCCESS(err);
- VkPipelineMultisampleStateCreateInfo pipe_ms_state_ci = {};
- pipe_ms_state_ci.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
- pipe_ms_state_ci.pNext = NULL;
- pipe_ms_state_ci.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT;
- pipe_ms_state_ci.sampleShadingEnable = 0;
- pipe_ms_state_ci.minSampleShading = 1.0;
- pipe_ms_state_ci.pSampleMask = NULL;
-
- VkPipelineLayoutCreateInfo pipeline_layout_ci = {};
- pipeline_layout_ci.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
- pipeline_layout_ci.pNext = NULL;
- pipeline_layout_ci.setLayoutCount = 1;
- pipeline_layout_ci.pSetLayouts = &ds_layout;
- VkPipelineLayout pipeline_layout;
-
- err = vkCreatePipelineLayout(m_device->device(), &pipeline_layout_ci, NULL, &pipeline_layout);
- ASSERT_VK_SUCCESS(err);
-
- VkShaderObj vs(m_device, bindStateVertShaderText, VK_SHADER_STAGE_VERTEX_BIT, this);
- VkShaderObj fs(m_device, bindStateFragShaderText, VK_SHADER_STAGE_FRAGMENT_BIT, this); // TODO - We shouldn't need a fragment shader
- // but add it to be able to run on more devices
- VkPipelineObj pipe(m_device);
- pipe.AddShader(&vs);
- pipe.AddShader(&fs);
- pipe.SetMSAA(&pipe_ms_state_ci);
- pipe.CreateVKPipeline(pipeline_layout, renderPass());
-
- // Calls AllocateCommandBuffers
- VkCommandBufferObj commandBuffer(m_device, m_commandPool);
- VkCommandBufferBeginInfo cmd_buf_info = {};
- memset(&cmd_buf_info, 0, sizeof(VkCommandBufferBeginInfo));
- cmd_buf_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
- cmd_buf_info.pNext = NULL;
- cmd_buf_info.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
-
- vkBeginCommandBuffer(commandBuffer.GetBufferHandle(), &cmd_buf_info);
- vkCmdBindPipeline(commandBuffer.GetBufferHandle(), VK_PIPELINE_BIND_POINT_GRAPHICS, pipe.handle());
-
- if (!m_errorMonitor->DesiredMsgFound()) {
- FAIL() << "Did not receive Error 'Incorrectly binding graphics pipeline (0x<handle>) without an active RenderPass'";
- m_errorMonitor->DumpFailureMsgs();
- }
-
- vkDestroyPipelineLayout(m_device->device(), pipeline_layout, NULL);
- vkDestroyDescriptorSetLayout(m_device->device(), ds_layout, NULL);
- vkDestroyDescriptorPool(m_device->device(), ds_pool, NULL);
-}
-
TEST_F(VkLayerTest, AllocDescriptorFromEmptyPool)
{
// Initiate Draw w/o a PSO bound