diff options
| author | Tobin Ehlis <tobine@ad.corp.google.com> | 2016-06-10 02:36:25 -0600 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2016-06-20 14:35:11 -0600 |
| commit | a6ab2abe79559aa76df2283abea52893c9da31b9 (patch) | |
| tree | dd638b833d88e84e1c2113a134f1b4188e739019 /layers/core_validation.cpp | |
| parent | ec3a39879cb2caa9d091216efc69a4895425f865 (diff) | |
| download | usermoji-a6ab2abe79559aa76df2283abea52893c9da31b9.tar.xz | |
layers: Add bug fix to handle NULL attachment case
Correctly handle null resolve attachment case. When verifying attachment
compatibility, matching null resolves is ok.
Diffstat (limited to 'layers/core_validation.cpp')
| -rw-r--r-- | layers/core_validation.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index b4d8e510..a95f99b7 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -2133,6 +2133,15 @@ static bool attachment_references_compatible(const uint32_t index, const VkAttac const uint32_t primaryCount, const VkAttachmentDescription *pPrimaryAttachments, const VkAttachmentReference *pSecondary, const uint32_t secondaryCount, const VkAttachmentDescription *pSecondaryAttachments) { + // Check potential NULL cases first to avoid nullptr issues later + if (pPrimary == nullptr) { + if (pSecondary == nullptr) { + return true; + } + return false; + } else if (pSecondary == nullptr) { + return false; + } if (index >= primaryCount) { // Check secondary as if primary is VK_ATTACHMENT_UNUSED if (VK_ATTACHMENT_UNUSED == pSecondary[index].attachment) return true; @@ -2150,7 +2159,7 @@ static bool attachment_references_compatible(const uint32_t index, const VkAttac return false; } -// For give primary and secondary RenderPass objects, verify that they're compatible +// For given primary and secondary RenderPass objects, verify that they're compatible static bool verify_renderpass_compatibility(const layer_data *my_data, const VkRenderPass primaryRP, const VkRenderPass secondaryRP, string &errorMsg) { auto primary_render_pass = getRenderPass(my_data, primaryRP); @@ -8248,6 +8257,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateFramebuffer(VkDevice device, const VkFrameb VkFramebuffer *pFramebuffer) { bool skip_call = false; VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; + // TODO : Verify that renderPass FB is created with is compatible with FB layer_data *dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); skip_call |= ValidateAttachmentImageUsage(dev_data, pCreateInfo); |
