diff options
| author | Tobin Ehlis <tobine@google.com> | 2018-02-08 13:30:56 -0700 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2018-02-15 06:50:20 -0700 |
| commit | 44655aa0ce83e9d2e09f76198a96588bc763b3c1 (patch) | |
| tree | c7f39a4e92ec44b8aca8d8ad929aa6e2f17fcd5b /layers/core_validation.cpp | |
| parent | 88385743b91cf9f94ba83a02be329d9453347c6b (diff) | |
| download | usermoji-44655aa0ce83e9d2e09f76198a96588bc763b3c1.tar.xz | |
layers:Add sparse mem warning if reqs not checked
If vkQueueBindSparse() is called to bind sparse memory to an image,
trigger a warning if the user has not queried sparse requirements for
that image.
Diffstat (limited to 'layers/core_validation.cpp')
| -rw-r--r-- | layers/core_validation.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 22c963d6..466007aa 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -9744,6 +9744,33 @@ static bool PreCallValidateQueueBindSparse(layer_data *dev_data, VkQueue queue, } } } + // Store sparse binding image_state and after binding is complete make sure that any requiring metadata have it bound + std::unordered_set<IMAGE_STATE *> sparse_images; + // If we're binding sparse image memory make sure reqs were queried and note if metadata is required and bound + for (uint32_t i = 0; i < bindInfo.imageBindCount; ++i) { + const auto &opaque_bind = bindInfo.pImageOpaqueBinds[i]; + auto image_state = GetImageState(dev_data, opaque_bind.image); + sparse_images.insert(image_state); + if (!image_state->get_sparse_reqs_called || image_state->sparse_requirements.empty()) { + // For now just warning if sparse image binding occurs without calling to get reqs first + return log_msg(dev_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + HandleToUint64(image_state->image), __LINE__, MEMTRACK_INVALID_STATE, "CV", + "vkQueueBindSparse(): Binding sparse memory to image 0x%" PRIx64 + " without first calling vkGetImageSparseMemoryRequirements[2KHR]() to retrieve requirements.", + HandleToUint64(image_state->image)); + } + } + for (uint32_t i = 0; i < bindInfo.imageOpaqueBindCount; ++i) { + auto image_state = GetImageState(dev_data, bindInfo.pImageOpaqueBinds[i].image); + if (!image_state->get_sparse_reqs_called || image_state->sparse_requirements.empty()) { + // For now just warning if sparse image binding occurs without calling to get reqs first + return log_msg(dev_data->report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + HandleToUint64(image_state->image), __LINE__, MEMTRACK_INVALID_STATE, "CV", + "vkQueueBindSparse(): Binding opaque sparse memory to image 0x%" PRIx64 + " without first calling vkGetImageSparseMemoryRequirements[2KHR]() to retrieve requirements.", + HandleToUint64(image_state->image)); + } + } } return skip; |
