diff options
| author | Michael Lentine <mlentine@google.com> | 2016-02-03 16:51:46 -0600 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2016-02-10 09:19:29 -0700 |
| commit | eba876d78708b086fc48abd38cd4e638e282b853 (patch) | |
| tree | 018123c70b06e3a1b477fc0907a9360a44426bf9 /layers | |
| parent | 32bce170582e151c13df697f410a8ccda72454b3 (diff) | |
| download | usermoji-eba876d78708b086fc48abd38cd4e638e282b853.tar.xz | |
layers: Enable Wall and Werror.
Diffstat (limited to 'layers')
| -rw-r--r-- | layers/device_limits.cpp | 9 | ||||
| -rw-r--r-- | layers/draw_state.cpp | 22 | ||||
| -rwxr-xr-x | layers/draw_state.h | 11 | ||||
| -rw-r--r-- | layers/image.cpp | 2 | ||||
| -rw-r--r-- | layers/mem_tracker.cpp | 8 | ||||
| -rw-r--r-- | layers/object_tracker.h | 18 | ||||
| -rw-r--r-- | layers/param_checker.cpp | 7 | ||||
| -rw-r--r-- | layers/swapchain.cpp | 3 | ||||
| -rw-r--r-- | layers/vk_layer_table.cpp | 5 | ||||
| -rw-r--r-- | layers/vk_layer_utils.cpp | 1 |
10 files changed, 28 insertions, 58 deletions
diff --git a/layers/device_limits.cpp b/layers/device_limits.cpp index 1b158191..b11f34cb 100644 --- a/layers/device_limits.cpp +++ b/layers/device_limits.cpp @@ -97,8 +97,6 @@ struct layer_data { static unordered_map<void *, layer_data *> layer_data_map; -static LOADER_PLATFORM_THREAD_ONCE_DECLARATION(g_initOnce); - // TODO : This can be much smarter, using separate locks for separate global data static int globalLockInitialized = 0; static loader_platform_thread_mutex globalLock; @@ -558,9 +556,11 @@ VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkBeginCommandBuffer(VkCommandBuf "Cannot enable in occlusion queries in vkBeginCommandBuffer() and set queryFlags to %d which is not a valid combination of VkQueryControlFlagBits.", pInfo->queryFlags); } + VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; if (!skipCall) - return dev_data->device_dispatch_table->BeginCommandBuffer(commandBuffer, pBeginInfo); - return VK_ERROR_VALIDATION_FAILED_EXT; + result = dev_data->device_dispatch_table->BeginCommandBuffer( + commandBuffer, pBeginInfo); + return result; } VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue) @@ -613,7 +613,6 @@ VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSets( const VkCopyDescriptorSet *pDescriptorCopies) { 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; for (uint32_t i = 0; i < descriptorWriteCount; i++) { diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp index d73319e1..bac580cb 100644 --- a/layers/draw_state.cpp +++ b/layers/draw_state.cpp @@ -219,7 +219,6 @@ struct shader_module { // TODO : Do we need to guard access to layer_data_map w/ lock? static unordered_map<void*, layer_data*> layer_data_map; -static LOADER_PLATFORM_THREAD_ONCE_DECLARATION(g_initOnce); // TODO : This can be much smarter, using separate locks for separate global data static int globalLockInitialized = 0; static loader_platform_thread_mutex globalLock; @@ -1362,7 +1361,6 @@ validate_pipeline_shaders(layer_data *my_data, VkDevice dev, PIPELINE_NODE* pPip /* We seem to allow pipeline stages to be specified out of order, so collect and identify them * before trying to do anything more: */ int vertex_stage = get_shader_stage_id(VK_SHADER_STAGE_VERTEX_BIT); - int geometry_stage = get_shader_stage_id(VK_SHADER_STAGE_GEOMETRY_BIT); int fragment_stage = get_shader_stage_id(VK_SHADER_STAGE_FRAGMENT_BIT); shader_module **shaders = new shader_module*[fragment_stage + 1]; /* exclude CS */ @@ -1910,9 +1908,10 @@ static uint32_t getUpdateCount(layer_data* my_data, const VkDevice device, const case VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET: // TODO : Need to understand this case better and make sure code is correct return ((VkCopyDescriptorSet*)pUpdateStruct)->descriptorCount; + default: + return 0; } - - return 0; + return 0; } // For given Layout Node and binding, return index where that binding begins @@ -1999,10 +1998,6 @@ static VkBool32 shadowUpdateNode(layer_data* my_data, const VkDevice device, GEN VkBool32 skipCall = VK_FALSE; VkWriteDescriptorSet* pWDS = NULL; VkCopyDescriptorSet* pCDS = NULL; - size_t array_size = 0; - size_t base_array_size = 0; - size_t total_array_size = 0; - size_t baseBuffAddr = 0; switch (pUpdate->sType) { case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET: @@ -2177,11 +2172,7 @@ static VkBool32 validateUpdateContents(const layer_data* my_data, const VkWriteD { VkBool32 skipCall = VK_FALSE; // First verify that for the given Descriptor type, the correct DescriptorInfo data is supplied - VkBufferView* pBufferView = NULL; const VkSampler* pSampler = NULL; - VkImageView* pImageView = NULL; - VkImageLayout* pImageLayout = NULL; - VkDescriptorBufferInfo* pBufferInfo = NULL; VkBool32 immutable = VK_FALSE; uint32_t i = 0; // For given update type, verify that update contents are correct @@ -2235,6 +2226,8 @@ static VkBool32 validateUpdateContents(const layer_data* my_data, const VkWriteD skipCall |= validateBufferInfo(my_data, &(pWDS->pBufferInfo[i])); } break; + default: + break; } return skipCall; } @@ -2464,10 +2457,7 @@ static void freeShadowUpdateTree(SET_NODE* pSet) while(pShadowUpdate) { pFreeUpdate = pShadowUpdate; pShadowUpdate = (GENERIC_HEADER*)pShadowUpdate->pNext; - uint32_t index = 0; VkWriteDescriptorSet * pWDS = NULL; - VkCopyDescriptorSet * pCDS = NULL; - void** ppToFree = NULL; switch (pFreeUpdate->sType) { case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET: @@ -2873,7 +2863,6 @@ static VkBool32 printPipeline(layer_data* my_data, const VkCommandBuffer cb) static VkBool32 printDSConfig(layer_data* my_data, const VkCommandBuffer cb) { VkBool32 skipCall = VK_FALSE; - char ds_config_str[1024*256] = {0}; // TODO : Currently making this buffer HUGE w/o overrun protection. Need to be smarter, start smaller, and grow as needed. GLOBAL_CB_NODE* pCB = getCBNode(my_data, cb); if (pCB && pCB->lastBoundDescriptorSet) { SET_NODE* pSet = getSetNode(my_data, pCB->lastBoundDescriptorSet); @@ -3806,7 +3795,6 @@ VkBool32 validateIdleBuffer(const layer_data* my_data, VkBuffer buffer) { VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator) { layer_data* dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); - VkBool32 skip_call = VK_FALSE; loader_platform_thread_lock_mutex(&globalLock); if (!validateIdleBuffer(dev_data, buffer)) { loader_platform_thread_unlock_mutex(&globalLock); diff --git a/layers/draw_state.h b/layers/draw_state.h index f815a11d..8e8cd2e3 100755 --- a/layers/draw_state.h +++ b/layers/draw_state.h @@ -319,7 +319,7 @@ struct RENDER_PASS_NODE { const uint32_t att = subpass->pColorAttachments[j].attachment; const VkFormat format = pCreateInfo->pAttachments[att].format; - color_formats.push_back(pCreateInfo->pAttachments[att].format); + color_formats.push_back(format); } subpassColorFormats.push_back(color_formats); @@ -412,10 +412,11 @@ typedef struct _DESCRIPTOR_POOL_NODE { vector<uint32_t> maxDescriptorTypeCount; // max # of descriptors of each type in this pool vector<uint32_t> availableDescriptorTypeCount; // available # of descriptors of each type in this pool - _DESCRIPTOR_POOL_NODE(const VkDescriptorPool pool, const VkDescriptorPoolCreateInfo* pCreateInfo) : - pool(pool), createInfo(*pCreateInfo), maxSets(pCreateInfo->maxSets), pSets(NULL), - maxDescriptorTypeCount(VK_DESCRIPTOR_TYPE_RANGE_SIZE), availableDescriptorTypeCount(VK_DESCRIPTOR_TYPE_RANGE_SIZE) - { + _DESCRIPTOR_POOL_NODE(const VkDescriptorPool pool, + const VkDescriptorPoolCreateInfo *pCreateInfo) + : pool(pool), maxSets(pCreateInfo->maxSets), createInfo(*pCreateInfo), + pSets(NULL), maxDescriptorTypeCount(VK_DESCRIPTOR_TYPE_RANGE_SIZE), + availableDescriptorTypeCount(VK_DESCRIPTOR_TYPE_RANGE_SIZE) { if (createInfo.poolSizeCount) { // Shadow type struct from ptr into local struct size_t poolSizeCountSize = createInfo.poolSizeCount * sizeof(VkDescriptorPoolSize); createInfo.pPoolSizes = new VkDescriptorPoolSize[poolSizeCountSize]; diff --git a/layers/image.cpp b/layers/image.cpp index a40b2f23..62c42841 100644 --- a/layers/image.cpp +++ b/layers/image.cpp @@ -343,7 +343,7 @@ VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateImage(VkDevice device, co { VkBool32 skipCall = VK_FALSE; VkResult result = VK_ERROR_VALIDATION_FAILED_EXT; - VkImageFormatProperties ImageFormatProperties = {0}; + VkImageFormatProperties ImageFormatProperties; layer_data *device_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); VkPhysicalDevice physicalDevice = device_data->physicalDevice; diff --git a/layers/mem_tracker.cpp b/layers/mem_tracker.cpp index 196596ae..a7e8c296 100644 --- a/layers/mem_tracker.cpp +++ b/layers/mem_tracker.cpp @@ -52,7 +52,6 @@ using namespace std; #include "vk_layer_table.h" #include "vk_layer_data.h" #include "vk_layer_logging.h" -static LOADER_PLATFORM_THREAD_ONCE_DECLARATION(g_initOnce); // WSI Image Objects bypass usual Image Object creation methods. A special Memory // Object value will be used to identify them internally. @@ -127,6 +126,8 @@ static MT_OBJ_BINDING_INFO* return &(*it).second; break; } + default: + break; } return retValue; } @@ -229,6 +230,8 @@ add_object_binding_info( pCI->mem = mem; break; } + default: + break; } } @@ -270,6 +273,8 @@ add_object_create_info( const_cast<VkSwapchainCreateInfoKHR*>(static_cast<const VkSwapchainCreateInfoKHR *>(pCreateInfo))->imageUsage; break; } + default: + break; } } @@ -898,7 +903,6 @@ set_sparse_mem_binding( pInfo->refCount++; } // Need to set mem binding for this object - MT_MEM_OBJ_INFO* pPrevBinding = get_mem_obj_info(my_data, pObjBindInfo->mem); pObjBindInfo->mem = mem; } } diff --git a/layers/object_tracker.h b/layers/object_tracker.h index 1f2b41a9..33202e94 100644 --- a/layers/object_tracker.h +++ b/layers/object_tracker.h @@ -495,24 +495,6 @@ extern unordered_map<uint64_t, OBJTRACK_NODE*> VkCommandBufferMap; extern unordered_map<uint64_t, OBJTRACK_NODE*> VkSwapchainKHRMap; extern unordered_map<uint64_t, OBJTRACK_NODE*> VkSurfaceKHRMap; -static VkBool32 set_status(VkQueue dispatchable_object, VkFence object, VkDebugReportObjectTypeEXT objType, ObjectStatusFlags status_flag) -{ - VkBool32 skipCall = VK_FALSE; - if (object != VK_NULL_HANDLE) { - if (VkFenceMap.find((uint64_t)(object)) != VkFenceMap.end()) { - OBJTRACK_NODE* pNode = VkFenceMap[(uint64_t)(object)]; - pNode->status |= status_flag; - } - else { - // If we do not find it print an error - skipCall |= log_msg(mdd(dispatchable_object), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT) 0, (uint64_t) object, __LINE__, OBJTRACK_NONE, "OBJTRACK", - "Unable to set status for non-existent object 0x%" PRIxLEAST64 " of %s type", - (uint64_t)(object), string_VkDebugReportObjectTypeEXT(objType)); - } - } - return skipCall; -} - static void create_physical_device(VkInstance dispatchable_object, VkPhysicalDevice vkObj, VkDebugReportObjectTypeEXT objType) { log_msg(mdd(dispatchable_object), VK_DEBUG_REPORT_INFO_BIT_EXT, objType, reinterpret_cast<uint64_t>(vkObj), __LINE__, OBJTRACK_NONE, "OBJTRACK", diff --git a/layers/param_checker.cpp b/layers/param_checker.cpp index 7f085940..3aa0f567 100644 --- a/layers/param_checker.cpp +++ b/layers/param_checker.cpp @@ -4053,10 +4053,9 @@ bool PreCreateGraphicsPipelines( "vkCreateGraphicsPipelines parameter, VkStructureType pCreateInfos->pColorBlendState->sType, is an invalid enumerator"); return false; } - if(pCreateInfos->pColorBlendState->logicOpEnable == VK_TRUE && - pCreateInfos->pColorBlendState->logicOp < VK_LOGIC_OP_BEGIN_RANGE || - pCreateInfos->pColorBlendState->logicOp > VK_LOGIC_OP_END_RANGE) - { + if (pCreateInfos->pColorBlendState->logicOpEnable == VK_TRUE && + (pCreateInfos->pColorBlendState->logicOp < VK_LOGIC_OP_BEGIN_RANGE || + pCreateInfos->pColorBlendState->logicOp > VK_LOGIC_OP_END_RANGE)) { log_msg(mdd(device), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK", "vkCreateGraphicsPipelines parameter, VkLogicOp pCreateInfos->pColorBlendState->logicOp, is an unrecognized enumerator"); return false; diff --git a/layers/swapchain.cpp b/layers/swapchain.cpp index de9fc777..1e233e94 100644 --- a/layers/swapchain.cpp +++ b/layers/swapchain.cpp @@ -1044,7 +1044,6 @@ VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR(VkInstance insta VkBool32 skipCall = VK_FALSE; layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map); loader_platform_thread_lock_mutex(&globalLock); - SwpInstance *pInstance = &(my_data->instanceMap[instance]); SwpSurface *pSurface = &my_data->surfaceMap[surface]; // Regardless of skipCall value, do some internal cleanup: @@ -1502,7 +1501,6 @@ static VkBool32 validateCreateSwapchainKHR( { // TODO: Validate cases of re-creating a swapchain (the current code // assumes a new swapchain is being created). - VkResult result = VK_SUCCESS; VkBool32 skipCall = VK_FALSE; layer_data *my_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map); char fn[] = "vkCreateSwapchainKHR"; @@ -2207,7 +2205,6 @@ VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueuePresentKHR( for (uint32_t i = 0; pPresentInfo && (i < pPresentInfo->swapchainCount); i++) { - uint32_t swapchainCount = pPresentInfo->swapchainCount; uint32_t index = pPresentInfo->pImageIndices[i]; SwpSwapchain *pSwapchain = &my_data->swapchainMap[pPresentInfo->pSwapchains[i]]; diff --git a/layers/vk_layer_table.cpp b/layers/vk_layer_table.cpp index 3cee6ddb..9277a8d8 100644 --- a/layers/vk_layer_table.cpp +++ b/layers/vk_layer_table.cpp @@ -1,6 +1,7 @@ /* Copyright (c) 2015-2016 The Khronos Group Inc. * Copyright (c) 2015-2016 Valve Corporation * Copyright (c) 2015-2016 LunarG, Inc. + * Copyright (c) 2015-2016 Google, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and/or associated documentation files (the "Materials"), to @@ -63,8 +64,8 @@ VkLayerInstanceDispatchTable *instance_dispatch_table(void* object) void destroy_dispatch_table(device_table_map &map, dispatch_key key) { - device_table_map::const_iterator it = map.find((void *) key); #if DISPATCH_MAP_DEBUG + device_table_map::const_iterator it = map.find((void *)key); if (it != map.end()) { fprintf(stderr, "destroy device dispatch_table: map: %p, key: %p, table: %p\n", &map, key, it->second); } else { @@ -77,8 +78,8 @@ void destroy_dispatch_table(device_table_map &map, dispatch_key key) void destroy_dispatch_table(instance_table_map &map, dispatch_key key) { - instance_table_map::const_iterator it = map.find((void *) key); #if DISPATCH_MAP_DEBUG + instance_table_map::const_iterator it = map.find((void *)key); if (it != map.end()) { fprintf(stderr, "destroy instance dispatch_table: map: %p, key: %p, table: %p\n", &map, key, it->second); } else { diff --git a/layers/vk_layer_utils.cpp b/layers/vk_layer_utils.cpp index 59c4222b..e1612fd1 100644 --- a/layers/vk_layer_utils.cpp +++ b/layers/vk_layer_utils.cpp @@ -613,7 +613,6 @@ static const char UTF8_DATA_BYTE_MASK = 0xC0; VkStringErrorFlags vk_string_validate(const int max_length, const char *utf8) { VkStringErrorFlags result = VK_STRING_ERROR_NONE; - int code; int num_char_bytes; int i,j; |
