From: Tobin Ehlis Date: Wed, 4 Jan 2017 16:21:17 +0000 (-0700) Subject: layers:Remove redundant checks X-Git-Tag: upstream/1.1.92~1798 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=889f831f563078786947b0a07ccef09e6b86f6de;p=platform%2Fupstream%2FVulkan-Tools.git layers:Remove redundant checks Remove duplicate checks from core_validation that are already handled in object_tracker. --- diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 04a5fdd..307cfd7 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -7305,45 +7305,30 @@ BeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo commandBuffer, validation_error_map[VALIDATION_ERROR_00106]); } else { if (pBeginInfo->flags & VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT) { - if (!pInfo->renderPass) { // renderpass should NOT be null for a Secondary CB - skip_call |= - log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, - VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, reinterpret_cast(commandBuffer), - __LINE__, VALIDATION_ERROR_00110, "DS", "vkBeginCommandBuffer(): Secondary Command Buffers " - "(0x%p) must specify a valid renderpass parameter. %s", - commandBuffer, validation_error_map[VALIDATION_ERROR_00110]); - } - if (!pInfo->framebuffer) { // framebuffer may be null for a Secondary CB, but this affects perf - skip_call |= log_msg( - dev_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, - reinterpret_cast(commandBuffer), __LINE__, DRAWSTATE_BEGIN_CB_INVALID_STATE, "DS", - "vkBeginCommandBuffer(): Secondary Command Buffers (0x%p) may perform better if a " - "valid framebuffer parameter is specified.", - commandBuffer); - } else { - string errorString = ""; - auto framebuffer = getFramebufferState(dev_data, pInfo->framebuffer); - if (framebuffer) { - if ((framebuffer->createInfo.renderPass != pInfo->renderPass) && - !verify_renderpass_compatibility(dev_data, framebuffer->renderPassCreateInfo.ptr(), - getRenderPassState(dev_data, pInfo->renderPass)->createInfo.ptr(), - errorString)) { - // renderPass that framebuffer was created with must be compatible with local renderPass - skip_call |= log_msg( - dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, - VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, reinterpret_cast(commandBuffer), - __LINE__, VALIDATION_ERROR_00112, "DS", - "vkBeginCommandBuffer(): Secondary Command " - "Buffer (0x%p) renderPass (0x%" PRIxLEAST64 ") is incompatible w/ framebuffer " - "(0x%" PRIxLEAST64 ") w/ render pass (0x%" PRIxLEAST64 ") due to: %s. %s", - commandBuffer, reinterpret_cast(pInfo->renderPass), - reinterpret_cast(pInfo->framebuffer), - reinterpret_cast(framebuffer->createInfo.renderPass), errorString.c_str(), - validation_error_map[VALIDATION_ERROR_00112]); - } - // Connect this framebuffer and its children to this cmdBuffer - AddFramebufferBinding(dev_data, cb_node, framebuffer); + // Object_tracker makes sure these objects are valid + assert(pInfo->renderPass); + assert(pInfo->framebuffer); + string errorString = ""; + auto framebuffer = getFramebufferState(dev_data, pInfo->framebuffer); + if (framebuffer) { + if ((framebuffer->createInfo.renderPass != pInfo->renderPass) && + !verify_renderpass_compatibility(dev_data, framebuffer->renderPassCreateInfo.ptr(), + getRenderPassState(dev_data, pInfo->renderPass)->createInfo.ptr(), + errorString)) { + // renderPass that framebuffer was created with must be compatible with local renderPass + skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, + VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, + reinterpret_cast(commandBuffer), __LINE__, VALIDATION_ERROR_00112, "DS", + "vkBeginCommandBuffer(): Secondary Command " + "Buffer (0x%p) renderPass (0x%" PRIxLEAST64 ") is incompatible w/ framebuffer " + "(0x%" PRIxLEAST64 ") w/ render pass (0x%" PRIxLEAST64 ") due to: %s. %s", + commandBuffer, reinterpret_cast(pInfo->renderPass), + reinterpret_cast(pInfo->framebuffer), + reinterpret_cast(framebuffer->createInfo.renderPass), + errorString.c_str(), validation_error_map[VALIDATION_ERROR_00112]); } + // Connect this framebuffer and its children to this cmdBuffer + AddFramebufferBinding(dev_data, cb_node, framebuffer); } } if ((pInfo->occlusionQueryEnable == VK_FALSE || dev_data->enabled_features.occlusionQueryPrecise == VK_FALSE) &&