From 28c4d5fba7ea129dcbbc7b63b8f62bb3e686f021 Mon Sep 17 00:00:00 2001 From: Courtney Goeltzenleuchter Date: Tue, 14 Apr 2015 18:48:46 -0600 Subject: vulkan: API renaming VK_DEVICE_QUEUE_CREATE_INFO => VkDeviceQueueCreateInfo VK_DEVICE_CREATE_INFO => VkDeviceCreateInfo VK_INSTANCE_CREATE_INFO => VkInstanceCreateInfo VK_LAYER_CREATE_INFO => VkLayerCreateInfo VK_MEMORY_ALLOC_INFO => VkMemoryAllocInfo VK_MEMORY_ALLOC_IMAGE_INFO => VkMemoryAllocImageInfo VK_MEMORY_ALLOC_BUFFER_INFO => VkMemoryAllocBufferInfo VK_BUFFER_CREATE_INFO => VkBufferCreateInfo VK_BUFFER_VIEW_CREATE_INFO => VkBufferViewCreateInfo --- demos/cube.c | 24 +++++++++--------- demos/tri.c | 20 +++++++-------- demos/vulkaninfo.c | 6 ++--- icd/nulldrv/nulldrv.c | 22 ++++++++--------- include/vulkan.h | 64 ++++++++++++++++++++++++------------------------ layers/basic.cpp | 2 +- layers/draw_state.cpp | 10 ++++---- layers/draw_state.h | 2 +- layers/glave_snapshot.c | 46 +++++++++++++++++----------------- layers/glave_snapshot.h | 6 ++--- layers/mem_tracker.cpp | 20 +++++++-------- layers/mem_tracker.h | 2 +- layers/multi.cpp | 4 +-- layers/param_checker.cpp | 27 ++++++++++---------- loader/loader.c | 6 ++--- loader/loader.h | 2 +- vk-layer-generate.py | 22 ++++++++--------- vk_helper.py | 46 +++++++++++++++++++++++++++++----- vulkan.py | 10 ++++---- 19 files changed, 186 insertions(+), 155 deletions(-) diff --git a/demos/cube.c b/demos/cube.c index df58990d..80ed290d 100644 --- a/demos/cube.c +++ b/demos/cube.c @@ -594,11 +594,11 @@ static void demo_prepare_depth(struct demo *demo) .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_BIT, .flags = 0, }; - VK_MEMORY_ALLOC_IMAGE_INFO img_alloc = { + VkMemoryAllocImageInfo img_alloc = { .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_IMAGE_INFO, .pNext = NULL, }; - VK_MEMORY_ALLOC_INFO mem_alloc = { + VkMemoryAllocInfo mem_alloc = { .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO, .pNext = &img_alloc, .allocationSize = 0, @@ -851,15 +851,15 @@ static void demo_prepare_texture_image(struct demo *demo, .usage = VK_IMAGE_USAGE_TRANSFER_SOURCE_BIT, .flags = 0, }; - VK_MEMORY_ALLOC_BUFFER_INFO buf_alloc = { + VkMemoryAllocBufferInfo buf_alloc = { .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_BUFFER_INFO, .pNext = NULL, }; - VK_MEMORY_ALLOC_IMAGE_INFO img_alloc = { + VkMemoryAllocImageInfo img_alloc = { .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_IMAGE_INFO, .pNext = &buf_alloc, }; - VK_MEMORY_ALLOC_INFO mem_alloc = { + VkMemoryAllocInfo mem_alloc = { .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO, .pNext = &img_alloc, .allocationSize = 0, @@ -1087,13 +1087,13 @@ static void demo_prepare_textures(struct demo *demo) void demo_prepare_cube_data_buffer(struct demo *demo) { - VK_BUFFER_CREATE_INFO buf_info; - VK_BUFFER_VIEW_CREATE_INFO view_info; - VK_MEMORY_ALLOC_BUFFER_INFO buf_alloc = { + VkBufferCreateInfo buf_info; + VkBufferViewCreateInfo view_info; + VkMemoryAllocBufferInfo buf_alloc = { .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_BUFFER_INFO, .pNext = NULL, }; - VK_MEMORY_ALLOC_INFO alloc_info = { + VkMemoryAllocInfo alloc_info = { .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO, .pNext = &buf_alloc, .allocationSize = 0, @@ -1731,7 +1731,7 @@ static void demo_init_vk(struct demo *demo) .engineVersion = 0, .apiVersion = VK_API_VERSION, }; - const VK_INSTANCE_CREATE_INFO inst_info = { + const VkInstanceCreateInfo inst_info = { .sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, .pNext = NULL, .pAppInfo = &app, @@ -1744,14 +1744,14 @@ static void demo_init_vk(struct demo *demo) .root = demo->screen->root, .provider = 0, }; - const VK_DEVICE_QUEUE_CREATE_INFO queue = { + const VkDeviceQueueCreateInfo queue = { .queueNodeIndex = 0, .queueCount = 1, }; const char *ext_names[] = { "VK_WSI_X11", }; - const VK_DEVICE_CREATE_INFO device = { + const VkDeviceCreateInfo device = { .sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, .pNext = NULL, .queueRecordCount = 1, diff --git a/demos/tri.c b/demos/tri.c index cfb7f391..91b8f0ed 100644 --- a/demos/tri.c +++ b/demos/tri.c @@ -399,11 +399,11 @@ static void demo_prepare_depth(struct demo *demo) .usage = VK_IMAGE_USAGE_DEPTH_STENCIL_BIT, .flags = 0, }; - VK_MEMORY_ALLOC_IMAGE_INFO img_alloc = { + VkMemoryAllocImageInfo img_alloc = { .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_IMAGE_INFO, .pNext = NULL, }; - VK_MEMORY_ALLOC_INFO mem_alloc = { + VkMemoryAllocInfo mem_alloc = { .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO, .pNext = &img_alloc, .allocationSize = 0, @@ -506,11 +506,11 @@ static void demo_prepare_texture_image(struct demo *demo, .usage = VK_IMAGE_USAGE_TRANSFER_SOURCE_BIT, .flags = 0, }; - VK_MEMORY_ALLOC_IMAGE_INFO img_alloc = { + VkMemoryAllocImageInfo img_alloc = { .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_IMAGE_INFO, .pNext = NULL, }; - VK_MEMORY_ALLOC_INFO mem_alloc = { + VkMemoryAllocInfo mem_alloc = { .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO, .pNext = &img_alloc, .allocationSize = 0, @@ -735,18 +735,18 @@ static void demo_prepare_vertices(struct demo *demo) { 1.0f, -1.0f, -0.5f, 1.0f, 0.0f }, { 0.0f, 1.0f, 1.0f, 0.5f, 1.0f }, }; - const VK_BUFFER_CREATE_INFO buf_info = { + const VkBufferCreateInfo buf_info = { .sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, .pNext = NULL, .size = sizeof(vb), .usage = VK_BUFFER_USAGE_VERTEX_FETCH_BIT, .flags = 0, }; - VK_MEMORY_ALLOC_BUFFER_INFO buf_alloc = { + VkMemoryAllocBufferInfo buf_alloc = { .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_BUFFER_INFO, .pNext = NULL, }; - VK_MEMORY_ALLOC_INFO mem_alloc = { + VkMemoryAllocInfo mem_alloc = { .sType = VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO, .pNext = &buf_alloc, .allocationSize = 0, @@ -1252,7 +1252,7 @@ static void demo_init_vk(struct demo *demo) .engineVersion = 0, .apiVersion = VK_API_VERSION, }; - const VK_INSTANCE_CREATE_INFO inst_info = { + const VkInstanceCreateInfo inst_info = { .sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, .pNext = NULL, .pAppInfo = &app, @@ -1265,14 +1265,14 @@ static void demo_init_vk(struct demo *demo) .root = demo->screen->root, .provider = 0, }; - const VK_DEVICE_QUEUE_CREATE_INFO queue = { + const VkDeviceQueueCreateInfo queue = { .queueNodeIndex = 0, .queueCount = 1, }; const char *ext_names[] = { "VK_WSI_X11", }; - const VK_DEVICE_CREATE_INFO device = { + const VkDeviceCreateInfo device = { .sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, .pNext = NULL, .queueRecordCount = 1, diff --git a/demos/vulkaninfo.c b/demos/vulkaninfo.c index 80f238a6..3bc416f6 100644 --- a/demos/vulkaninfo.c +++ b/demos/vulkaninfo.c @@ -60,7 +60,7 @@ struct app_gpu { uint32_t queue_count; VK_PHYSICAL_GPU_QUEUE_PROPERTIES *queue_props; - VK_DEVICE_QUEUE_CREATE_INFO *queue_reqs; + VkDeviceQueueCreateInfo *queue_reqs; VK_PHYSICAL_GPU_MEMORY_PROPERTIES memory_props; @@ -332,7 +332,7 @@ static void app_dev_init_formats(struct app_dev *dev) static void app_dev_init(struct app_dev *dev, struct app_gpu *gpu) { - VK_DEVICE_CREATE_INFO info = { + VkDeviceCreateInfo info = { .sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, .pNext = NULL, .queueRecordCount = 0, @@ -652,7 +652,7 @@ int main(int argc, char **argv) .engineVersion = 1, .apiVersion = VK_API_VERSION, }; - static const VK_INSTANCE_CREATE_INFO inst_info = { + static const VkInstanceCreateInfo inst_info = { .sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, .pNext = NULL, .pAppInfo = &app_info, diff --git a/icd/nulldrv/nulldrv.c b/icd/nulldrv/nulldrv.c index 55b5f2d4..41de195d 100644 --- a/icd/nulldrv/nulldrv.c +++ b/icd/nulldrv/nulldrv.c @@ -168,7 +168,7 @@ static VK_RESULT nulldrv_queue_create(struct nulldrv_dev *dev, } static VK_RESULT dev_create_queues(struct nulldrv_dev *dev, - const VK_DEVICE_QUEUE_CREATE_INFO *queues, + const VkDeviceQueueCreateInfo *queues, uint32_t count) { uint32_t i; @@ -177,7 +177,7 @@ static VK_RESULT dev_create_queues(struct nulldrv_dev *dev, return VK_ERROR_INVALID_POINTER; for (i = 0; i < count; i++) { - const VK_DEVICE_QUEUE_CREATE_INFO *q = &queues[i]; + const VkDeviceQueueCreateInfo *q = &queues[i]; VK_RESULT ret = VK_SUCCESS; if (q->queueCount == 1 && !dev->queues[q->queueNodeIndex]) { @@ -231,7 +231,7 @@ static VK_RESULT nulldrv_desc_ooxx_create(struct nulldrv_dev *dev, } static VK_RESULT nulldrv_dev_create(struct nulldrv_gpu *gpu, - const VK_DEVICE_CREATE_INFO *info, + const VkDeviceCreateInfo *info, struct nulldrv_dev **dev_ret) { struct nulldrv_dev *dev; @@ -402,7 +402,7 @@ static struct nulldrv_img *nulldrv_img(VK_IMAGE image) } static VK_RESULT nulldrv_mem_alloc(struct nulldrv_dev *dev, - const VK_MEMORY_ALLOC_INFO *info, + const VkMemoryAllocInfo *info, struct nulldrv_mem **mem_ret) { struct nulldrv_mem *mem; @@ -538,7 +538,7 @@ static VK_RESULT buf_get_info(struct nulldrv_base *base, int type, } static VK_RESULT nulldrv_buf_create(struct nulldrv_dev *dev, - const VK_BUFFER_CREATE_INFO *info, + const VkBufferCreateInfo *info, struct nulldrv_buf **buf_ret) { struct nulldrv_buf *buf; @@ -797,7 +797,7 @@ static struct nulldrv_buf *nulldrv_buf(VK_BUFFER buf) } static VK_RESULT nulldrv_buf_view_create(struct nulldrv_dev *dev, - const VK_BUFFER_VIEW_CREATE_INFO *info, + const VkBufferViewCreateInfo *info, struct nulldrv_buf_view **view_ret) { struct nulldrv_buf *buf = nulldrv_buf(info->buffer); @@ -822,7 +822,7 @@ static VK_RESULT nulldrv_buf_view_create(struct nulldrv_dev *dev, ICD_EXPORT VK_RESULT VKAPI vkCreateBuffer( VK_DEVICE device, - const VK_BUFFER_CREATE_INFO* pCreateInfo, + const VkBufferCreateInfo* pCreateInfo, VK_BUFFER* pBuffer) { NULLDRV_LOG_FUNC; @@ -1202,7 +1202,7 @@ ICD_EXPORT void VKAPI vkCmdPipelineBarrier( ICD_EXPORT VK_RESULT VKAPI vkCreateDevice( VK_PHYSICAL_GPU gpu_, - const VK_DEVICE_CREATE_INFO* pCreateInfo, + const VkDeviceCreateInfo* pCreateInfo, VK_DEVICE* pDevice) { NULLDRV_LOG_FUNC; @@ -1418,7 +1418,7 @@ ICD_EXPORT VK_RESULT VKAPI vkGetImageSubresourceInfo( ICD_EXPORT VK_RESULT VKAPI vkAllocMemory( VK_DEVICE device, - const VK_MEMORY_ALLOC_INFO* pAllocInfo, + const VkMemoryAllocInfo* pAllocInfo, VK_GPU_MEMORY* pMem) { NULLDRV_LOG_FUNC; @@ -1492,7 +1492,7 @@ ICD_EXPORT VK_RESULT VKAPI vkOpenPeerMemory( } ICD_EXPORT VK_RESULT VKAPI vkCreateInstance( - const VK_INSTANCE_CREATE_INFO* pCreateInfo, + const VkInstanceCreateInfo* pCreateInfo, VK_INSTANCE* pInstance) { NULLDRV_LOG_FUNC; @@ -1857,7 +1857,7 @@ ICD_EXPORT VK_RESULT VKAPI vkCreateDynamicDepthStencilState( ICD_EXPORT VK_RESULT VKAPI vkCreateBufferView( VK_DEVICE device, - const VK_BUFFER_VIEW_CREATE_INFO* pCreateInfo, + const VkBufferViewCreateInfo* pCreateInfo, VK_BUFFER_VIEW* pView) { NULLDRV_LOG_FUNC; diff --git a/include/vulkan.h b/include/vulkan.h index b3527c0c..ef5ce640 100644 --- a/include/vulkan.h +++ b/include/vulkan.h @@ -1396,25 +1396,25 @@ typedef struct _VK_ALLOC_CALLBACKS VK_FREE_FUNCTION pfnFree; } VK_ALLOC_CALLBACKS; -typedef struct _VK_DEVICE_QUEUE_CREATE_INFO +typedef struct _VkDeviceQueueCreateInfo { uint32_t queueNodeIndex; uint32_t queueCount; -} VK_DEVICE_QUEUE_CREATE_INFO; +} VkDeviceQueueCreateInfo; -typedef struct _VK_DEVICE_CREATE_INFO +typedef struct _VkDeviceCreateInfo { VK_STRUCTURE_TYPE sType; // Should be VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO const void* pNext; // Pointer to next structure uint32_t queueRecordCount; - const VK_DEVICE_QUEUE_CREATE_INFO* pRequestedQueues; + const VkDeviceQueueCreateInfo* pRequestedQueues; uint32_t extensionCount; const char*const* ppEnabledExtensionNames; VK_VALIDATION_LEVEL maxValidationLevel; VK_FLAGS flags; // VK_DEVICE_CREATE_FLAGS -} VK_DEVICE_CREATE_INFO; +} VkDeviceCreateInfo; -typedef struct _VK_INSTANCE_CREATE_INFO +typedef struct _VkInstanceCreateInfo { VK_STRUCTURE_TYPE sType; // Should be VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO const void* pNext; // Pointer to next structure @@ -1422,16 +1422,16 @@ typedef struct _VK_INSTANCE_CREATE_INFO const VK_ALLOC_CALLBACKS* pAllocCb; uint32_t extensionCount; const char*const* ppEnabledExtensionNames; // layer or extension name to be enabled -} VK_INSTANCE_CREATE_INFO; +} VkInstanceCreateInfo; -// can be added to VK_DEVICE_CREATE_INFO or VK_INSTANCE_CREATE_INFO via pNext -typedef struct _VK_LAYER_CREATE_INFO +// can be added to VkDeviceCreateInfo or VkInstanceCreateInfo via pNext +typedef struct _VkLayerCreateInfo { VK_STRUCTURE_TYPE sType; // Should be VK_STRUCTURE_TYPE_LAYER_CREATE_INFO const void* pNext; // Pointer to next structure uint32_t layerCount; const char *const* ppActiveLayerNames; // layer name from the layer's vkEnumerateLayers()) -} VK_LAYER_CREATE_INFO; +} VkLayerCreateInfo; typedef struct _VK_PHYSICAL_GPU_QUEUE_PROPERTIES { @@ -1448,7 +1448,7 @@ typedef struct _VK_PHYSICAL_GPU_MEMORY_PROPERTIES bool32_t supportsPinning; } VK_PHYSICAL_GPU_MEMORY_PROPERTIES; -typedef struct _VK_MEMORY_ALLOC_INFO +typedef struct _VkMemoryAllocInfo { VK_STRUCTURE_TYPE sType; // Must be VK_STRUCTURE_TYPE_MEMORY_ALLOC_INFO const void* pNext; // Pointer to next structure @@ -1456,27 +1456,27 @@ typedef struct _VK_MEMORY_ALLOC_INFO VK_FLAGS memProps; // VK_MEMORY_PROPERTY_FLAGS VK_MEMORY_TYPE memType; VK_MEMORY_PRIORITY memPriority; -} VK_MEMORY_ALLOC_INFO; +} VkMemoryAllocInfo; -// This structure is included in the VK_MEMORY_ALLOC_INFO chain +// This structure is included in the VkMemoryAllocInfo chain // for memory regions allocated for buffer usage. -typedef struct _VK_MEMORY_ALLOC_BUFFER_INFO +typedef struct _VkMemoryAllocBufferInfo { VK_STRUCTURE_TYPE sType; // Must be VK_STRUCTURE_TYPE_MEMORY_ALLOC_BUFFER_INFO const void* pNext; // Pointer to next structure VK_FLAGS usage; // VK_BUFFER_USAGE_FLAGS -} VK_MEMORY_ALLOC_BUFFER_INFO; +} VkMemoryAllocBufferInfo; -// This structure is included in the VK_MEMORY_ALLOC_INFO chain +// This structure is included in the VkMemoryAllocInfo chain // for memory regions allocated for image usage. -typedef struct _VK_MEMORY_ALLOC_IMAGE_INFO +typedef struct _VkMemoryAllocImageInfo { VK_STRUCTURE_TYPE sType; // Must be VK_STRUCTURE_TYPE_MEMORY_ALLOC_IMAGE_INFO const void* pNext; // Pointer to next structure VK_FLAGS usage; // VK_IMAGE_USAGE_FLAGS VK_IMAGE_FORMAT_CLASS formatClass; uint32_t samples; -} VK_MEMORY_ALLOC_IMAGE_INFO; +} VkMemoryAllocImageInfo; typedef struct _VK_MEMORY_OPEN_INFO { @@ -1593,16 +1593,16 @@ typedef struct _VK_UPDATE_AS_COPY uint32_t count; } VK_UPDATE_AS_COPY; -typedef struct _VK_BUFFER_CREATE_INFO +typedef struct _VkBufferCreateInfo { VK_STRUCTURE_TYPE sType; // Must be VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO const void* pNext; // Pointer to next structure. VK_GPU_SIZE size; // Specified in bytes VK_FLAGS usage; // VK_BUFFER_USAGE_FLAGS VK_FLAGS flags; // VK_BUFFER_CREATE_FLAGS -} VK_BUFFER_CREATE_INFO; +} VkBufferCreateInfo; -typedef struct _VK_BUFFER_VIEW_CREATE_INFO +typedef struct _VkBufferViewCreateInfo { VK_STRUCTURE_TYPE sType; // Must be VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO const void* pNext; // Pointer to next structure. @@ -1611,7 +1611,7 @@ typedef struct _VK_BUFFER_VIEW_CREATE_INFO VK_FORMAT format; // Optionally specifies format of elements VK_GPU_SIZE offset; // Specified in bytes VK_GPU_SIZE range; // View size specified in bytes -} VK_BUFFER_VIEW_CREATE_INFO; +} VkBufferViewCreateInfo; typedef struct _VK_IMAGE_SUBRESOURCE { @@ -2266,12 +2266,12 @@ typedef struct _VK_DISPATCH_INDIRECT_CMD // ------------------------------------------------------------------------------------------------ // API functions -typedef VK_RESULT (VKAPI *vkCreateInstanceType)(const VK_INSTANCE_CREATE_INFO* pCreateInfo, VK_INSTANCE* pInstance); +typedef VK_RESULT (VKAPI *vkCreateInstanceType)(const VkInstanceCreateInfo* pCreateInfo, VK_INSTANCE* pInstance); typedef VK_RESULT (VKAPI *vkDestroyInstanceType)(VK_INSTANCE instance); typedef VK_RESULT (VKAPI *vkEnumerateGpusType)(VK_INSTANCE instance, uint32_t maxGpus, uint32_t* pGpuCount, VK_PHYSICAL_GPU* pGpus); typedef VK_RESULT (VKAPI *vkGetGpuInfoType)(VK_PHYSICAL_GPU gpu, VK_PHYSICAL_GPU_INFO_TYPE infoType, size_t* pDataSize, void* pData); typedef void * (VKAPI *vkGetProcAddrType)(VK_PHYSICAL_GPU gpu, const char * pName); -typedef VK_RESULT (VKAPI *vkCreateDeviceType)(VK_PHYSICAL_GPU gpu, const VK_DEVICE_CREATE_INFO* pCreateInfo, VK_DEVICE* pDevice); +typedef VK_RESULT (VKAPI *vkCreateDeviceType)(VK_PHYSICAL_GPU gpu, const VkDeviceCreateInfo* pCreateInfo, VK_DEVICE* pDevice); typedef VK_RESULT (VKAPI *vkDestroyDeviceType)(VK_DEVICE device); typedef VK_RESULT (VKAPI *vkGetExtensionSupportType)(VK_PHYSICAL_GPU gpu, const char* pExtName); typedef VK_RESULT (VKAPI *vkEnumerateLayersType)(VK_PHYSICAL_GPU gpu, size_t maxLayerCount, size_t maxStringSize, size_t* pOutLayerCount, char* const* pOutLayers, void* pReserved); @@ -2281,7 +2281,7 @@ typedef VK_RESULT (VKAPI *vkQueueAddMemReferenceType)(VK_QUEUE queue, VK_GPU_MEM typedef VK_RESULT (VKAPI *vkQueueRemoveMemReferenceType)(VK_QUEUE queue, VK_GPU_MEMORY mem); typedef VK_RESULT (VKAPI *vkQueueWaitIdleType)(VK_QUEUE queue); typedef VK_RESULT (VKAPI *vkDeviceWaitIdleType)(VK_DEVICE device); -typedef VK_RESULT (VKAPI *vkAllocMemoryType)(VK_DEVICE device, const VK_MEMORY_ALLOC_INFO* pAllocInfo, VK_GPU_MEMORY* pMem); +typedef VK_RESULT (VKAPI *vkAllocMemoryType)(VK_DEVICE device, const VkMemoryAllocInfo* pAllocInfo, VK_GPU_MEMORY* pMem); typedef VK_RESULT (VKAPI *vkFreeMemoryType)(VK_GPU_MEMORY mem); typedef VK_RESULT (VKAPI *vkSetMemoryPriorityType)(VK_GPU_MEMORY mem, VK_MEMORY_PRIORITY priority); typedef VK_RESULT (VKAPI *vkMapMemoryType)(VK_GPU_MEMORY mem, VK_FLAGS flags, void** ppData); @@ -2311,8 +2311,8 @@ typedef VK_RESULT (VKAPI *vkResetEventType)(VK_EVENT event); typedef VK_RESULT (VKAPI *vkCreateQueryPoolType)(VK_DEVICE device, const VK_QUERY_POOL_CREATE_INFO* pCreateInfo, VK_QUERY_POOL* pQueryPool); typedef VK_RESULT (VKAPI *vkGetQueryPoolResultsType)(VK_QUERY_POOL queryPool, uint32_t startQuery, uint32_t queryCount, size_t* pDataSize, void* pData); typedef VK_RESULT (VKAPI *vkGetFormatInfoType)(VK_DEVICE device, VK_FORMAT format, VK_FORMAT_INFO_TYPE infoType, size_t* pDataSize, void* pData); -typedef VK_RESULT (VKAPI *vkCreateBufferType)(VK_DEVICE device, const VK_BUFFER_CREATE_INFO* pCreateInfo, VK_BUFFER* pBuffer); -typedef VK_RESULT (VKAPI *vkCreateBufferViewType)(VK_DEVICE device, const VK_BUFFER_VIEW_CREATE_INFO* pCreateInfo, VK_BUFFER_VIEW* pView); +typedef VK_RESULT (VKAPI *vkCreateBufferType)(VK_DEVICE device, const VkBufferCreateInfo* pCreateInfo, VK_BUFFER* pBuffer); +typedef VK_RESULT (VKAPI *vkCreateBufferViewType)(VK_DEVICE device, const VkBufferViewCreateInfo* pCreateInfo, VK_BUFFER_VIEW* pView); typedef VK_RESULT (VKAPI *vkCreateImageType)(VK_DEVICE device, const VK_IMAGE_CREATE_INFO* pCreateInfo, VK_IMAGE* pImage); typedef VK_RESULT (VKAPI *vkGetImageSubresourceInfoType)(VK_IMAGE image, const VK_IMAGE_SUBRESOURCE* pSubresource, VK_SUBRESOURCE_INFO_TYPE infoType, size_t* pDataSize, void* pData); typedef VK_RESULT (VKAPI *vkCreateImageViewType)(VK_DEVICE device, const VK_IMAGE_VIEW_CREATE_INFO* pCreateInfo, VK_IMAGE_VIEW* pView); @@ -2386,7 +2386,7 @@ typedef void (VKAPI *vkCmdEndRenderPassType)(VK_CMD_BUFFER cmdBuffer, VK_RE // GPU initialization VK_RESULT VKAPI vkCreateInstance( - const VK_INSTANCE_CREATE_INFO* pCreateInfo, + const VkInstanceCreateInfo* pCreateInfo, VK_INSTANCE* pInstance); VK_RESULT VKAPI vkDestroyInstance( @@ -2412,7 +2412,7 @@ void * VKAPI vkGetProcAddr( VK_RESULT VKAPI vkCreateDevice( VK_PHYSICAL_GPU gpu, - const VK_DEVICE_CREATE_INFO* pCreateInfo, + const VkDeviceCreateInfo* pCreateInfo, VK_DEVICE* pDevice); VK_RESULT VKAPI vkDestroyDevice( @@ -2466,7 +2466,7 @@ VK_RESULT VKAPI vkDeviceWaitIdle( VK_RESULT VKAPI vkAllocMemory( VK_DEVICE device, - const VK_MEMORY_ALLOC_INFO* pAllocInfo, + const VkMemoryAllocInfo* pAllocInfo, VK_GPU_MEMORY* pMem); VK_RESULT VKAPI vkFreeMemory( @@ -2630,14 +2630,14 @@ VK_RESULT VKAPI vkGetFormatInfo( VK_RESULT VKAPI vkCreateBuffer( VK_DEVICE device, - const VK_BUFFER_CREATE_INFO* pCreateInfo, + const VkBufferCreateInfo* pCreateInfo, VK_BUFFER* pBuffer); // Buffer view functions VK_RESULT VKAPI vkCreateBufferView( VK_DEVICE device, - const VK_BUFFER_VIEW_CREATE_INFO* pCreateInfo, + const VkBufferViewCreateInfo* pCreateInfo, VK_BUFFER_VIEW* pView); // Image functions diff --git a/layers/basic.cpp b/layers/basic.cpp index dbbb4911..402adb68 100644 --- a/layers/basic.cpp +++ b/layers/basic.cpp @@ -86,7 +86,7 @@ VK_LAYER_EXPORT VK_RESULT VKAPI vkGetExtensionSupport(VK_PHYSICAL_GPU gpu, const return result; } -VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateDevice(VK_PHYSICAL_GPU gpu, const VK_DEVICE_CREATE_INFO* pCreateInfo, VK_DEVICE* pDevice) +VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateDevice(VK_PHYSICAL_GPU gpu, const VkDeviceCreateInfo* pCreateInfo, VK_DEVICE* pDevice) { VK_BASE_LAYER_OBJECT* gpuw = (VK_BASE_LAYER_OBJECT *) gpu; VK_LAYER_DISPATCH_TABLE* pTable = tableMap[gpuw]; diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp index 6806882e..5e4a95fe 100644 --- a/layers/draw_state.cpp +++ b/layers/draw_state.cpp @@ -262,7 +262,7 @@ static void deleteImages() delete (*ii).second; } } -static VK_BUFFER_VIEW_CREATE_INFO* getBufferViewCreateInfo(VK_BUFFER_VIEW view) +static VkBufferViewCreateInfo* getBufferViewCreateInfo(VK_BUFFER_VIEW view) { loader_platform_thread_lock_mutex(&globalLock); if (bufferMap.find(view) == bufferMap.end()) { @@ -1111,7 +1111,7 @@ static void dsCoreDumpDot(const VK_DESCRIPTOR_SET ds, FILE* pOutFile) VK_UPDATE_AS_COPY* pUAC = NULL; VK_SAMPLER_CREATE_INFO* pSCI = NULL; VK_IMAGE_VIEW_CREATE_INFO* pIVCI = NULL; - VK_BUFFER_VIEW_CREATE_INFO* pBVCI = NULL; + VkBufferViewCreateInfo* pBVCI = NULL; void** ppNextPtr = NULL; void* pSaveNext = NULL; for (i=0; i < pSet->descriptorCount; i++) { @@ -1156,7 +1156,7 @@ static void dsCoreDumpDot(const VK_DESCRIPTOR_SET ds, FILE* pOutFile) pBVCI = getBufferViewCreateInfo(pUB->pBufferViews[i-pUB->arrayIndex].view); if (pBVCI) { sprintf(tmp_str, "BUFFER_VIEW%u", i); - fprintf(pOutFile, "%s", vk_gv_print_vk_buffer_view_create_info(pBVCI, tmp_str)); + fprintf(pOutFile, "%s", vk_gv_print_vkbufferviewcreateinfo(pBVCI, tmp_str)); fprintf(pOutFile, "\"DESCRIPTORS\":slot%u -> \"%s\" [color=\"#%s\"];\n", i, tmp_str, edgeColors[colorIdx].c_str()); } break; @@ -1441,7 +1441,7 @@ static void initDrawState(void) } } -VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateDevice(VK_PHYSICAL_GPU gpu, const VK_DEVICE_CREATE_INFO* pCreateInfo, VK_DEVICE* pDevice) +VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateDevice(VK_PHYSICAL_GPU gpu, const VkDeviceCreateInfo* pCreateInfo, VK_DEVICE* pDevice) { VK_BASE_LAYER_OBJECT* gpuw = (VK_BASE_LAYER_OBJECT *) gpu; pCurObj = gpuw; @@ -1522,7 +1522,7 @@ VK_LAYER_EXPORT VK_RESULT VKAPI vkDestroyObject(VK_OBJECT object) return result; } -VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateBufferView(VK_DEVICE device, const VK_BUFFER_VIEW_CREATE_INFO* pCreateInfo, VK_BUFFER_VIEW* pView) +VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateBufferView(VK_DEVICE device, const VkBufferViewCreateInfo* pCreateInfo, VK_BUFFER_VIEW* pView) { VK_RESULT result = nextTable.CreateBufferView(device, pCreateInfo, pView); if (VK_SUCCESS == result) { diff --git a/layers/draw_state.h b/layers/draw_state.h index 0bf33c4b..426bf38a 100644 --- a/layers/draw_state.h +++ b/layers/draw_state.h @@ -116,7 +116,7 @@ typedef struct _IMAGE_NODE { typedef struct _BUFFER_NODE { VK_BUFFER_VIEW buffer; - VK_BUFFER_VIEW_CREATE_INFO createInfo; + VkBufferViewCreateInfo createInfo; VK_BUFFER_VIEW_ATTACH_INFO attachInfo; } BUFFER_NODE; diff --git a/layers/glave_snapshot.c b/layers/glave_snapshot.c index 12caf3c6..7b1c4ad6 100644 --- a/layers/glave_snapshot.c +++ b/layers/glave_snapshot.c @@ -62,15 +62,15 @@ void glv_vk_malloc_and_copy(void** ppDest, size_t size, const void* pSrc) memcpy(*ppDest, pSrc, size); } -VK_DEVICE_CREATE_INFO* glv_deepcopy_VK_DEVICE_CREATE_INFO(const VK_DEVICE_CREATE_INFO* pSrcCreateInfo) +VkDeviceCreateInfo* glv_deepcopy_VkDeviceCreateInfo(const VkDeviceCreateInfo* pSrcCreateInfo) { - VK_DEVICE_CREATE_INFO* pDestCreateInfo; + VkDeviceCreateInfo* pDestCreateInfo; - // NOTE: partially duplicated code from add_VK_DEVICE_CREATE_INFO_to_packet(...) + // NOTE: partially duplicated code from add_VkDeviceCreateInfo_to_packet(...) { uint32_t i; - glv_vk_malloc_and_copy((void**)&pDestCreateInfo, sizeof(VK_DEVICE_CREATE_INFO), pSrcCreateInfo); - glv_vk_malloc_and_copy((void**)&pDestCreateInfo->pRequestedQueues, pSrcCreateInfo->queueRecordCount*sizeof(VK_DEVICE_QUEUE_CREATE_INFO), pSrcCreateInfo->pRequestedQueues); + glv_vk_malloc_and_copy((void**)&pDestCreateInfo, sizeof(VkDeviceCreateInfo), pSrcCreateInfo); + glv_vk_malloc_and_copy((void**)&pDestCreateInfo->pRequestedQueues, pSrcCreateInfo->queueRecordCount*sizeof(VkDeviceQueueCreateInfo), pSrcCreateInfo->pRequestedQueues); if (pSrcCreateInfo->extensionCount > 0) { @@ -80,29 +80,29 @@ VK_DEVICE_CREATE_INFO* glv_deepcopy_VK_DEVICE_CREATE_INFO(const VK_DEVICE_CREATE glv_vk_malloc_and_copy((void**)&pDestCreateInfo->ppEnabledExtensionNames[i], strlen(pSrcCreateInfo->ppEnabledExtensionNames[i]) + 1, pSrcCreateInfo->ppEnabledExtensionNames[i]); } } - VK_LAYER_CREATE_INFO *pSrcNext = ( VK_LAYER_CREATE_INFO *) pSrcCreateInfo->pNext; - VK_LAYER_CREATE_INFO **ppDstNext = ( VK_LAYER_CREATE_INFO **) &pDestCreateInfo->pNext; + VkLayerCreateInfo *pSrcNext = ( VkLayerCreateInfo *) pSrcCreateInfo->pNext; + VkLayerCreateInfo **ppDstNext = ( VkLayerCreateInfo **) &pDestCreateInfo->pNext; while (pSrcNext != NULL) { if ((pSrcNext->sType == VK_STRUCTURE_TYPE_LAYER_CREATE_INFO) && pSrcNext->layerCount > 0) { - glv_vk_malloc_and_copy((void**)ppDstNext, sizeof(VK_LAYER_CREATE_INFO), pSrcNext); + glv_vk_malloc_and_copy((void**)ppDstNext, sizeof(VkLayerCreateInfo), pSrcNext); glv_vk_malloc_and_copy((void**)&(*ppDstNext)->ppActiveLayerNames, pSrcNext->layerCount * sizeof(char*), pSrcNext->ppActiveLayerNames); for (i = 0; i < pSrcNext->layerCount; i++) { glv_vk_malloc_and_copy((void**)&(*ppDstNext)->ppActiveLayerNames[i], strlen(pSrcNext->ppActiveLayerNames[i]) + 1, pSrcNext->ppActiveLayerNames[i]); } - ppDstNext = (VK_LAYER_CREATE_INFO**) &(*ppDstNext)->pNext; + ppDstNext = (VkLayerCreateInfo**) &(*ppDstNext)->pNext; } - pSrcNext = (VK_LAYER_CREATE_INFO*) pSrcNext->pNext; + pSrcNext = (VkLayerCreateInfo*) pSrcNext->pNext; } } return pDestCreateInfo; } -void glv_deepfree_VK_DEVICE_CREATE_INFO(VK_DEVICE_CREATE_INFO* pCreateInfo) +void glv_deepfree_VkDeviceCreateInfo(VkDeviceCreateInfo* pCreateInfo) { uint32_t i; if (pCreateInfo->pRequestedQueues != NULL) @@ -119,10 +119,10 @@ void glv_deepfree_VK_DEVICE_CREATE_INFO(VK_DEVICE_CREATE_INFO* pCreateInfo) free((void*)pCreateInfo->ppEnabledExtensionNames); } - VK_LAYER_CREATE_INFO *pSrcNext = (VK_LAYER_CREATE_INFO*)pCreateInfo->pNext; + VkLayerCreateInfo *pSrcNext = (VkLayerCreateInfo*)pCreateInfo->pNext; while (pSrcNext != NULL) { - VK_LAYER_CREATE_INFO* pTmp = (VK_LAYER_CREATE_INFO*)pSrcNext->pNext; + VkLayerCreateInfo* pTmp = (VkLayerCreateInfo*)pSrcNext->pNext; if ((pSrcNext->sType == VK_STRUCTURE_TYPE_LAYER_CREATE_INFO) && pSrcNext->layerCount > 0) { for (i = 0; i < pSrcNext->layerCount; i++) @@ -139,11 +139,11 @@ void glv_deepfree_VK_DEVICE_CREATE_INFO(VK_DEVICE_CREATE_INFO* pCreateInfo) free(pCreateInfo); } -void glv_vk_snapshot_copy_createdevice_params(GLV_VK_SNAPSHOT_CREATEDEVICE_PARAMS* pDest, VK_PHYSICAL_GPU gpu, const VK_DEVICE_CREATE_INFO* pCreateInfo, VK_DEVICE* pDevice) +void glv_vk_snapshot_copy_createdevice_params(GLV_VK_SNAPSHOT_CREATEDEVICE_PARAMS* pDest, VK_PHYSICAL_GPU gpu, const VkDeviceCreateInfo* pCreateInfo, VK_DEVICE* pDevice) { pDest->gpu = gpu; - pDest->pCreateInfo = glv_deepcopy_VK_DEVICE_CREATE_INFO(pCreateInfo); + pDest->pCreateInfo = glv_deepcopy_VkDeviceCreateInfo(pCreateInfo); pDest->pDevice = (VK_DEVICE*)malloc(sizeof(VK_DEVICE)); *pDest->pDevice = *pDevice; @@ -153,7 +153,7 @@ void glv_vk_snapshot_destroy_createdevice_params(GLV_VK_SNAPSHOT_CREATEDEVICE_PA { memset(&pSrc->gpu, 0, sizeof(VK_PHYSICAL_GPU)); - glv_deepfree_VK_DEVICE_CREATE_INFO(pSrc->pCreateInfo); + glv_deepfree_VkDeviceCreateInfo(pSrc->pCreateInfo); pSrc->pCreateInfo = NULL; free(pSrc->pDevice); @@ -267,7 +267,7 @@ static void snapshot_insert_deleted_object(GLV_VK_SNAPSHOT* pSnapshot, void* pOb } // Note: the parameters after pSnapshot match the order of vkCreateDevice(..) -static void snapshot_insert_device(GLV_VK_SNAPSHOT* pSnapshot, VK_PHYSICAL_GPU gpu, const VK_DEVICE_CREATE_INFO* pCreateInfo, VK_DEVICE* pDevice) +static void snapshot_insert_device(GLV_VK_SNAPSHOT* pSnapshot, VK_PHYSICAL_GPU gpu, const VkDeviceCreateInfo* pCreateInfo, VK_DEVICE* pDevice) { GLV_VK_SNAPSHOT_LL_NODE* pNode = snapshot_insert_object(pSnapshot, *pDevice, VK_OBJECT_TYPE_DEVICE); pNode->obj.pStruct = malloc(sizeof(GLV_VK_SNAPSHOT_DEVICE_NODE)); @@ -463,7 +463,7 @@ static void initGlaveSnapshot(void) //============================================================================= // vulkan entrypoints //============================================================================= -VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateInstance(const VK_INSTANCE_CREATE_INFO* pCreateInfo, VK_INSTANCE* pInstance) +VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateInstance(const VkInstanceCreateInfo* pCreateInfo, VK_INSTANCE* pInstance) { VK_RESULT result = nextTable.CreateInstance(pCreateInfo, pInstance); loader_platform_thread_lock_mutex(&objLock); @@ -499,7 +499,7 @@ VK_LAYER_EXPORT VK_RESULT VKAPI vkGetGpuInfo(VK_PHYSICAL_GPU gpu, VK_PHYSICAL_GP return result; } -VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateDevice(VK_PHYSICAL_GPU gpu, const VK_DEVICE_CREATE_INFO* pCreateInfo, VK_DEVICE* pDevice) +VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateDevice(VK_PHYSICAL_GPU gpu, const VkDeviceCreateInfo* pCreateInfo, VK_DEVICE* pDevice) { VK_BASE_LAYER_OBJECT* gpuw = (VK_BASE_LAYER_OBJECT *) gpu; pCurObj = gpuw; @@ -605,7 +605,7 @@ VK_LAYER_EXPORT VK_RESULT VKAPI vkDeviceWaitIdle(VK_DEVICE device) return result; } -VK_LAYER_EXPORT VK_RESULT VKAPI vkAllocMemory(VK_DEVICE device, const VK_MEMORY_ALLOC_INFO* pAllocInfo, VK_GPU_MEMORY* pMem) +VK_LAYER_EXPORT VK_RESULT VKAPI vkAllocMemory(VK_DEVICE device, const VkMemoryAllocInfo * pAllocInfo, VK_GPU_MEMORY* pMem) { loader_platform_thread_lock_mutex(&objLock); ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); @@ -901,7 +901,7 @@ VK_LAYER_EXPORT VK_RESULT VKAPI vkGetFormatInfo(VK_DEVICE device, VK_FORMAT form return result; } -VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateBuffer(VK_DEVICE device, const VK_BUFFER_CREATE_INFO* pCreateInfo, VK_BUFFER* pBuffer) +VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateBuffer(VK_DEVICE device, const VkBufferCreateInfo* pCreateInfo, VK_BUFFER* pBuffer) { loader_platform_thread_lock_mutex(&objLock); ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); @@ -917,7 +917,7 @@ VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateBuffer(VK_DEVICE device, const VK_BUFFER return result; } -VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateBufferView(VK_DEVICE device, const VK_BUFFER_VIEW_CREATE_INFO* pCreateInfo, VK_BUFFER_VIEW* pView) +VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateBufferView(VK_DEVICE device, const VkBufferViewCreateInfo* pCreateInfo, VK_BUFFER_VIEW* pView) { loader_platform_thread_lock_mutex(&objLock); ll_increment_use_count((void*)device, VK_OBJECT_TYPE_DEVICE); @@ -1809,7 +1809,7 @@ void glvSnapshotPrintDelta() while (pDeviceNode != NULL) { GLV_VK_SNAPSHOT_DEVICE_NODE* pDev = (GLV_VK_SNAPSHOT_DEVICE_NODE*)pDeviceNode->obj.pStruct; - char * createInfoStr = vk_print_vk_device_create_info(pDev->params.pCreateInfo, "\t\t"); + char * createInfoStr = vk_print_vkdevicecreateinfo(pDev->params.pCreateInfo, "\t\t"); sprintf(str, "\t%s obj %p:\n%s", string_VK_OBJECT_TYPE(VK_OBJECT_TYPE_DEVICE), pDeviceNode->obj.pVkObject, createInfoStr); layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, pDeviceNode->obj.pVkObject, 0, GLVSNAPSHOT_SNAPSHOT_DATA, LAYER_ABBREV_STR, str); pDeviceNode = pDeviceNode->pNextObj; diff --git a/layers/glave_snapshot.h b/layers/glave_snapshot.h index 999736d5..f22915cc 100644 --- a/layers/glave_snapshot.h +++ b/layers/glave_snapshot.h @@ -174,12 +174,12 @@ void glv_vk_malloc_and_copy(void** ppDest, size_t size, const void* pSrc); typedef struct _GLV_VK_SNAPSHOT_CREATEDEVICE_PARAMS { VK_PHYSICAL_GPU gpu; - VK_DEVICE_CREATE_INFO* pCreateInfo; + VkDeviceCreateInfo* pCreateInfo; VK_DEVICE* pDevice; } GLV_VK_SNAPSHOT_CREATEDEVICE_PARAMS; -VK_DEVICE_CREATE_INFO* glv_deepcopy_xgl_device_create_info(const VK_DEVICE_CREATE_INFO* pSrcCreateInfo);void glv_deepfree_xgl_device_create_info(VK_DEVICE_CREATE_INFO* pCreateInfo); -void glv_vk_snapshot_copy_createdevice_params(GLV_VK_SNAPSHOT_CREATEDEVICE_PARAMS* pDest, VK_PHYSICAL_GPU gpu, const VK_DEVICE_CREATE_INFO* pCreateInfo, VK_DEVICE* pDevice); +VkDeviceCreateInfo* glv_deepcopy_xgl_device_create_info(const VkDeviceCreateInfo* pSrcCreateInfo);void glv_deepfree_xgl_device_create_info(VkDeviceCreateInfo* pCreateInfo); +void glv_vk_snapshot_copy_createdevice_params(GLV_VK_SNAPSHOT_CREATEDEVICE_PARAMS* pDest, VK_PHYSICAL_GPU gpu, const VkDeviceCreateInfo* pCreateInfo, VK_DEVICE* pDevice); void glv_vk_snapshot_destroy_createdevice_params(GLV_VK_SNAPSHOT_CREATEDEVICE_PARAMS* pSrc); //============================================================================= diff --git a/layers/mem_tracker.cpp b/layers/mem_tracker.cpp index 71b8a5aa..c05e07e2 100644 --- a/layers/mem_tracker.cpp +++ b/layers/mem_tracker.cpp @@ -345,14 +345,14 @@ static MT_MEM_OBJ_INFO* getMemObjInfo(const VK_GPU_MEMORY mem) return pMemObjInfo; } -static void addMemObjInfo(const VK_GPU_MEMORY mem, const VK_MEMORY_ALLOC_INFO* pAllocInfo) +static void addMemObjInfo(const VK_GPU_MEMORY mem, const VkMemoryAllocInfo* pAllocInfo) { MT_MEM_OBJ_INFO* pInfo = new MT_MEM_OBJ_INFO; pInfo->refCount = 0; - memset(&pInfo->allocInfo, 0, sizeof(VK_MEMORY_ALLOC_INFO)); + memset(&pInfo->allocInfo, 0, sizeof(VkMemoryAllocInfo)); if (pAllocInfo) { // MEM alloc created by vkWsiX11CreatePresentableImage() doesn't have alloc info struct - memcpy(&pInfo->allocInfo, pAllocInfo, sizeof(VK_MEMORY_ALLOC_INFO)); + memcpy(&pInfo->allocInfo, pAllocInfo, sizeof(VkMemoryAllocInfo)); // TODO: Update for real hardware, actually process allocation info structures pInfo->allocInfo.pNext = NULL; } @@ -734,7 +734,7 @@ static void printMemList() sprintf(str, " Ref Count: %u", pInfo->refCount); layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, MEMTRACK_NONE, "MEM", str); if (0 != pInfo->allocInfo.allocationSize) { - string pAllocInfoMsg = vk_print_vk_memory_alloc_info(&pInfo->allocInfo, "{MEM}INFO : "); + string pAllocInfoMsg = vk_print_vkmemoryallocinfo(&pInfo->allocInfo, "{MEM}INFO : "); sprintf(str, " Mem Alloc info:\n%s", pAllocInfoMsg.c_str()); layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, MEMTRACK_NONE, "MEM", str); } else { @@ -821,7 +821,7 @@ static void initMemTracker(void) } } -VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateDevice(VK_PHYSICAL_GPU gpu, const VK_DEVICE_CREATE_INFO* pCreateInfo, VK_DEVICE* pDevice) +VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateDevice(VK_PHYSICAL_GPU gpu, const VkDeviceCreateInfo* pCreateInfo, VK_DEVICE* pDevice) { VK_BASE_LAYER_OBJECT* gpuw = (VK_BASE_LAYER_OBJECT *) gpu; pCurObj = gpuw; @@ -999,7 +999,7 @@ VK_LAYER_EXPORT VK_RESULT VKAPI vkQueueSubmit( return result; } -VK_LAYER_EXPORT VK_RESULT VKAPI vkAllocMemory(VK_DEVICE device, const VK_MEMORY_ALLOC_INFO* pAllocInfo, VK_GPU_MEMORY* pMem) +VK_LAYER_EXPORT VK_RESULT VKAPI vkAllocMemory(VK_DEVICE device, const VkMemoryAllocInfo* pAllocInfo, VK_GPU_MEMORY* pMem) { VK_RESULT result = nextTable.AllocMemory(device, pAllocInfo, pMem); // TODO : Track allocations and overall size here @@ -1262,23 +1262,23 @@ VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateQueryPool(VK_DEVICE device, const VK_QUE return result; } -VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateBuffer(VK_DEVICE device, const VK_BUFFER_CREATE_INFO* pCreateInfo, VK_BUFFER* pBuffer) +VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateBuffer(VK_DEVICE device, const VkBufferCreateInfo* pCreateInfo, VK_BUFFER* pBuffer) { VK_RESULT result = nextTable.CreateBuffer(device, pCreateInfo, pBuffer); if (VK_SUCCESS == result) { loader_platform_thread_lock_mutex(&globalLock); - addObjectInfo(*pBuffer, pCreateInfo->sType, pCreateInfo, sizeof(VK_BUFFER_CREATE_INFO), "buffer"); + addObjectInfo(*pBuffer, pCreateInfo->sType, pCreateInfo, sizeof(VkBufferCreateInfo), "buffer"); loader_platform_thread_unlock_mutex(&globalLock); } return result; } -VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateBufferView(VK_DEVICE device, const VK_BUFFER_VIEW_CREATE_INFO* pCreateInfo, VK_BUFFER_VIEW* pView) +VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateBufferView(VK_DEVICE device, const VkBufferViewCreateInfo* pCreateInfo, VK_BUFFER_VIEW* pView) { VK_RESULT result = nextTable.CreateBufferView(device, pCreateInfo, pView); if (result == VK_SUCCESS) { loader_platform_thread_lock_mutex(&globalLock); - addObjectInfo(*pView, pCreateInfo->sType, pCreateInfo, sizeof(VK_BUFFER_VIEW_CREATE_INFO), "buffer_view"); + addObjectInfo(*pView, pCreateInfo->sType, pCreateInfo, sizeof(VkBufferViewCreateInfo), "buffer_view"); loader_platform_thread_unlock_mutex(&globalLock); } return result; diff --git a/layers/mem_tracker.h b/layers/mem_tracker.h index bb121329..d3a8608f 100644 --- a/layers/mem_tracker.h +++ b/layers/mem_tracker.h @@ -86,7 +86,7 @@ typedef enum _MEM_TRACK_ERROR struct MT_MEM_OBJ_INFO { uint32_t refCount; // Count of references (obj bindings or CB use) VK_GPU_MEMORY mem; - VK_MEMORY_ALLOC_INFO allocInfo; + VkMemoryAllocInfo allocInfo; list pObjBindings; // list container of objects bound to this memory list pCmdBufferBindings; // list container of cmd buffers that reference this mem object }; diff --git a/layers/multi.cpp b/layers/multi.cpp index a4856eb0..3f967d6a 100644 --- a/layers/multi.cpp +++ b/layers/multi.cpp @@ -62,7 +62,7 @@ extern "C" { #endif -VK_LAYER_EXPORT VK_RESULT VKAPI multi1CreateDevice(VK_PHYSICAL_GPU gpu, const VK_DEVICE_CREATE_INFO* pCreateInfo, +VK_LAYER_EXPORT VK_RESULT VKAPI multi1CreateDevice(VK_PHYSICAL_GPU gpu, const VkDeviceCreateInfo* pCreateInfo, VK_DEVICE* pDevice) { VK_BASE_LAYER_OBJECT* gpuw = (VK_BASE_LAYER_OBJECT *) gpu; @@ -163,7 +163,7 @@ static VK_LAYER_DISPATCH_TABLE * getLayer2Table(const VK_BASE_LAYER_OBJECT *gpuw } } -VK_LAYER_EXPORT VK_RESULT VKAPI multi2CreateDevice(VK_PHYSICAL_GPU gpu, const VK_DEVICE_CREATE_INFO* pCreateInfo, +VK_LAYER_EXPORT VK_RESULT VKAPI multi2CreateDevice(VK_PHYSICAL_GPU gpu, const VkDeviceCreateInfo* pCreateInfo, VK_DEVICE* pDevice) { VK_BASE_LAYER_OBJECT* gpuw = (VK_BASE_LAYER_OBJECT *) gpu; diff --git a/layers/param_checker.cpp b/layers/param_checker.cpp index fb1189ec..9be48ade 100644 --- a/layers/param_checker.cpp +++ b/layers/param_checker.cpp @@ -124,7 +124,7 @@ void PostCreateInstance(VK_RESULT result, VK_INSTANCE* pInstance) } } -VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateInstance(const VK_INSTANCE_CREATE_INFO* pCreateInfo, VK_INSTANCE* pInstance) +VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateInstance(const VkInstanceCreateInfo* pCreateInfo, VK_INSTANCE* pInstance) { PreCreateInstance(pCreateInfo->pAppInfo, pCreateInfo->pAllocCb); VK_RESULT result = nextTable.CreateInstance(pCreateInfo, pInstance); @@ -160,7 +160,7 @@ VK_LAYER_EXPORT VK_RESULT VKAPI vkGetGpuInfo(VK_PHYSICAL_GPU gpu, VK_PHYSICAL_GP return result; } -void PreCreateDevice(VK_PHYSICAL_GPU gpu, const VK_DEVICE_CREATE_INFO* pCreateInfo) +void PreCreateDevice(VK_PHYSICAL_GPU gpu, const VkDeviceCreateInfo* pCreateInfo) { if(gpu == nullptr) { @@ -172,7 +172,7 @@ void PreCreateDevice(VK_PHYSICAL_GPU gpu, const VK_DEVICE_CREATE_INFO* pCreateIn if(pCreateInfo == nullptr) { - char const str[] = "vkCreateDevice parameter, VK_DEVICE_CREATE_INFO* pCreateInfo, is "\ + char const str[] = "vkCreateDevice parameter, VkDeviceCreateInfo* pCreateInfo, is "\ "nullptr (precondition)."; layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str); return; @@ -196,7 +196,7 @@ void PreCreateDevice(VK_PHYSICAL_GPU gpu, const VK_DEVICE_CREATE_INFO* pCreateIn if(pCreateInfo->pRequestedQueues == nullptr) { - char const str[] = "vkCreateDevice parameter, VK_DEVICE_QUEUE_CREATE_INFO* pCreateInfo->pRequestedQueues, is "\ + char const str[] = "vkCreateDevice parameter, VkDeviceQueueCreateInfo* pCreateInfo->pRequestedQueues, is "\ "nullptr (precondition)."; layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str); return; @@ -204,10 +204,10 @@ void PreCreateDevice(VK_PHYSICAL_GPU gpu, const VK_DEVICE_CREATE_INFO* pCreateIn for(uint32_t i = 0; i < pCreateInfo->queueRecordCount; ++i) { - if(!vk_validate_vk_device_queue_create_info(&(pCreateInfo->pRequestedQueues[i]))) + if(!vk_validate_vkdevicequeuecreateinfo(&(pCreateInfo->pRequestedQueues[i]))) { std::stringstream ss; - ss << "vkCreateDevice parameter, VK_DEVICE_QUEUE_CREATE_INFO pCreateInfo->pRequestedQueues[" << i << + ss << "vkCreateDevice parameter, VkDeviceQueueCreateInfo pCreateInfo->pRequestedQueues[" << i << "], is invalid (precondition)."; layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", ss.str().c_str()); continue; @@ -241,7 +241,7 @@ void PostCreateDevice(VK_RESULT result, VK_DEVICE* pDevice) } } -VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateDevice(VK_PHYSICAL_GPU gpu, const VK_DEVICE_CREATE_INFO* pCreateInfo, VK_DEVICE* pDevice) +VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateDevice(VK_PHYSICAL_GPU gpu, const VkDeviceCreateInfo* pCreateInfo, VK_DEVICE* pDevice) { VK_BASE_LAYER_OBJECT* gpuw = (VK_BASE_LAYER_OBJECT *) gpu; pCurObj = gpuw; @@ -331,14 +331,13 @@ VK_LAYER_EXPORT VK_RESULT VKAPI vkDeviceWaitIdle(VK_DEVICE device) return result; } -VK_LAYER_EXPORT VK_RESULT VKAPI vkAllocMemory(VK_DEVICE device, const VK_MEMORY_ALLOC_INFO* pAllocInfo, VK_GPU_MEMORY* pMem) +VK_LAYER_EXPORT VK_RESULT VKAPI vkAllocMemory(VK_DEVICE device, const VkMemoryAllocInfo* pAllocInfo, VK_GPU_MEMORY* pMem) { char str[1024]; if (!pAllocInfo) { sprintf(str, "Struct ptr parameter pAllocInfo to function AllocMemory is NULL."); layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str); - } - else if (!vk_validate_vk_memory_alloc_info(pAllocInfo)) { + } else if (!vk_validate_vkmemoryallocinfo(pAllocInfo)) { sprintf(str, "Parameter pAllocInfo to function AllocMemory contains an invalid value."); layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str); } @@ -640,14 +639,14 @@ VK_LAYER_EXPORT VK_RESULT VKAPI vkGetFormatInfo(VK_DEVICE device, VK_FORMAT form return result; } -VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateBuffer(VK_DEVICE device, const VK_BUFFER_CREATE_INFO* pCreateInfo, VK_BUFFER* pBuffer) +VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateBuffer(VK_DEVICE device, const VkBufferCreateInfo* pCreateInfo, VK_BUFFER* pBuffer) { char str[1024]; if (!pCreateInfo) { sprintf(str, "Struct ptr parameter pCreateInfo to function CreateBuffer is NULL."); layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str); } - else if (!vk_validate_vk_buffer_create_info(pCreateInfo)) { + else if (!vk_validate_vkbuffercreateinfo(pCreateInfo)) { sprintf(str, "Parameter pCreateInfo to function CreateBuffer contains an invalid value."); layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str); } @@ -655,14 +654,14 @@ VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateBuffer(VK_DEVICE device, const VK_BUFFER return result; } -VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateBufferView(VK_DEVICE device, const VK_BUFFER_VIEW_CREATE_INFO* pCreateInfo, VK_BUFFER_VIEW* pView) +VK_LAYER_EXPORT VK_RESULT VKAPI vkCreateBufferView(VK_DEVICE device, const VkBufferViewCreateInfo* pCreateInfo, VK_BUFFER_VIEW* pView) { char str[1024]; if (!pCreateInfo) { sprintf(str, "Struct ptr parameter pCreateInfo to function CreateBufferView is NULL."); layerCbMsg(VK_DBG_MSG_UNKNOWN, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str); } - else if (!vk_validate_vk_buffer_view_create_info(pCreateInfo)) { + else if (!vk_validate_vkbufferviewcreateinfo(pCreateInfo)) { sprintf(str, "Parameter pCreateInfo to function CreateBufferView contains an invalid value."); layerCbMsg(VK_DBG_MSG_ERROR, VK_VALIDATION_LEVEL_0, NULL, 0, 1, "PARAMCHECK", str); } diff --git a/loader/loader.c b/loader/loader.c index 60c5f219..377de814 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -714,7 +714,7 @@ static uint32_t loader_get_layer_env(struct loader_icd *icd, uint32_t gpu_index, return count; } -static uint32_t loader_get_layer_libs(struct loader_icd *icd, uint32_t gpu_index, const VK_DEVICE_CREATE_INFO* pCreateInfo, struct layer_name_pair **ppLayerNames) +static uint32_t loader_get_layer_libs(struct loader_icd *icd, uint32_t gpu_index, const VkDeviceCreateInfo* pCreateInfo, struct layer_name_pair **ppLayerNames) { static struct layer_name_pair layerNames[MAX_LAYER_LIBRARIES]; const char *lib_name = NULL; @@ -788,7 +788,7 @@ static void loader_deactivate_layer(const struct loader_instance *instance) } } -extern uint32_t loader_activate_layers(VK_PHYSICAL_GPU gpu, const VK_DEVICE_CREATE_INFO* pCreateInfo) +extern uint32_t loader_activate_layers(VK_PHYSICAL_GPU gpu, const VkDeviceCreateInfo* pCreateInfo) { uint32_t gpu_index; uint32_t count; @@ -858,7 +858,7 @@ extern uint32_t loader_activate_layers(VK_PHYSICAL_GPU gpu, const VK_DEVICE_CREA } LOADER_EXPORT VK_RESULT VKAPI vkCreateInstance( - const VK_INSTANCE_CREATE_INFO* pCreateInfo, + const VkInstanceCreateInfo* pCreateInfo, VK_INSTANCE* pInstance) { static LOADER_PLATFORM_THREAD_ONCE_DECLARATION(once_icd); diff --git a/loader/loader.h b/loader/loader.h index 1817386f..f40a36a3 100644 --- a/loader/loader.h +++ b/loader/loader.h @@ -74,7 +74,7 @@ static inline void *loader_unwrap_gpu(VK_PHYSICAL_GPU *gpu) return loader_get_data(wrap->baseObject); } -extern uint32_t loader_activate_layers(VK_PHYSICAL_GPU gpu, const VK_DEVICE_CREATE_INFO* pCreateInfo); +extern uint32_t loader_activate_layers(VK_PHYSICAL_GPU gpu, const VkDeviceCreateInfo* pCreateInfo); #define MAX_LAYER_LIBRARIES 64 #endif /* LOADER_H */ diff --git a/vk-layer-generate.py b/vk-layer-generate.py index 2cfa0020..ec8a97c7 100755 --- a/vk-layer-generate.py +++ b/vk-layer-generate.py @@ -104,7 +104,7 @@ class Subcommand(object): def _get_printf_params(self, vk_type, name, output_param, cpp=False): # TODO : Need ENUM and STRUCT checks here if vk_helper.is_type(vk_type, 'enum'):#"_TYPE" in vk_type: # TODO : This should be generic ENUM check - return ("%s", "string_%s(%s)" % (vk_type.strip('const ').strip('*'), name)) + return ("%s", "string_%s(%s)" % (vk_type.replace('const ', '').strip('*'), name)) if "char*" == vk_type: return ("%s", name) if "uint64" in vk_type: @@ -636,11 +636,11 @@ class APIDumpSubcommand(Subcommand): log_func_no_addr += '%s = address, ' % (p.name) else: log_func_no_addr += '%s = " << %s << ", ' % (p.name, pfi) - if prev_count_name != '' and (prev_count_name.strip('Count')[1:] in p.name or 'slotCount' == prev_count_name): + if prev_count_name != '' and (prev_count_name.replace('Count', '')[1:] in p.name or 'slotCount' == prev_count_name): sp_param_dict[pindex] = prev_count_name elif 'pDescriptorSets' == p.name and proto.params[-1].name == 'pCount': sp_param_dict[pindex] = '*pCount' - elif 'Wsi' not in proto.name and vk_helper.is_type(p.ty.strip('*').strip('const '), 'struct'): + elif 'Wsi' not in proto.name and vk_helper.is_type(p.ty.strip('*').replace('const ', ''), 'struct'): sp_param_dict[pindex] = 'index' pindex += 1 if p.name.endswith('Count'): @@ -666,7 +666,7 @@ class APIDumpSubcommand(Subcommand): log_func += '\n string tmp_str;' for sp_index in sp_param_dict: if 'index' == sp_param_dict[sp_index]: - cis_print_func = 'vk_print_%s' % (proto.params[sp_index].ty.strip('const ').strip('*').lower()) + cis_print_func = 'vk_print_%s' % (proto.params[sp_index].ty.replace('const ', '').strip('*').lower()) local_name = proto.params[sp_index].name if '*' not in proto.params[sp_index].ty: local_name = '&%s' % proto.params[sp_index].name @@ -677,11 +677,9 @@ class APIDumpSubcommand(Subcommand): else: # We have a count value stored to iterate over an array print_cast = '' print_func = '' - if vk_helper.is_type(proto.params[sp_index].ty.strip('*').strip('const '), 'struct'): + if vk_helper.is_type(proto.params[sp_index].ty.strip('*').replace('const ', ''), 'struct'): print_cast = '&' - print_func = 'vk_print_%s' % proto.params[sp_index].ty.strip('const ').strip('*').lower() - #cis_print_func = 'tmp_str = vk_print_%s(&%s[i], " ");' % (proto.params[sp_index].ty.strip('const ').strip('*').lower(), proto.params[sp_index].name) -# TODO : Need to display this address as a string + print_func = 'vk_print_%s' % proto.params[sp_index].ty.replace('const ', '').strip('*').lower() else: print_cast = '' print_func = 'string_convert_helper' @@ -1084,7 +1082,7 @@ class ObjectTrackerSubcommand(Subcommand): decl = proto.c_func(prefix="vk", attr="VKAPI") param0_name = proto.params[0].name - p0_type = proto.params[0].ty.strip('*').strip('const ') + p0_type = proto.params[0].ty.strip('*').replace('const ', '') create_line = '' destroy_line = '' funcs = [] @@ -1124,13 +1122,13 @@ class ObjectTrackerSubcommand(Subcommand): create_line += ' }\n' elif 'CreatePresentableImage' in proto.name: create_line = ' loader_platform_thread_lock_mutex(&objLock);\n' - create_line += ' ll_insert_obj((void*)*%s, %s);\n' % (proto.params[-2].name, obj_type_mapping[proto.params[-2].ty.strip('*').strip('const ')]) + create_line += ' ll_insert_obj((void*)*%s, %s);\n' % (proto.params[-2].name, obj_type_mapping[proto.params[-2].ty.strip('*').replace('const ', '')]) create_line += ' ll_insert_obj((void*)*pMem, VK_OBJECT_TYPE_PRESENTABLE_IMAGE_MEMORY);\n' - # create_line += ' ll_insert_obj((void*)*%s, VK_OBJECT_TYPE_PRESENTABLE_IMAGE_MEMORY);\n' % (obj_type_mapping[proto.params[-1].ty.strip('*').strip('const ')]) + # create_line += ' ll_insert_obj((void*)*%s, VK_OBJECT_TYPE_PRESENTABLE_IMAGE_MEMORY);\n' % (obj_type_mapping[proto.params[-1].ty.strip('*').replace('const ', '')]) create_line += ' loader_platform_thread_unlock_mutex(&objLock);\n' elif 'Create' in proto.name or 'Alloc' in proto.name: create_line = ' loader_platform_thread_lock_mutex(&objLock);\n' - create_line += ' ll_insert_obj((void*)*%s, %s);\n' % (proto.params[-1].name, obj_type_mapping[proto.params[-1].ty.strip('*').strip('const ')]) + create_line += ' ll_insert_obj((void*)*%s, %s);\n' % (proto.params[-1].name, obj_type_mapping[proto.params[-1].ty.strip('*').replace('const ', '')]) create_line += ' loader_platform_thread_unlock_mutex(&objLock);\n' if 'DestroyObject' in proto.name: destroy_line = ' loader_platform_thread_lock_mutex(&objLock);\n' diff --git a/vk_helper.py b/vk_helper.py index 74ae5d9e..f8cf2a80 100755 --- a/vk_helper.py +++ b/vk_helper.py @@ -160,6 +160,7 @@ class HeaderFileParser: (cur_char, targ_type) = line.strip().split(None, 1) self.typedef_fwd_dict[base_type] = targ_type.strip(';') self.typedef_rev_dict[targ_type.strip(';')] = base_type + #print("fwd_dict: %s = %s" % (base_type, targ_type)) elif parse_enum: #if 'VK_MAX_ENUM' not in line and '{' not in line: if True not in [ens in line for ens in ['{', 'VK_MAX_ENUM', '_RANGE']]: @@ -238,7 +239,7 @@ class HeaderFileParser: self.struct_dict[struct_type][num]['ptr'] = False if 'const' in member_type: self.struct_dict[struct_type][num]['const'] = True - member_type = member_type.strip('const').strip() + member_type = member_type.replace('const', '').strip() else: self.struct_dict[struct_type][num]['const'] = False # TODO : There is a bug here where it seems that at the time we do this check, @@ -296,6 +297,29 @@ def recreate_structs(): sys.stdout.write(typedef_fwd_dict[struct_name]) sys.stdout.write(";\n\n") +# +def get_struct_name_from_struct_type(struct_type): + caps_struct_name = struct_type.replace("_STRUCTURE_TYPE", "") + # NOTE: These must stay in caps as they are looking at the VK_STRUCTURE_TYPE_*_CREATE_INFO + # and that has not changed to camel case + exceptions_list = ['VK_DEVICE_CREATE_INFO', 'VK_INSTANCE_CREATE_INFO', 'VK_LAYER_CREATE_INFO', + 'VK_MEMORY_ALLOC_INFO', 'VK_MEMORY_ALLOC_BUFFER_INFO', 'VK_MEMORY_ALLOC_IMAGE_INFO', + 'VK_BUFFER_CREATE_INFO', 'VK_BUFFER_VIEW_CREATE_INFO'] + if caps_struct_name in exceptions_list: + char_idx = 0 + struct_name = '' + for char in caps_struct_name: + if (0 == char_idx) or (caps_struct_name[char_idx-1] == '_'): + struct_name += caps_struct_name[char_idx] + elif (caps_struct_name[char_idx] == '_'): + pass + else: + struct_name += caps_struct_name[char_idx].lower() + char_idx += 1 + else: + struct_name = caps_struct_name + return struct_name + # class for writing common file elements # Here's how this class lays out a file: # COPYRIGHT @@ -508,7 +532,7 @@ class StructWrapperGen: class_num = 0 if "_STRUCTURE_TYPE" in e: for v in sorted(enum_type_dict[e]): - struct_name = v.replace("_STRUCTURE_TYPE", "") + struct_name = get_struct_name_from_struct_type(v) class_name = self.get_class_name(struct_name) instance_name = "swc%i" % class_num dp_funcs.append(" case %s:\n {" % (v)) @@ -705,7 +729,7 @@ class StructWrapperGen: for e in enum_type_dict: if "_STRUCTURE_TYPE" in e: for v in sorted(enum_type_dict[e]): - struct_name = v.replace("_STRUCTURE_TYPE", "") + struct_name = get_struct_name_from_struct_type(v) print_func_name = self._get_sh_func_name(struct_name) sh_funcs.append(' case %s:\n {' % (v)) sh_funcs.append(' return %s((%s*)pStruct, indent);' % (print_func_name, struct_name)) @@ -754,12 +778,16 @@ class StructWrapperGen: if 1 < stp_list[index]['full_type'].count('*'): addr_char = '' if (stp_list[index]['array']): + sh_funcs.append('/* A */'); if stp_list[index]['dyn_array']: + sh_funcs.append('/* AA */'); array_count = 'pStruct->%s' % (stp_list[index]['array_size']) else: + sh_funcs.append('/* AB */'); array_count = '%s' % (stp_list[index]['array_size']) sh_funcs.append('%sstp_strs[%u] = "";' % (indent, index)) if not idx_ss_decl: + sh_funcs.append('/* AC */'); sh_funcs.append('%sstringstream index_ss;' % (indent)) idx_ss_decl = True sh_funcs.append('%sif (pStruct->%s) {' % (indent, stp_list[index]['name'])) @@ -769,15 +797,19 @@ class StructWrapperGen: sh_funcs.append('%sindex_ss.str("");' % (indent)) sh_funcs.append('%sindex_ss << i;' % (indent)) if not is_type(stp_list[index]['type'], 'struct'): + sh_funcs.append('/* AD */'); addr_char = '' sh_funcs.append('%sss[%u] << %spStruct->%s[i];' % (indent, index, addr_char, stp_list[index]['name'])) sh_funcs.append('%sstp_strs[%u] += " " + prefix + "%s[" + index_ss.str() + "] = " + ss[%u].str() + "\\n";' % (indent, index, stp_list[index]['name'], index)) else: + sh_funcs.append('/* AD */'); sh_funcs.append('%sss[%u] << %spStruct->%s[i];' % (indent, index, addr_char, stp_list[index]['name'])) sh_funcs.append('%stmp_str = %s(%spStruct->%s[i], extra_indent);' % (indent, self._get_sh_func_name(stp_list[index]['type']), addr_char, stp_list[index]['name'])) if self.no_addr: + sh_funcs.append('/* ADA */'); sh_funcs.append('%sstp_strs[%u] += " " + prefix + "%s[" + index_ss.str() + "] (addr)\\n" + tmp_str;' % (indent, index, stp_list[index]['name'])) else: + sh_funcs.append('/* ADB */'); sh_funcs.append('%sstp_strs[%u] += " " + prefix + "%s[" + index_ss.str() + "] (" + ss[%u].str() + ")\\n" + tmp_str;' % (indent, index, stp_list[index]['name'], index)) indent = indent[4:] sh_funcs.append('%s}' % (indent)) @@ -785,6 +817,7 @@ class StructWrapperGen: indent = indent[4:] sh_funcs.append('%s}' % (indent)) elif (stp_list[index]['ptr']): + sh_funcs.append('/* B */'); sh_funcs.append(' if (pStruct->%s) {' % stp_list[index]['name']) if 'pNext' == stp_list[index]['name']: sh_funcs.append(' tmp_str = dynamic_display((void*)pStruct->pNext, prefix);') @@ -804,6 +837,7 @@ class StructWrapperGen: sh_funcs.append(' else') sh_funcs.append(' stp_strs[%u] = "";' % index) else: + sh_funcs.append('/* C */'); sh_funcs.append(' tmp_str = %s(&pStruct->%s, extra_indent);' % (self._get_sh_func_name(stp_list[index]['type']), stp_list[index]['name'])) sh_funcs.append(' ss[%u] << %spStruct->%s;' % (index, addr_char, stp_list[index]['name'])) if self.no_addr: @@ -865,7 +899,7 @@ class StructWrapperGen: for e in enum_type_dict: if "_STRUCTURE_TYPE" in e: for v in sorted(enum_type_dict[e]): - struct_name = v.replace("_STRUCTURE_TYPE", "") + struct_name = get_struct_name_from_struct_type(v) print_func_name = self._get_sh_func_name(struct_name) sh_funcs.append(' case %s:\n {' % (v)) sh_funcs.append(' return %s((%s*)pStruct, indent);' % (print_func_name, struct_name)) @@ -1131,7 +1165,7 @@ class StructWrapperGen: for e in enum_type_dict: if '_STRUCTURE_TYPE' in e: for v in sorted(enum_type_dict[e]): - struct_name = v.replace("_STRUCTURE_TYPE", "") + struct_name = get_struct_name_from_struct_type(v) sh_funcs.append('%scase %s:' % (indent, v)) sh_funcs.append('%s{' % (indent)) indent += ' ' @@ -1533,7 +1567,7 @@ class GraphVizGen: for e in enum_type_dict: if "_STRUCTURE_TYPE" in e: for v in sorted(enum_type_dict[e]): - struct_name = v.replace("_STRUCTURE_TYPE", "") + struct_name = get_struct_name_from_struct_type(v) print_func_name = self._get_gv_func_name(struct_name) # TODO : Hand-coded fixes for some exceptions #if 'VK_PIPELINE_CB_STATE_CREATE_INFO' in struct_name: diff --git a/vulkan.py b/vulkan.py index 6e30e45b..28fcd7c9 100755 --- a/vulkan.py +++ b/vulkan.py @@ -218,7 +218,7 @@ core = Extension( ], protos=[ Proto("VK_RESULT", "CreateInstance", - [Param("const VK_INSTANCE_CREATE_INFO*", "pCreateInfo"), + [Param("const VkInstanceCreateInfo*", "pCreateInfo"), Param("VK_INSTANCE*", "pInstance")]), Proto("VK_RESULT", "DestroyInstance", @@ -242,7 +242,7 @@ core = Extension( Proto("VK_RESULT", "CreateDevice", [Param("VK_PHYSICAL_GPU", "gpu"), - Param("const VK_DEVICE_CREATE_INFO*", "pCreateInfo"), + Param("const VkDeviceCreateInfo*", "pCreateInfo"), Param("VK_DEVICE*", "pDevice")]), Proto("VK_RESULT", "DestroyDevice", @@ -288,7 +288,7 @@ core = Extension( Proto("VK_RESULT", "AllocMemory", [Param("VK_DEVICE", "device"), - Param("const VK_MEMORY_ALLOC_INFO*", "pAllocInfo"), + Param("const VkMemoryAllocInfo*", "pAllocInfo"), Param("VK_GPU_MEMORY*", "pMem")]), Proto("VK_RESULT", "FreeMemory", @@ -436,12 +436,12 @@ core = Extension( Proto("VK_RESULT", "CreateBuffer", [Param("VK_DEVICE", "device"), - Param("const VK_BUFFER_CREATE_INFO*", "pCreateInfo"), + Param("const VkBufferCreateInfo*", "pCreateInfo"), Param("VK_BUFFER*", "pBuffer")]), Proto("VK_RESULT", "CreateBufferView", [Param("VK_DEVICE", "device"), - Param("const VK_BUFFER_VIEW_CREATE_INFO*", "pCreateInfo"), + Param("const VkBufferViewCreateInfo*", "pCreateInfo"), Param("VK_BUFFER_VIEW*", "pView")]), Proto("VK_RESULT", "CreateImage", -- cgit v1.2.3