aboutsummaryrefslogtreecommitdiff
path: root/layers
diff options
context:
space:
mode:
authorMichael Lentine <mlentine@google.com>2016-01-28 14:20:46 -0600
committerTobin Ehlis <tobine@google.com>2016-02-03 15:51:51 -0700
commit52ef57d311940634489550540a7c19bf7c952958 (patch)
tree8fe16230f83d2b4864aec879fb9cebddfdb268b2 /layers
parent62da1b807d86e45449c7aaf714de3d939f8bee09 (diff)
downloadusermoji-52ef57d311940634489550540a7c19bf7c952958.tar.xz
layers: Add check to make sure inherited queries in enabled before use.
Diffstat (limited to 'layers')
-rw-r--r--layers/device_limits.cpp16
-rw-r--r--layers/device_limits.h1
-rw-r--r--layers/vk_validation_layer_details.md1
3 files changed, 18 insertions, 0 deletions
diff --git a/layers/device_limits.cpp b/layers/device_limits.cpp
index 699abf4d..54d01769 100644
--- a/layers/device_limits.cpp
+++ b/layers/device_limits.cpp
@@ -540,6 +540,20 @@ VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkFreeCommandBuffers(VkDevice device,
get_my_data_ptr(get_dispatch_key(device), layer_data_map)->device_dispatch_table->FreeCommandBuffers(device, commandPool, count, pCommandBuffers);
}
+VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo* pBeginInfo)
+{
+ bool skipCall = false;
+ layer_data *dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
+ const VkCommandBufferInheritanceInfo *pInfo = pBeginInfo->pInheritanceInfo;
+ if (dev_data->actualPhysicalDeviceFeatures.inheritedQueries == VK_FALSE && pInfo && pInfo->occlusionQueryEnable != VK_FALSE) {
+ skipCall |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, reinterpret_cast<uint64_t>(commandBuffer), __LINE__,
+ DEVLIMITS_INVALID_INHERITED_QUERY, "DL",
+ "Cannot set inherited occlusionQueryEnable in vkBeginCommandBuffer() when device does not support inheritedQueries.");
+ }
+ if (!skipCall)
+ dev_data->device_dispatch_table->BeginCommandBuffer(commandBuffer, pBeginInfo);
+}
+
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue)
{
VkBool32 skipCall = VK_FALSE;
@@ -739,6 +753,8 @@ VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkD
return (PFN_vkVoidFunction) vkAllocateCommandBuffers;
if (!strcmp(funcName, "vkFreeCommandBuffers"))
return (PFN_vkVoidFunction) vkFreeCommandBuffers;
+ if (!strcmp(funcName, "vkBeginCommandBuffer"))
+ return (PFN_vkVoidFunction) vkBeginCommandBuffer;
if (!strcmp(funcName, "vkCmdUpdateBuffer"))
return (PFN_vkVoidFunction) vkCmdUpdateBuffer;
if (!strcmp(funcName, "vkBindBufferMemory"))
diff --git a/layers/device_limits.h b/layers/device_limits.h
index ac6e23ea..3ef91043 100644
--- a/layers/device_limits.h
+++ b/layers/device_limits.h
@@ -41,6 +41,7 @@ typedef enum _DEV_LIMITS_ERROR
DEVLIMITS_NONE, // Used for INFO & other non-error messages
DEVLIMITS_INVALID_INSTANCE, // Invalid instance used
DEVLIMITS_INVALID_PHYSICAL_DEVICE, // Invalid physical device used
+ DEVLIMITS_INVALID_INHERITED_QUERY, // Invalid use of inherited query
DEVLIMITS_MUST_QUERY_COUNT, // Failed to make initial call to an API to query the count
DEVLIMITS_MUST_QUERY_PROPERTIES, // Failed to make initial call to an API to query properties
DEVLIMITS_INVALID_CALL_SEQUENCE, // Flag generic case of an invalid call sequence by the app
diff --git a/layers/vk_validation_layer_details.md b/layers/vk_validation_layer_details.md
index fa3d6fa9..4a78b5b3 100644
--- a/layers/vk_validation_layer_details.md
+++ b/layers/vk_validation_layer_details.md
@@ -316,6 +316,7 @@ For the second category of errors, VK_LAYER_LUNARG_device_limits stores its own
| ----- | -------- | ---------------- | ---------------- | -------- | ---------- |
| Valid instance | If an invalid instance is used, this error will be flagged | INVALID_INSTANCE | vkEnumeratePhysicalDevices | NA | VK_LAYER_LUNARG_object_tracker should also catch this so if we made sure VK_LAYER_LUNARG_object_tracker was always on top, we could avoid this check |
| Valid physical device | Enum used for informational messages | INVALID_PHYSICAL_DEVICE | vkEnumeratePhysicalDevices | NA | VK_LAYER_LUNARG_object_tracker should also catch this so if we made sure VK_LAYER_LUNARG_object_tracker was always on top, we could avoid this check |
+| Valid inherited query | If an invalid inherited query is used, this error will be flagged | INVALID_INHERITED_QUERY | vkBeginCommandBuffer | NA | None |
| Querying array counts | For API calls where an array count should be queried with an initial call and a NULL array pointer, verify that such a call was made before making a call with non-null array pointer. | MUST_QUERY_COUNT | vkEnumeratePhysicalDevices vkGetPhysicalDeviceQueueFamilyProperties | NA | Create focused test |
| Array count value | For API calls where an array of details is queried, verify that the size of the requested array matches the size of the array supported by the device. | COUNT_MISMATCH | vkEnumeratePhysicalDevices vkGetPhysicalDeviceQueueFamilyProperties | NA | Create focused test |
| Queue Creation | When creating/requesting queues, make sure that QueueFamilyPropertiesIndex and index/count within that queue family are valid. | INVALID_QUEUE_CREATE_REQUEST | vkGetDeviceQueue vkCreateDevice | NA | Create focused test |