aboutsummaryrefslogtreecommitdiff
path: root/layers/device_limits.cpp
diff options
context:
space:
mode:
authorMark Lobodzinski <mark@lunarg.com>2015-11-12 15:14:35 -0700
committerMark Lobodzinski <mark@lunarg.com>2015-11-20 08:49:14 -0700
commita9a34aa70ececc2f38b4cfe0f0434b3563af67eb (patch)
tree65f774d110fc5d0a995006af1afb2b8fabd75a85 /layers/device_limits.cpp
parent1047d2eb742521b57b7fbf9f9a7108fc10428b6e (diff)
downloadusermoji-a9a34aa70ececc2f38b4cfe0f0434b3563af67eb.tar.xz
layers: LX196, validate createImage paramters against format limits
Relocated some validation from DeviceLimits layer to Image layer, added additional per-format limit validation for CreateImage parameters.
Diffstat (limited to 'layers/device_limits.cpp')
-rw-r--r--layers/device_limits.cpp57
1 files changed, 0 insertions, 57 deletions
diff --git a/layers/device_limits.cpp b/layers/device_limits.cpp
index a08fb26a..7dbca10f 100644
--- a/layers/device_limits.cpp
+++ b/layers/device_limits.cpp
@@ -490,61 +490,6 @@ VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue(VkDevice device, uin
dev_data->device_dispatch_table->GetDeviceQueue(device, queueFamilyIndex, queueIndex, pQueue);
}
-VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateImage(
- VkDevice device,
- const VkImageCreateInfo *pCreateInfo,
- const VkAllocationCallbacks* pAllocator,
- VkImage *pImage)
-{
- VkBool32 skipCall = VK_FALSE;
- VkResult result = VK_ERROR_VALIDATION_FAILED;
- VkImageFormatProperties ImageFormatProperties = {0};
-
- layer_data *dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
- VkPhysicalDevice physicalDevice = dev_data->physicalDevice;
- layer_data *phy_dev_data = get_my_data_ptr(get_dispatch_key(physicalDevice), layer_data_map);
- // Internal call to get format info. Still goes through layers, could potentially go directly to ICD.
- phy_dev_data->instance_dispatch_table->GetPhysicalDeviceImageFormatProperties(
- physicalDevice, pCreateInfo->format, pCreateInfo->imageType, pCreateInfo->tiling,
- pCreateInfo->usage, pCreateInfo->flags, &ImageFormatProperties);
-
- VkDeviceSize imageGranularity = phy_dev_data->physicalDeviceProperties.limits.bufferImageGranularity;
- imageGranularity = imageGranularity == 1 ? 0 : imageGranularity;
-
- if ((pCreateInfo->extent.depth > ImageFormatProperties.maxExtent.depth) ||
- (pCreateInfo->extent.width > ImageFormatProperties.maxExtent.width) ||
- (pCreateInfo->extent.height > ImageFormatProperties.maxExtent.height)) {
- skipCall |= log_msg(phy_dev_data->report_data, VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_IMAGE, (uint64_t)pImage, 0,
- DEVLIMITS_LIMITS_VIOLATION, "DL",
- "CreateImage extents exceed allowable limits for format: "
- "Width = %d Height = %d Depth = %d: Limits for Width = %d Height = %d Depth = %d for format %s.",
- pCreateInfo->extent.width, pCreateInfo->extent.height, pCreateInfo->extent.depth,
- ImageFormatProperties.maxExtent.width, ImageFormatProperties.maxExtent.height, ImageFormatProperties.maxExtent.depth,
- string_VkFormat(pCreateInfo->format));
-
- }
-
- uint64_t totalSize = ((uint64_t)pCreateInfo->extent.width *
- (uint64_t)pCreateInfo->extent.height *
- (uint64_t)pCreateInfo->extent.depth *
- (uint64_t)pCreateInfo->arrayLayers *
- (uint64_t)pCreateInfo->samples *
- (uint64_t)vk_format_get_size(pCreateInfo->format) +
- (uint64_t)imageGranularity ) & ~(uint64_t)imageGranularity;
-
- if (totalSize > ImageFormatProperties.maxResourceSize) {
- skipCall |= log_msg(phy_dev_data->report_data, VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_IMAGE, (uint64_t)pImage, 0,
- DEVLIMITS_LIMITS_VIOLATION, "DL",
- "CreateImage resource size exceeds allowable maximum "
- "Image resource size = %#" PRIxLEAST64 ", maximum resource size = %#" PRIxLEAST64 " ",
- totalSize, ImageFormatProperties.maxResourceSize);
- }
- if (VK_FALSE == skipCall) {
- result = dev_data->device_dispatch_table->CreateImage(device, pCreateInfo, pAllocator, pImage);
- }
- return result;
-}
-
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdUpdateBuffer(
VkCommandBuffer commandBuffer,
VkBuffer dstBuffer,
@@ -651,8 +596,6 @@ VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkD
return (PFN_vkVoidFunction) vkDestroyDevice;
if (!strcmp(funcName, "vkGetDeviceQueue"))
return (PFN_vkVoidFunction) vkGetDeviceQueue;
- if (!strcmp(funcName, "vkCreateImage"))
- return (PFN_vkVoidFunction) vkCreateImage;
if (!strcmp(funcName, "CreateCommandPool"))
return (PFN_vkVoidFunction) vkCreateCommandPool;
if (!strcmp(funcName, "DestroyCommandPool"))