From 3bba4a9a1858cc0fa4a85cef10ed5500b9aea3bb Mon Sep 17 00:00:00 2001 From: Mark Lobodzinski Date: Mon, 3 Oct 2016 16:01:12 -0600 Subject: [PATCH] layers: Clean up Windows build warnings Change-Id: Iec47464d56c862cb1a6f132241d200d6f68efa21 --- layers/core_validation.cpp | 6 +++--- layers/object_tracker.cpp | 20 +++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index afc0e3a..3768a88 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -5237,7 +5237,7 @@ static void initializeAndTrackMemory(layer_data *dev_data, VkDeviceMemory mem, V // From spec: (ppData - offset) must be aligned to at least limits::minMemoryMapAlignment. uint64_t start_offset = offset % map_alignment; // Data passed to driver will be wrapped by a guardband of data to detect over- or under-writes. - mem_info->shadow_copy_base = malloc(2 * mem_info->shadow_pad_size + size + map_alignment + start_offset); + mem_info->shadow_copy_base = malloc(static_cast(2 * mem_info->shadow_pad_size + size + map_alignment + start_offset)); mem_info->shadow_copy = reinterpret_cast((reinterpret_cast(mem_info->shadow_copy_base) + map_alignment) & @@ -5245,7 +5245,7 @@ static void initializeAndTrackMemory(layer_data *dev_data, VkDeviceMemory mem, V assert(vk_safe_modulo(reinterpret_cast(mem_info->shadow_copy) + mem_info->shadow_pad_size - start_offset, map_alignment) == 0); - memset(mem_info->shadow_copy, NoncoherentMemoryFillValue, 2 * mem_info->shadow_pad_size + size); + memset(mem_info->shadow_copy, NoncoherentMemoryFillValue, static_cast(2 * mem_info->shadow_pad_size + size)); *ppData = static_cast(mem_info->shadow_copy) + mem_info->shadow_pad_size; } } @@ -10194,7 +10194,7 @@ CmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *p if (renderPass) { uint32_t clear_op_size = 0; // Make sure pClearValues is at least as large as last LOAD_OP_CLEAR cb_node->activeFramebuffer = pRenderPassBegin->framebuffer; - for (size_t i = 0; i < renderPass->createInfo.attachmentCount; ++i) { + for (uint32_t i = 0; i < renderPass->createInfo.attachmentCount; ++i) { MT_FB_ATTACHMENT_INFO &fb_info = framebuffer->attachments[i]; auto pAttachment = &renderPass->createInfo.pAttachments[i]; if (FormatSpecificLoadAndStoreOpSettings(pAttachment->format, pAttachment->loadOp, diff --git a/layers/object_tracker.cpp b/layers/object_tracker.cpp index afbd906..11a78c0 100644 --- a/layers/object_tracker.cpp +++ b/layers/object_tracker.cpp @@ -252,10 +252,11 @@ uint64_t handle_value(T *handle) { } template -static void CreateObject(T1 dispatchable_object, T2 object, VkDebugReportObjectTypeEXT object_type, bool custom_allocator) { +static void CreateObject(T1 dispatchable_object, T2 object, VkDebugReportObjectTypeEXT object_type, const VkAllocationCallbacks *pAllocator) { layer_data *instance_data = get_my_data_ptr(get_dispatch_key(dispatchable_object), layer_data_map); auto object_handle = handle_value(object); + bool custom_allocator = pAllocator != nullptr; log_msg(instance_data->report_data, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, object_type, object_handle, __LINE__, OBJTRACK_NONE, LayerName, "OBJ[0x%" PRIxLEAST64 "] : CREATE %s object 0x%" PRIxLEAST64, object_track_index++, @@ -271,10 +272,11 @@ static void CreateObject(T1 dispatchable_object, T2 object, VkDebugReportObjectT } template -static void DestroyObject(T1 dispatchable_object, T2 object, VkDebugReportObjectTypeEXT object_type, bool custom_allocator) { +static void DestroyObject(T1 dispatchable_object, T2 object, VkDebugReportObjectTypeEXT object_type, const VkAllocationCallbacks *pAllocator) { layer_data *device_data = get_my_data_ptr(get_dispatch_key(dispatchable_object), layer_data_map); auto object_handle = handle_value(object); + bool custom_allocator = pAllocator != nullptr; auto item = device_data->object_map[object_type].find(object_handle); if (item != device_data->object_map[object_type].end()) { @@ -291,7 +293,7 @@ static void DestroyObject(T1 dispatchable_object, T2 object, VkDebugReportObject object_name[pNode->object_type], reinterpret_cast(object), device_data->num_total_objects, device_data->num_objects[pNode->object_type], object_name[pNode->object_type]); - auto allocated_with_custom = pNode->status & OBJSTATUS_CUSTOM_ALLOCATOR; + auto allocated_with_custom = (pNode->status & OBJSTATUS_CUSTOM_ALLOCATOR) ? true : false; if (custom_allocator ^ allocated_with_custom) { log_msg(device_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, object_type, object_handle, __LINE__, OBJTRACK_ALLOCATOR_MISMATCH, LayerName, @@ -1524,7 +1526,7 @@ VKAPI_ATTR VkResult VKAPI_CALL ResetDescriptorPool(VkDevice device, VkDescriptor auto del_itr = itr++; if (pNode->parent_object == reinterpret_cast(descriptorPool)) { DestroyObject(device, (VkDescriptorSet)((*del_itr).first), - VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, false); + VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, nullptr); } } lock.unlock(); @@ -3230,7 +3232,7 @@ VKAPI_ATTR VkResult VKAPI_CALL EnumeratePhysicalDevices(VkInstance instance, uin if (result == VK_SUCCESS) { if (pPhysicalDevices) { for (uint32_t i = 0; i < *pPhysicalDeviceCount; i++) { - CreateObject(instance, pPhysicalDevices[i], VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, false); + CreateObject(instance, pPhysicalDevices[i], VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, nullptr); } } } @@ -3375,7 +3377,7 @@ VKAPI_ATTR void VKAPI_CALL FreeCommandBuffers(VkDevice device, VkCommandPool com } for (uint32_t i = 0; i < commandBufferCount; i++) { - DestroyObject(device, pCommandBuffers[i], VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); + DestroyObject(device, pCommandBuffers[i], VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, nullptr); } lock.unlock(); @@ -3418,7 +3420,7 @@ VKAPI_ATTR VkResult VKAPI_CALL FreeDescriptorSets(VkDevice device, VkDescriptorP } for (uint32_t i = 0; i < descriptorSetCount; i++) { - DestroyObject(device, pDescriptorSets[i], VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, false); + DestroyObject(device, pDescriptorSets[i], VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, nullptr); } lock.unlock(); @@ -3450,7 +3452,7 @@ VKAPI_ATTR void VKAPI_CALL DestroyDescriptorPool(VkDevice device, VkDescriptorPo auto del_itr = itr++; if (pNode->parent_object == reinterpret_cast(descriptorPool)) { DestroyObject(device, (VkDescriptorSet)((*del_itr).first), - VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, false); + VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT, nullptr); } } DestroyObject(device, descriptorPool, VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT, pAllocator); @@ -3479,7 +3481,7 @@ VKAPI_ATTR void VKAPI_CALL DestroyCommandPool(VkDevice device, VkCommandPool com if (pNode->parent_object == reinterpret_cast(commandPool)) { skip_call |= ValidateCommandBuffer(device, commandPool, reinterpret_cast((*del_itr).first)); DestroyObject(device, reinterpret_cast((*del_itr).first), - VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false); + VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, nullptr); } } DestroyObject(device, commandPool, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT, pAllocator); -- 2.7.4