Rebased ref, commits from common ancestor: commit 2bbfb1f26b081986d6427b0834485956358f7bbf Author: Jon Ashburn <j...@lunarg.com> Date: Thu Apr 7 07:17:22 2016 -0600
loader: temp workaround for advertising linux wsi surface extensions Change-Id: I9a03c6ea16abe9e362ef81ee87ac217b8b3c6c92 diff --git a/loader/loader.c b/loader/loader.c index b040215..344ef27 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -1124,15 +1124,36 @@ void loader_get_icd_loader_instance_extensions( // TODO REMOVE THIS, HACK ALERT // AMD driver doesn't advertise KHR_surface or KHR_win32_surface, add them -#ifdef _WIN32 - VkExtensionProperties props[2]; - strcpy(props[0].extensionName, VK_KHR_SURFACE_EXTENSION_NAME); - props[0].specVersion = VK_KHR_SURFACE_SPEC_VERSION; - strcpy(props[1].extensionName, VK_KHR_WIN32_SURFACE_EXTENSION_NAME); - props[1].specVersion = VK_KHR_WIN32_SURFACE_SPEC_VERSION; - loader_add_to_ext_list(inst, inst_exts, 2, props); - + VkExtensionProperties props; + strcpy(props.extensionName, VK_KHR_SURFACE_EXTENSION_NAME); + props.specVersion = VK_KHR_SURFACE_SPEC_VERSION; + loader_add_to_ext_list(inst, inst_exts, 1, &props); +#ifdef VK_USE_PLATFORM_WIN32_KHR + strcpy(props.extensionName, VK_KHR_WIN32_SURFACE_EXTENSION_NAME); + props.specVersion = VK_KHR_WIN32_SURFACE_SPEC_VERSION; + loader_add_to_ext_list(inst, inst_exts, 1, &props); +#endif +#ifdef VK_USE_PLATFORM_XCB_KHR + strcpy(props.extensionName, VK_KHR_XCB_SURFACE_EXTENSION_NAME); + props.specVersion = VK_KHR_XCB_SURFACE_SPEC_VERSION; + loader_add_to_ext_list(inst, inst_exts, 1, &props); +#endif +#ifdef VK_USE_PLATFORM_XLIB_KHR + strcpy(props.extensionName, VK_KHR_XLIB_SURFACE_EXTENSION_NAME); + props.specVersion = VK_KHR_XLIB_SURFACE_SPEC_VERSION; + loader_add_to_ext_list(inst, inst_exts, 1, &props); #endif +#ifdef VK_USE_PLATFORM_WAYLAND_KHR + strcpy(props.extensionName, VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME); + props.specVersion = VK_KHR_WAYLAND_SURFACE_SPEC_VERSION; + loader_add_to_ext_list(inst, inst_exts, 1, &props); +#endif +#ifdef VK_USE_PLATFORM_MIR_KHR + strcpy(props.extensionName, VK_KHR_MIR_SURFACE_EXTENSION_NAME); + props.specVersion = VK_KHR_MIR_SURFACE_SPEC_VERSION; + loader_add_to_ext_list(inst, inst_exts, 1, &props); +#endif + // Traverse loader's extensions, adding non-duplicate extensions to the list debug_report_add_instance_extensions(inst, inst_exts); } commit 37f9f6af59d06f5e4fc26e4ddd039e64f4764d3d Author: Tony Barbour <t...@lunarg.com> Date: Wed Apr 6 18:17:57 2016 -0600 layers: Move call to validateCommandBuffersNotInUse inside lock Fixes segv in CTS multithreaded command pool test Change-Id: I80da12fd2bb6856e3c6824f17dd92f1597121a54 diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index aa5eafb..7a2dd69 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -6243,9 +6243,12 @@ vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocat } dev_data->commandPoolMap.erase(commandPool); + + VkBool32 result = validateCommandBuffersNotInUse(dev_data, commandPool); + loader_platform_thread_unlock_mutex(&globalLock); - if (VK_TRUE == validateCommandBuffersNotInUse(dev_data, commandPool)) + if (result) return; if (!skipCall) commit f3f4ee9c8529ab122a1eaf972affa0063cbe82cb Author: Piers Daniell <pdani...@nvidia.com> Date: Tue Apr 5 17:28:06 2016 -0600 loader: Fix regression with dEQP-VK.api.object_management.alloc_callback_fail.device When the loader vkCreateDevice trampoline code calls down to vkCreateDevice don't update the dev->device field with a bogus device handle. Change-Id: I703acb5283650ab0013483bda0f478da9b46e3ea diff --git a/loader/loader.c b/loader/loader.c index 7694347..b040215 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -3553,6 +3553,9 @@ VkResult loader_create_device_chain(const struct loader_physical_device_tramp *p loader_create_info.pNext = &create_info_disp; res = fpCreateDevice(pd->phys_dev, &loader_create_info, pAllocator, &created_device); + if (res != VK_SUCCESS) { + return res; + } dev->device = created_device; } else { // Couldn't find CreateDevice function! commit 222e2ddec44e99a23f9f5d6feae17676abd693fd Author: David Pinedo <da...@lunarg.com> Date: Tue Apr 5 16:40:08 2016 -0600 winrtinstaller: fix install dir not being removed on uninstall. This problem was introduced when logging was added. diff --git a/windowsRuntimeInstaller/InstallerRT.nsi b/windowsRuntimeInstaller/InstallerRT.nsi index c51c7cc..239634d 100644 --- a/windowsRuntimeInstaller/InstallerRT.nsi +++ b/windowsRuntimeInstaller/InstallerRT.nsi @@ -504,13 +504,14 @@ SectionEnd !ifdef UNINSTALLER Section "uninstall" - # Turn on logging - LogSet on - # Remove contents of temp dir SetOutPath "$TEMP\VulkanRT" RmDir /R "$TEMP\VulkanRT" + # Turn on logging + StrCpy $INSTDIR $TEMP\VulkanRT + LogSet on + # If running on a 64-bit OS machine, disable registry re-direct since we're running as a 32-bit executable. ${If} ${RunningX64} @@ -520,7 +521,6 @@ Section "uninstall" ${Endif} # Look up the install dir and remove files from that directory. - # We do this so that the uninstaller can be run from any directory. ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCTNAME}${PRODUCTVERSION}" "InstallDir" StrCpy $IDir $0 @@ -657,7 +657,7 @@ Section "uninstall" # Finish logging and move log file to TEMP dir LogSet off - Rename "$INSTDIR\install.log" "$TEMP\VulkanRT\Uninstall.log" + Rename "$INSTDIR\install.log" "$INSTDIR\Uninstall.log" SectionEnd !endif commit 03a65023f0035b782d16f41296c98ad655239c68 Author: Jeremy Hayes <jer...@lunarg.com> Date: Tue Apr 5 15:46:17 2016 -0600 loader: bump linux version Change-Id: I6c9e9b7650a7599797e93e60eb2191345c3e6ec8 diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt index 2c5800f..6082bda 100644 --- a/loader/CMakeLists.txt +++ b/loader/CMakeLists.txt @@ -66,6 +66,6 @@ else() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith") add_library(vulkan SHARED ${LOADER_SRCS}) - set_target_properties(vulkan PROPERTIES SOVERSION "1" VERSION "1.0.5") + set_target_properties(vulkan PROPERTIES SOVERSION "1" VERSION "1.0.8") target_link_libraries(vulkan -ldl -lpthread -lm) endif() commit 7d57c56e85d8e3e78441b5b2e027278c430e9af2 Author: Jon Ashburn <j...@lunarg.com> Date: Mon Apr 4 16:55:24 2016 -0600 loader: Temp workaround to add WSI surface extensions enumerated. Change-Id: Ibb9ffa80bbb71d15296e39730f48f33c23bd331a diff --git a/loader/loader.c b/loader/loader.c index 8fff9df..7694347 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -1122,6 +1122,17 @@ void loader_get_icd_loader_instance_extensions( (struct loader_generic_list *)&icd_exts); }; + // TODO REMOVE THIS, HACK ALERT + // AMD driver doesn't advertise KHR_surface or KHR_win32_surface, add them +#ifdef _WIN32 + VkExtensionProperties props[2]; + strcpy(props[0].extensionName, VK_KHR_SURFACE_EXTENSION_NAME); + props[0].specVersion = VK_KHR_SURFACE_SPEC_VERSION; + strcpy(props[1].extensionName, VK_KHR_WIN32_SURFACE_EXTENSION_NAME); + props[1].specVersion = VK_KHR_WIN32_SURFACE_SPEC_VERSION; + loader_add_to_ext_list(inst, inst_exts, 2, props); + +#endif // Traverse loader's extensions, adding non-duplicate extensions to the list debug_report_add_instance_extensions(inst, inst_exts); } commit 65bb6d15dc88fe1f0be78b8a5e2609b702814735 Author: Dustin Graves <dus...@lunarg.com> Date: Mon Apr 4 11:14:01 2016 -0600 layers: Fix paramcheck struct array NULL indexing Fixes an issue where the generated parameter_validation code could index a NULL pointer to an array of structs. Change-Id: If78f1c97ea256911d857b0b8009b38e6ca6f2581 diff --git a/generator.py b/generator.py index 84d7edc..ebdd024 100644 --- a/generator.py +++ b/generator.py @@ -3372,22 +3372,30 @@ class ParamCheckerOutputGenerator(OutputGenerator): checkExpr += '\n' + indent if lenParam: # Need to process all elements in the array - checkExpr += 'for (uint32_t i = 0; i < {}{}; ++i) {{\n'.format(valuePrefix, lenParam.name) + checkExpr += 'if ({}{} != NULL) {{\n'.format(valuePrefix, value.name) + indent = self.incIndent(indent) + checkExpr += indent + 'for (uint32_t i = 0; i < {}{}; ++i) {{\n'.format(valuePrefix, lenParam.name) indent = self.incIndent(indent) checkExpr += indent + 'skipCall |= parameter_validation_{}(report_data, {}, {}, {}, &({}{}[i]));\n'.format(value.type, name, prefix, isInput, valuePrefix, value.name) indent = self.decIndent(indent) checkExpr += indent + '}\n' + indent = self.decIndent(indent) + checkExpr += indent + '}\n' else: checkExpr += 'skipCall |= parameter_validation_{}(report_data, {}, {}, {}, {}{});\n'.format(value.type, name, prefix, isInput, valuePrefix, value.name) else: # Validation function does not have an isInput field if lenParam: # Need to process all elements in the array - expr = 'for (uint32_t i = 0; i < {}{}; ++i) {{\n'.format(valuePrefix, lenParam.name) + expr = 'if ({}{} != NULL) {{\n'.format(valuePrefix, value.name) + indent = self.incIndent(indent) + expr += indent + 'for (uint32_t i = 0; i < {}{}; ++i) {{\n'.format(valuePrefix, lenParam.name) indent = self.incIndent(indent) expr += indent + 'skipCall |= parameter_validation_{}(report_data, {}, {}, &({}{}[i]));\n'.format(value.type, name, prefix, valuePrefix, value.name) indent = self.decIndent(indent) expr += indent + '}\n' + indent = self.decIndent(indent) + expr += indent + '}\n' else: expr = 'skipCall |= parameter_validation_{}(report_data, {}, {}, {}{});\n'.format(value.type, name, prefix, valuePrefix, value.name) # commit 12e2e3a256b30446b13f55f02d216874399b9cb2 Author: Michael Lentine <mlent...@google.com> Date: Wed Mar 30 15:57:52 2016 -0500 Fix find layout to search on each aspect bit. Change-Id: I155ee469ef98d1ad9b1bfc8813a1cff43f30f8ca diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index e37d530..aa5eafb 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -3568,30 +3568,86 @@ static VkBool32 validateSampler(const layer_data *my_data, const VkSampler *pSam return skipCall; } +//TODO: Consolidate functions +bool FindLayout(const GLOBAL_CB_NODE *pCB, ImageSubresourcePair imgpair, IMAGE_CMD_BUF_LAYOUT_NODE &node, const VkImageAspectFlags aspectMask) { + layer_data *my_data = get_my_data_ptr(get_dispatch_key(pCB->commandBuffer), layer_data_map); + if (!(imgpair.subresource.aspectMask & aspectMask)) { + return false; + } + VkImageAspectFlags oldAspectMask = imgpair.subresource.aspectMask; + imgpair.subresource.aspectMask = aspectMask; + auto imgsubIt = pCB->imageLayoutMap.find(imgpair); + if (imgsubIt == pCB->imageLayoutMap.end()) { + return false; + } + if (node.layout != VK_IMAGE_LAYOUT_MAX_ENUM && node.layout != imgsubIt->second.layout) { + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + reinterpret_cast<uint64_t&>(imgpair.image), __LINE__, DRAWSTATE_INVALID_LAYOUT, "DS", + "Cannot query for VkImage 0x%" PRIx64 " layout when combined aspect mask %d has multiple layout types: %s and %s", + reinterpret_cast<uint64_t&>(imgpair.image), oldAspectMask, string_VkImageLayout(node.layout), string_VkImageLayout(imgsubIt->second.layout)); + } + if (node.initialLayout != VK_IMAGE_LAYOUT_MAX_ENUM && node.initialLayout != imgsubIt->second.initialLayout) { + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + reinterpret_cast<uint64_t&>(imgpair.image), __LINE__, DRAWSTATE_INVALID_LAYOUT, "DS", + "Cannot query for VkImage 0x%" PRIx64 " layout when combined aspect mask %d has multiple initial layout types: %s and %s", + reinterpret_cast<uint64_t&>(imgpair.image), oldAspectMask, string_VkImageLayout(node.initialLayout), string_VkImageLayout(imgsubIt->second.initialLayout)); + } + node = imgsubIt->second; + return true; +} + +bool FindLayout(const layer_data *my_data, ImageSubresourcePair imgpair, VkImageLayout &layout, const VkImageAspectFlags aspectMask) { + if (!(imgpair.subresource.aspectMask & aspectMask)) { + return false; + } + VkImageAspectFlags oldAspectMask = imgpair.subresource.aspectMask; + imgpair.subresource.aspectMask = aspectMask; + auto imgsubIt = my_data->imageLayoutMap.find(imgpair); + if (imgsubIt == my_data->imageLayoutMap.end()) { + return false; + } + if (layout != VK_IMAGE_LAYOUT_MAX_ENUM && layout != imgsubIt->second.layout) { + log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, + reinterpret_cast<uint64_t&>(imgpair.image), __LINE__, DRAWSTATE_INVALID_LAYOUT, "DS", + "Cannot query for VkImage 0x%" PRIx64 " layout when combined aspect mask %d has multiple layout types: %s and %s", + reinterpret_cast<uint64_t&>(imgpair.image), oldAspectMask, string_VkImageLayout(layout), string_VkImageLayout(imgsubIt->second.layout)); + } + layout = imgsubIt->second.layout; + return true; +} + // find layout(s) on the cmd buf level bool FindLayout(const GLOBAL_CB_NODE *pCB, VkImage image, VkImageSubresource range, IMAGE_CMD_BUF_LAYOUT_NODE &node) { ImageSubresourcePair imgpair = {image, true, range}; - auto imgsubIt = pCB->imageLayoutMap.find(imgpair); - if (imgsubIt == pCB->imageLayoutMap.end()) { + node = IMAGE_CMD_BUF_LAYOUT_NODE(VK_IMAGE_LAYOUT_MAX_ENUM, VK_IMAGE_LAYOUT_MAX_ENUM); + FindLayout(pCB, imgpair, node, VK_IMAGE_ASPECT_COLOR_BIT); + FindLayout(pCB, imgpair, node, VK_IMAGE_ASPECT_DEPTH_BIT); + FindLayout(pCB, imgpair, node, VK_IMAGE_ASPECT_STENCIL_BIT); + FindLayout(pCB, imgpair, node, VK_IMAGE_ASPECT_METADATA_BIT); + if (node.layout == VK_IMAGE_LAYOUT_MAX_ENUM) { imgpair = {image, false, VkImageSubresource()}; - imgsubIt = pCB->imageLayoutMap.find(imgpair); + auto imgsubIt = pCB->imageLayoutMap.find(imgpair); if (imgsubIt == pCB->imageLayoutMap.end()) return false; + node = imgsubIt->second; } - node = imgsubIt->second; return true; } // find layout(s) on the global level bool FindLayout(const layer_data *my_data, ImageSubresourcePair imgpair, VkImageLayout &layout) { - auto imgsubIt = my_data->imageLayoutMap.find(imgpair); - if (imgsubIt == my_data->imageLayoutMap.end()) { + layout = VK_IMAGE_LAYOUT_MAX_ENUM; + FindLayout(my_data, imgpair, layout, VK_IMAGE_ASPECT_COLOR_BIT); + FindLayout(my_data, imgpair, layout, VK_IMAGE_ASPECT_DEPTH_BIT); + FindLayout(my_data, imgpair, layout, VK_IMAGE_ASPECT_STENCIL_BIT); + FindLayout(my_data, imgpair, layout, VK_IMAGE_ASPECT_METADATA_BIT); + if (layout == VK_IMAGE_LAYOUT_MAX_ENUM) { imgpair = {imgpair.image, false, VkImageSubresource()}; - imgsubIt = my_data->imageLayoutMap.find(imgpair); + auto imgsubIt = my_data->imageLayoutMap.find(imgpair); if (imgsubIt == my_data->imageLayoutMap.end()) return false; + layout = imgsubIt->second.layout; } - layout = imgsubIt->second.layout; return true; } commit 85dc1927229e383fa372a18b3619809f4f43901e Author: Tony Barbour <t...@lunarg.com> Date: Mon Apr 4 11:09:40 2016 -0600 Remove NumBlendAttachMismatch until check is in place Change-Id: Ie4150e84ac4856f8a4e84acbd2c7e8b1ddad832c diff --git a/tests/layer_validation_tests.cpp b/tests/layer_validation_tests.cpp index ed6ac30..0cd6d62 100644 --- a/tests/layer_validation_tests.cpp +++ b/tests/layer_validation_tests.cpp @@ -4661,7 +4661,7 @@ TEST_F(VkLayerTest, NumSamplesMismatch) { vkDestroyDescriptorSetLayout(m_device->device(), ds_layout, NULL); vkDestroyDescriptorPool(m_device->device(), ds_pool, NULL); } - +#ifdef ADD_BACK_IN_WHEN_CHECK_IS_BACK TEST_F(VkLayerTest, NumBlendAttachMismatch) { // Create Pipeline where the number of blend attachments doesn't match the // number of color attachments. In this case, we don't add any color @@ -4762,7 +4762,7 @@ TEST_F(VkLayerTest, NumBlendAttachMismatch) { vkDestroyDescriptorSetLayout(m_device->device(), ds_layout, NULL); vkDestroyDescriptorPool(m_device->device(), ds_pool, NULL); } - +#endif //ADD_BACK_IN_WHEN_CHECK_IS_BACK TEST_F(VkLayerTest, ClearCmdNoDraw) { // Create CommandBuffer where we add ClearCmd for FB Color attachment prior // to issuing a Draw commit a5b9ecb34cb64e1cc42f7d90f4906f7893712e53 Author: Tony Barbour <t...@lunarg.com> Date: Mon Apr 4 10:59:56 2016 -0600 Revert "layers: LX265 Error if color blend attch count != subpass attch." This reverts commit dcce8143110568353a6217e5b885da407edd29be. Change-Id: I0882b499b38e3cf7670846a9ffae48a0fbf015a3 diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 63879bc..e37d530 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -3342,14 +3342,6 @@ static VkBool32 validatePipelineState(layer_data *my_data, const GLOBAL_CB_NODE VkSampleCountFlagBits subpassNumSamples = (VkSampleCountFlagBits)0; uint32_t i; - if (pPipeline->cbStateCI.attachmentCount != pSD->colorAttachmentCount) { - skipCall |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT, - reinterpret_cast<const uint64_t &>(pipeline), __LINE__, DRAWSTATE_INVALID_RENDERPASS, "DS", - "Mismatch between blend state attachment count %u and subpass %u color attachment " - "count %u! These must be the same.", - pPipeline->cbStateCI.attachmentCount, pCB->activeSubpass, pSD->colorAttachmentCount); - } - for (i = 0; i < pSD->colorAttachmentCount; i++) { VkSampleCountFlagBits samples; commit b19ce0a28940cc2ffb9d67994954e9986246797c Author: Dustin Graves <dus...@lunarg.com> Date: Thu Mar 31 18:01:37 2016 -0600 layers: LX414: Fix device_limits alignment check Fix buffer/descriptor offset alignment checks in device_limits: - vkUpdateDescriptorSets offset check was not performed with the correct physical device alignments. - vkBindBufferMemory offset check was always performed with the UBO alignment. This check has been moved to core_validation, where the offset is checked against the alignment associated with its usage type and the alignment retrieved from vkGetBufferMemoryRequirements. Change-Id: I4f64e06c44972a224d1930cb0798a9f472b768f2 diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 20c9076..63879bc 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -5955,6 +5955,48 @@ vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem, VkDevic skipCall |= validate_buffer_image_aliasing(dev_data, buffer_handle, mem, memoryOffset, memRequirements, dev_data->memObjMap[mem].bufferRanges, dev_data->memObjMap[mem].imageRanges, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT); + // Validate memory requirements alignment + if (vk_safe_modulo(memoryOffset, memRequirements.alignment) != 0) { + skipCall |= + log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, 0, + __LINE__, DRAWSTATE_INVALID_BUFFER_MEMORY_OFFSET, "DS", + "vkBindBufferMemory(): memoryOffset is %#" PRIxLEAST64 " but must be an integer multiple of the " + "VkMemoryRequirements::alignment value %#" PRIxLEAST64 + ", returned from a call to vkGetBufferMemoryRequirements with buffer", + memoryOffset, memRequirements.alignment); + } + // Validate device limits alignments + VkBufferUsageFlags usage = dev_data->bufferMap[buffer].create_info->usage; + if (usage & (VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT)) { + if (vk_safe_modulo(memoryOffset, dev_data->physDevProperties.properties.limits.minTexelBufferOffsetAlignment) != 0) { + skipCall |= + log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, + 0, __LINE__, DRAWSTATE_INVALID_TEXEL_BUFFER_OFFSET, "DS", + "vkBindBufferMemory(): memoryOffset is %#" PRIxLEAST64 " but must be a multiple of " + "device limit minTexelBufferOffsetAlignment %#" PRIxLEAST64, + memoryOffset, dev_data->physDevProperties.properties.limits.minTexelBufferOffsetAlignment); + } + } + if (usage & VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT) { + if (vk_safe_modulo(memoryOffset, dev_data->physDevProperties.properties.limits.minUniformBufferOffsetAlignment) != 0) { + skipCall |= + log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, + 0, __LINE__, DRAWSTATE_INVALID_UNIFORM_BUFFER_OFFSET, "DS", + "vkBindBufferMemory(): memoryOffset is %#" PRIxLEAST64 " but must be a multiple of " + "device limit minUniformBufferOffsetAlignment %#" PRIxLEAST64, + memoryOffset, dev_data->physDevProperties.properties.limits.minUniformBufferOffsetAlignment); + } + } + if (usage & VK_BUFFER_USAGE_STORAGE_BUFFER_BIT) { + if (vk_safe_modulo(memoryOffset, dev_data->physDevProperties.properties.limits.minStorageBufferOffsetAlignment) != 0) { + skipCall |= + log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, + 0, __LINE__, DRAWSTATE_INVALID_STORAGE_BUFFER_OFFSET, "DS", + "vkBindBufferMemory(): memoryOffset is %#" PRIxLEAST64 " but must be a multiple of " + "device limit minStorageBufferOffsetAlignment %#" PRIxLEAST64, + memoryOffset, dev_data->physDevProperties.properties.limits.minStorageBufferOffsetAlignment); + } + } } print_mem_list(dev_data, device); loader_platform_thread_unlock_mutex(&globalLock); diff --git a/layers/core_validation.h b/layers/core_validation.h index a7a2c05..9fe162a 100644 --- a/layers/core_validation.h +++ b/layers/core_validation.h @@ -375,6 +375,10 @@ typedef enum _DRAW_STATE_ERROR { DRAWSTATE_OBJECT_INUSE, // Destroying or modifying an object in use by a // command buffer DRAWSTATE_QUEUE_FORWARD_PROGRESS, // Queue cannot guarantee forward progress + DRAWSTATE_INVALID_BUFFER_MEMORY_OFFSET, // Dynamic Buffer Offset + // violates memory requirements limit + DRAWSTATE_INVALID_TEXEL_BUFFER_OFFSET, // Dynamic Texel Buffer Offsets + // violate device limit DRAWSTATE_INVALID_UNIFORM_BUFFER_OFFSET, // Dynamic Uniform Buffer Offsets // violate device limit DRAWSTATE_INVALID_STORAGE_BUFFER_OFFSET, // Dynamic Storage Buffer Offsets diff --git a/layers/device_limits.cpp b/layers/device_limits.cpp index f0812e2..41afaab 100644 --- a/layers/device_limits.cpp +++ b/layers/device_limits.cpp @@ -63,10 +63,10 @@ struct layer_data { unique_ptr<PHYSICAL_DEVICE_STATE> physicalDeviceState; VkPhysicalDeviceFeatures actualPhysicalDeviceFeatures; VkPhysicalDeviceFeatures requestedPhysicalDeviceFeatures; - unordered_map<VkDevice, VkPhysicalDeviceProperties> physDevPropertyMap; // Track physical device per logical device VkPhysicalDevice physicalDevice; + VkPhysicalDeviceProperties physicalDeviceProperties; // Vector indices correspond to queueFamilyIndex vector<unique_ptr<VkQueueFamilyProperties>> queueFamilyProperties; @@ -448,15 +448,14 @@ VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(VkPhysicalDevice g return result; } - layer_data *my_instance_data = get_my_data_ptr(get_dispatch_key(gpu), layer_data_map); layer_data *my_device_data = get_my_data_ptr(get_dispatch_key(*pDevice), layer_data_map); my_device_data->device_dispatch_table = new VkLayerDispatchTable; layer_init_device_dispatch_table(*pDevice, my_device_data->device_dispatch_table, fpGetDeviceProcAddr); - my_device_data->report_data = layer_debug_report_create_device(my_instance_data->report_data, *pDevice); + my_device_data->report_data = layer_debug_report_create_device(phy_dev_data->report_data, *pDevice); my_device_data->physicalDevice = gpu; // Get physical device properties for this device - phy_dev_data->instance_dispatch_table->GetPhysicalDeviceProperties(gpu, &(phy_dev_data->physDevPropertyMap[*pDevice])); + phy_dev_data->instance_dispatch_table->GetPhysicalDeviceProperties(gpu, &(my_device_data->physicalDeviceProperties)); return result; } @@ -553,27 +552,6 @@ vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex dev_data->device_dispatch_table->GetDeviceQueue(device, queueFamilyIndex, queueIndex, pQueue); } -VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem, VkDeviceSize memoryOffset) { - layer_data *dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); - VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; - VkBool32 skipCall = VK_FALSE; - - VkDeviceSize uniformAlignment = dev_data->physDevPropertyMap[device].limits.minUniformBufferOffsetAlignment; - if (vk_safe_modulo(memoryOffset, uniformAlignment) != 0) { - skipCall |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, - 0, __LINE__, DEVLIMITS_INVALID_UNIFORM_BUFFER_OFFSET, "DL", - "vkBindBufferMemory(): memoryOffset %#" PRIxLEAST64 - " must be a multiple of device limit minUniformBufferOffsetAlignment %#" PRIxLEAST64, - memoryOffset, uniformAlignment); - } - - if (VK_FALSE == skipCall) { - result = dev_data->device_dispatch_table->BindBufferMemory(device, buffer, mem, memoryOffset); - } - return result; -} - VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet *pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet *pDescriptorCopies) { @@ -583,7 +561,7 @@ vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, const VkW for (uint32_t i = 0; i < descriptorWriteCount; i++) { if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) || (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC)) { - VkDeviceSize uniformAlignment = dev_data->physDevPropertyMap[device].limits.minUniformBufferOffsetAlignment; + VkDeviceSize uniformAlignment = dev_data->physicalDeviceProperties.limits.minUniformBufferOffsetAlignment; for (uint32_t j = 0; j < pDescriptorWrites[i].descriptorCount; j++) { if (vk_safe_modulo(pDescriptorWrites[i].pBufferInfo[j].offset, uniformAlignment) != 0) { skipCall |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, @@ -596,7 +574,7 @@ vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, const VkW } } else if ((pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) || (pDescriptorWrites[i].descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)) { - VkDeviceSize storageAlignment = dev_data->physDevPropertyMap[device].limits.minStorageBufferOffsetAlignment; + VkDeviceSize storageAlignment = dev_data->physicalDeviceProperties.limits.minStorageBufferOffsetAlignment; for (uint32_t j = 0; j < pDescriptorWrites[i].descriptorCount; j++) { if (vk_safe_modulo(pDescriptorWrites[i].pBufferInfo[j].offset, storageAlignment) != 0) { skipCall |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, @@ -713,8 +691,6 @@ VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkD return (PFN_vkVoidFunction)vkBeginCommandBuffer; if (!strcmp(funcName, "vkCmdUpdateBuffer")) return (PFN_vkVoidFunction)vkCmdUpdateBuffer; - if (!strcmp(funcName, "vkBindBufferMemory")) - return (PFN_vkVoidFunction)vkBindBufferMemory; if (!strcmp(funcName, "vkUpdateDescriptorSets")) return (PFN_vkVoidFunction)vkUpdateDescriptorSets; if (!strcmp(funcName, "vkCmdFillBuffer")) diff --git a/layers/vk_validation_layer_details.md b/layers/vk_validation_layer_details.md index 7af78ee..5823e73 100644 --- a/layers/vk_validation_layer_details.md +++ b/layers/vk_validation_layer_details.md @@ -94,8 +94,10 @@ The Draw State portion of the core validation layer tracks state leading into Dr | Verify Semaphores Not In Use | Validate that the semaphores are not used in multiple submit calls at the same time | INVALID_SEMAPHORE | vkQueueSubmit | TBD | None | | Verify Events Not In Use | Validate that that events are not used at the time they are destroyed | INVALID_EVENT | vkDestroyEvent | TBD | None | | Live Semaphore | When waiting on a semaphore, need to make sure that the semaphore is live and therefore can be signalled, otherwise queue is stalled and cannot make forward progress. | QUEUE_FORWARD_PROGRESS | vkQueueSubmit vkQueueBindSparse vkQueuePresentKHR vkAcquireNextImageKHR | TODO | Create test | -| Storage Buffer Alignment | Storage Buffer offsets in BindDescriptorSets must agree with offset alignment device limit | INVALID_STORAGE_BUFFER_OFFSET | vkCmdBindDescriptorSets | TODO | Create test | -| Uniform Buffer Alignment | Uniform Buffer offsets in BindDescriptorSets must agree with offset alignment device limit | INVALID_UNIFORM_BUFFER_OFFSET | vkCmdBindDescriptorSets | TODO | Create test | +| Buffer Alignment | Buffer memory offset in BindBufferMemory must agree with VkMemoryRequirements::alignment returned from a call to vkGetBufferMemoryRequirements with buffer | INVALID_BUFFER_MEMORY_OFFSET | vkBindBufferMemory | TODO | Create test | +| Texel Buffer Alignment | Storage/Uniform Texel Buffer memory offset in BindBufferMemory must agree with offset alignment device limit | INVALID_TEXEL_BUFFER_OFFSET | vkBindBufferMemory | TODO | Create test | +| Storage Buffer Alignment | Storage Buffer offsets in BindBufferMemory, BindDescriptorSets must agree with offset alignment device limit | INVALID_STORAGE_BUFFER_OFFSET | vkBindBufferMemory vkCmdBindDescriptorSets | TODO | Create test | +| Uniform Buffer Alignment | Uniform Buffer offsets in BindBufferMemory, BindDescriptorSets must agree with offset alignment device limit | INVALID_UNIFORM_BUFFER_OFFSET | vkBindBufferMemory vkCmdBindDescriptorSets | TODO | Create test | | Independent Blending | If independent blending is not enabled, all elements of pAttachments must be identical | INDEPENDENT_BLEND | vkCreateGraphicsPipelines | TODO | Create test | | Enabled Logic Operations | If logic operations is not enabled, logicOpEnable must be VK_FALSE | DISABLED_LOGIC_OP | vkCreateGraphicsPipelines | TODO | Create test | | Valid Logic Operations | If logicOpEnable is VK_TRUE, logicOp must be a valid VkLogicOp value | INVALID_LOGIC_OP | vkCreateGraphicsPipelines | TODO | Create test | commit 5cfc2cb54d07bbbf07ec6e193d8726f21a51f05f Author: Jon Ashburn <j...@lunarg.com> Date: Mon Apr 4 10:53:27 2016 -0600 layers: Update to version 1.0.8 JSON files Change-Id: Ic35eb444c34004343e5fb19cc54f12518512c6be diff --git a/layers/linux/VkLayer_core_validation.json b/layers/linux/VkLayer_core_validation.json index a470d32..acb078d 100644 --- a/layers/linux/VkLayer_core_validation.json +++ b/layers/linux/VkLayer_core_validation.json @@ -4,7 +4,7 @@ "name": "VK_LAYER_LUNARG_core_validation", "type": "GLOBAL", "library_path": "./libVkLayer_core_validation.so", - "api_version": "1.0.7", + "api_version": "1.0.8", "implementation_version": "1", "description": "LunarG Validation Layer", "instance_extensions": [ diff --git a/layers/linux/VkLayer_device_limits.json b/layers/linux/VkLayer_device_limits.json index 4719584..9cd58d7 100644 --- a/layers/linux/VkLayer_device_limits.json +++ b/layers/linux/VkLayer_device_limits.json @@ -4,7 +4,7 @@ "name": "VK_LAYER_LUNARG_device_limits", "type": "GLOBAL", "library_path": "./libVkLayer_device_limits.so", - "api_version": "1.0.7", + "api_version": "1.0.8", "implementation_version": "1", "description": "LunarG Validation Layer", "instance_extensions": [ diff --git a/layers/linux/VkLayer_image.json b/layers/linux/VkLayer_image.json index a7e6b6f..a0ed916 100644 --- a/layers/linux/VkLayer_image.json +++ b/layers/linux/VkLayer_image.json @@ -4,7 +4,7 @@ "name": "VK_LAYER_LUNARG_image", "type": "GLOBAL", "library_path": "./libVkLayer_image.so", - "api_version": "1.0.7", + "api_version": "1.0.8", "implementation_version": "1", "description": "LunarG Validation Layer", "instance_extensions": [ diff --git a/layers/linux/VkLayer_object_tracker.json b/layers/linux/VkLayer_object_tracker.json index 1749f4c..544485a 100644 --- a/layers/linux/VkLayer_object_tracker.json +++ b/layers/linux/VkLayer_object_tracker.json @@ -4,7 +4,7 @@ "name": "VK_LAYER_LUNARG_object_tracker", "type": "GLOBAL", "library_path": "./libVkLayer_object_tracker.so", - "api_version": "1.0.7", + "api_version": "1.0.8", "implementation_version": "1", "description": "LunarG Validation Layer", "instance_extensions": [ diff --git a/layers/linux/VkLayer_parameter_validation.json b/layers/linux/VkLayer_parameter_validation.json index 00ee6e9..edf18f8 100644 --- a/layers/linux/VkLayer_parameter_validation.json +++ b/layers/linux/VkLayer_parameter_validation.json @@ -4,7 +4,7 @@ "name": "VK_LAYER_LUNARG_parameter_validation", "type": "GLOBAL", "library_path": "./libVkLayer_parameter_validation.so", - "api_version": "1.0.7", + "api_version": "1.0.8", "implementation_version": "1", "description": "LunarG Validation Layer", "instance_extensions": [ diff --git a/layers/linux/VkLayer_swapchain.json b/layers/linux/VkLayer_swapchain.json index 9c38fe9..681d7ed 100644 --- a/layers/linux/VkLayer_swapchain.json +++ b/layers/linux/VkLayer_swapchain.json @@ -4,7 +4,7 @@ "name": "VK_LAYER_LUNARG_swapchain", "type": "GLOBAL", "library_path": "./libVkLayer_swapchain.so", - "api_version": "1.0.7", + "api_version": "1.0.8", "implementation_version": "1", "description": "LunarG Validation Layer", "instance_extensions": [ diff --git a/layers/linux/VkLayer_threading.json b/layers/linux/VkLayer_threading.json index c1e9dff..36ce7a9 100644 --- a/layers/linux/VkLayer_threading.json +++ b/layers/linux/VkLayer_threading.json @@ -4,7 +4,7 @@ "name": "VK_LAYER_GOOGLE_threading", "type": "GLOBAL", "library_path": "./libVkLayer_threading.so", - "api_version": "1.0.7", + "api_version": "1.0.8", "implementation_version": "1", "description": "Google Validation Layer", "instance_extensions": [ diff --git a/layers/linux/VkLayer_unique_objects.json b/layers/linux/VkLayer_unique_objects.json index d4838d9..4af1357 100644 --- a/layers/linux/VkLayer_unique_objects.json +++ b/layers/linux/VkLayer_unique_objects.json @@ -4,7 +4,7 @@ "name": "VK_LAYER_GOOGLE_unique_objects", "type": "GLOBAL", "library_path": "./libVkLayer_unique_objects.so", - "api_version": "1.0.7", + "api_version": "1.0.8", "implementation_version": "1", "description": "Google Validation Layer" } diff --git a/layers/windows/VkLayer_core_validation.json b/layers/windows/VkLayer_core_validation.json index e2a794a..1181cd6 100644 --- a/layers/windows/VkLayer_core_validation.json +++ b/layers/windows/VkLayer_core_validation.json @@ -4,7 +4,7 @@ "name": "VK_LAYER_LUNARG_core_validation", "type": "GLOBAL", "library_path": ".\\VkLayer_core_validation.dll", - "api_version": "1.0.7", + "api_version": "1.0.8", "implementation_version": "1", "description": "LunarG Validation Layer", "instance_extensions": [ diff --git a/layers/windows/VkLayer_device_limits.json b/layers/windows/VkLayer_device_limits.json index 93b855d..33551b5 100644 --- a/layers/windows/VkLayer_device_limits.json +++ b/layers/windows/VkLayer_device_limits.json @@ -4,7 +4,7 @@ "name": "VK_LAYER_LUNARG_device_limits", "type": "GLOBAL", "library_path": ".\\VkLayer_device_limits.dll", - "api_version": "1.0.7", + "api_version": "1.0.8", "implementation_version": "1", "description": "LunarG Validation Layer", "instance_extensions": [ diff --git a/layers/windows/VkLayer_image.json b/layers/windows/VkLayer_image.json index 63173d3..cd30c66 100644 --- a/layers/windows/VkLayer_image.json +++ b/layers/windows/VkLayer_image.json @@ -4,7 +4,7 @@ "name": "VK_LAYER_LUNARG_image", "type": "GLOBAL", "library_path": ".\\VkLayer_image.dll", - "api_version": "1.0.7", + "api_version": "1.0.8", "implementation_version": "1", "description": "LunarG Validation Layer", "instance_extensions": [ diff --git a/layers/windows/VkLayer_object_tracker.json b/layers/windows/VkLayer_object_tracker.json index eadd1db..1ce48c7 100644 --- a/layers/windows/VkLayer_object_tracker.json +++ b/layers/windows/VkLayer_object_tracker.json @@ -4,7 +4,7 @@ "name": "VK_LAYER_LUNARG_object_tracker", "type": "GLOBAL", "library_path": ".\\VkLayer_object_tracker.dll", - "api_version": "1.0.7", + "api_version": "1.0.8", "implementation_version": "1", "description": "LunarG Validation Layer", "instance_extensions": [ diff --git a/layers/windows/VkLayer_parameter_validation.json b/layers/windows/VkLayer_parameter_validation.json index 3ed6036..09101e2 100644 --- a/layers/windows/VkLayer_parameter_validation.json +++ b/layers/windows/VkLayer_parameter_validation.json @@ -4,7 +4,7 @@ "name": "VK_LAYER_LUNARG_parameter_validation", "type": "GLOBAL", "library_path": ".\\VkLayer_parameter_validation.dll", - "api_version": "1.0.7", + "api_version": "1.0.8", "implementation_version": "1", "description": "LunarG Validation Layer", "instance_extensions": [ diff --git a/layers/windows/VkLayer_swapchain.json b/layers/windows/VkLayer_swapchain.json index 3ac0b6b..848cff3 100644 --- a/layers/windows/VkLayer_swapchain.json +++ b/layers/windows/VkLayer_swapchain.json @@ -4,7 +4,7 @@ "name": "VK_LAYER_LUNARG_swapchain", "type": "GLOBAL", "library_path": ".\\VkLayer_swapchain.dll", - "api_version": "1.0.7", + "api_version": "1.0.8", "implementation_version": "1", "description": "LunarG Validation Layer", "instance_extensions": [ diff --git a/layers/windows/VkLayer_threading.json b/layers/windows/VkLayer_threading.json index 3214e0b..a09db46 100644 --- a/layers/windows/VkLayer_threading.json +++ b/layers/windows/VkLayer_threading.json @@ -4,7 +4,7 @@ "name": "VK_LAYER_GOOGLE_threading", "type": "GLOBAL", "library_path": ".\\VkLayer_threading.dll", - "api_version": "1.0.7", + "api_version": "1.0.8", "implementation_version": "1", "description": "Google Validation Layer", "instance_extensions": [ diff --git a/layers/windows/VkLayer_unique_objects.json b/layers/windows/VkLayer_unique_objects.json index 06d983b..78ce4a8 100644 --- a/layers/windows/VkLayer_unique_objects.json +++ b/layers/windows/VkLayer_unique_objects.json @@ -4,7 +4,7 @@ "name": "VK_LAYER_GOOGLE_unique_objects", "type": "GLOBAL", "library_path": ".\\VkLayer_unique_objects.dll", - "api_version": "1.0.7", + "api_version": "1.0.8", "implementation_version": "1", "description": "Google Validation Layer" } commit 0731d46912e7b946b3775977c7c030bab542cd9d Author: Jon Ashburn <j...@lunarg.com> Date: Mon Apr 4 10:47:18 2016 -0600 header: update to vers 1.0.8 which had no changes Change-Id: I809110e8483d1877f5106551d9f066ed6c25d8bc diff --git a/include/vulkan/vulkan.h b/include/vulkan/vulkan.h index d26e634..dca5e25 100644 --- a/include/vulkan/vulkan.h +++ b/include/vulkan/vulkan.h @@ -50,7 +50,7 @@ extern "C" { #define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3ff) #define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xfff) // Version of this file -#define VK_HEADER_VERSION 7 +#define VK_HEADER_VERSION 8 #define VK_NULL_HANDLE 0 commit cd99e567ae76ae6a6900b80b2c8f6031a194003a Author: Dustin Graves <dus...@lunarg.com> Date: Thu Mar 31 09:50:42 2016 -0600 layers: Fix param checker struct array handling Fix parameter validation issue with arrays of structs, where only the first item in the array was processed. Validation messages for arrays of structs will currently print the array variable name with the letter 'i' as the array index instead of the actual index number, producing a value like 'pCreateInfos[i]'. This will be fixed by a future update. Change-Id: I2cb773c23c6515a20ac8cb066e7cc61028e569f8 diff --git a/generator.py b/generator.py index 5a9ed70..84d7edc 100644 --- a/generator.py +++ b/generator.py @@ -2896,6 +2896,8 @@ class ParamCheckerOutputGenerator(OutputGenerator): self.newline() # # Headers + write('#include <string>', file=self.outFile) + self.newline() write('#include "vulkan/vulkan.h"', file=self.outFile) write('#include "vk_layer_extension_utils.h"', file=self.outFile) write('#include "parameter_validation_utils.h"', file=self.outFile) @@ -3348,12 +3350,14 @@ class ParamCheckerOutputGenerator(OutputGenerator): else: checkExpr = 'skipCall |= validate_required_pointer(report_data, {}, {}, {}{vn});\n'.format(name, valueDisplayName, valuePrefix, vn=value.name) # - # If this is a pointer to a struct, see if it contains members - # that need to be checked - if value.type in self.validatedStructs: + # If this is a pointer to a struct (input), see if it contains members that need to be checked + if value.type in self.validatedStructs and value.isconst: # # The name prefix used when reporting an error with a struct member (eg. the 'pCreateInfor->' in 'pCreateInfo->sType') - prefix = '(std::string({}) + std::string("{}->")).c_str()'.format(variablePrefix, value.name) if variablePrefix else '"{}->"'.format(value.name) + if lenParam: + prefix = '(std::string({}) + std::string("{}[i]->")).c_str()'.format(variablePrefix, value.name) if variablePrefix else '(std::string("{}[i]->")).c_str()'.format(value.name) + else: + prefix = '(std::string({}) + std::string("{}->")).c_str()'.format(variablePrefix, value.name) if variablePrefix else '"{}->"'.format(value.name) # membersInputOnly = self.validatedStructs[value.type] # @@ -3366,15 +3370,35 @@ class ParamCheckerOutputGenerator(OutputGenerator): isInput = 'true' if value.isconst else 'false' if checkExpr: checkExpr += '\n' + indent - checkExpr += 'skipCall |= parameter_validation_{}(report_data, {}, {}, {}, {}{});\n'.format(value.type, name, prefix, isInput, valuePrefix, value.name) + if lenParam: + # Need to process all elements in the array + checkExpr += 'for (uint32_t i = 0; i < {}{}; ++i) {{\n'.format(valuePrefix, lenParam.name) + indent = self.incIndent(indent) + checkExpr += indent + 'skipCall |= parameter_validation_{}(report_data, {}, {}, {}, &({}{}[i]));\n'.format(value.type, name, prefix, isInput, valuePrefix, value.name) + indent = self.decIndent(indent) + checkExpr += indent + '}\n' + else: + checkExpr += 'skipCall |= parameter_validation_{}(report_data, {}, {}, {}, {}{});\n'.format(value.type, name, prefix, isInput, valuePrefix, value.name) else: # Validation function does not have an isInput field - expr = 'skipCall |= parameter_validation_{}(report_data, {}, {}, {}{});\n'.format(value.type, name, prefix, valuePrefix, value.name) + if lenParam: + # Need to process all elements in the array + expr = 'for (uint32_t i = 0; i < {}{}; ++i) {{\n'.format(valuePrefix, lenParam.name) + indent = self.incIndent(indent) + expr += indent + 'skipCall |= parameter_validation_{}(report_data, {}, {}, &({}{}[i]));\n'.format(value.type, name, prefix, valuePrefix, value.name) + indent = self.decIndent(indent) + expr += indent + '}\n' + else: + expr = 'skipCall |= parameter_validation_{}(report_data, {}, {}, {}{});\n'.format(value.type, name, prefix, valuePrefix, value.name) # # If the struct only has input-only members and is a member of another struct, it is conditionally processed based on 'isInput' if valuePrefix and membersInputOnly == self.STRUCT_MEMBERS_INPUT_ONLY_EXCLUSIVE: if needConditionCheck: - conditionalExprs.append(expr) + if expr.count('\n') > 1: + # TODO: Proper fix for this formatting workaround + conditionalExprs.append(expr.replace(' ' * 8, ' ' * 12)) + else: + conditionalExprs.append(expr) else: if checkExpr: checkExpr += '\n' + indent commit e78276be1425aa8b1ca4d529db7a54a60dff9ec2 Author: Dustin Graves <dus...@lunarg.com> Date: Fri Mar 25 15:13:28 2016 -0600 layers: Update param_checker VkResult validation VkResult validation now prints a description of the error code being returned. Change-Id: Ia6dc4e71ef6d1b27365e3c0499b24a3fc1d332ac diff --git a/layers/parameter_validation.cpp b/layers/parameter_validation.cpp index 714a5eb..561ba2f 100644 --- a/layers/parameter_validation.cpp +++ b/layers/parameter_validation.cpp @@ -163,75 +163,6 @@ vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pCou return util_GetLayerProperties(ARRAY_SIZE(pc_global_layers), pc_global_layers, pCount, pProperties); } -static std::string EnumeratorString(VkResult const &enumerator) { - switch (enumerator) { - case VK_RESULT_MAX_ENUM: { - return "VK_RESULT_MAX_ENUM"; - break; - } - case VK_ERROR_LAYER_NOT_PRESENT: { - return "VK_ERROR_LAYER_NOT_PRESENT"; - break; - } - case VK_ERROR_INCOMPATIBLE_DRIVER: { - return "VK_ERROR_INCOMPATIBLE_DRIVER"; - break; - } - case VK_ERROR_MEMORY_MAP_FAILED: { - return "VK_ERROR_MEMORY_MAP_FAILED"; - break; - } - case VK_INCOMPLETE: { - return "VK_INCOMPLETE"; - break; - } - case VK_ERROR_OUT_OF_HOST_MEMORY: { - return "VK_ERROR_OUT_OF_HOST_MEMORY"; - break; - } - case VK_ERROR_INITIALIZATION_FAILED: { - return "VK_ERROR_INITIALIZATION_FAILED"; - break; - }