From fed3586f34ce701b0f6464c54456122e096c0bee Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 2 Dec 2015 16:14:58 -0800 Subject: [PATCH] vk/0.210.0: Rework result and structure type enums By and large, this is just moving enum values around. However, it also removed VK_UNSUPPORTED which we were returning a number of places. Those places now return VK_ERROR_INCOMPATABLE_DRIVER. --- include/vulkan/vulkan.h | 113 +++++++++++++++++++------------------- src/vulkan/anv_device.c | 16 +++--- src/vulkan/anv_pipeline.c | 5 +- src/vulkan/anv_query.c | 4 +- 4 files changed, 71 insertions(+), 67 deletions(-) diff --git a/include/vulkan/vulkan.h b/include/vulkan/vulkan.h index 7affe394992..2d8f0202326 100644 --- a/include/vulkan/vulkan.h +++ b/include/vulkan/vulkan.h @@ -109,12 +109,11 @@ VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCommandPool) typedef enum VkResult { VK_SUCCESS = 0, - VK_UNSUPPORTED = 1, - VK_NOT_READY = 2, - VK_TIMEOUT = 3, - VK_EVENT_SET = 4, - VK_EVENT_RESET = 5, - VK_INCOMPLETE = 6, + VK_NOT_READY = 1, + VK_TIMEOUT = 2, + VK_EVENT_SET = 3, + VK_EVENT_RESET = 4, + VK_INCOMPLETE = 5, VK_ERROR_OUT_OF_HOST_MEMORY = -1, VK_ERROR_OUT_OF_DEVICE_MEMORY = -2, VK_ERROR_INITIALIZATION_FAILED = -3, @@ -122,64 +121,68 @@ typedef enum VkResult { VK_ERROR_MEMORY_MAP_FAILED = -5, VK_ERROR_LAYER_NOT_PRESENT = -6, VK_ERROR_EXTENSION_NOT_PRESENT = -7, - VK_ERROR_INCOMPATIBLE_DRIVER = -8, - VK_RESULT_BEGIN_RANGE = VK_ERROR_INCOMPATIBLE_DRIVER, + VK_ERROR_FEATURE_NOT_PRESENT = -8, + VK_ERROR_INCOMPATIBLE_DRIVER = -9, + VK_ERROR_TOO_MANY_OBJECTS = -10, + VK_ERROR_FORMAT_NOT_SUPPORTED = -11, + VK_RESULT_BEGIN_RANGE = VK_ERROR_FORMAT_NOT_SUPPORTED, VK_RESULT_END_RANGE = VK_INCOMPLETE, - VK_RESULT_NUM = (VK_INCOMPLETE - VK_ERROR_INCOMPATIBLE_DRIVER + 1), + VK_RESULT_RANGE_SIZE = (VK_INCOMPLETE - VK_ERROR_FORMAT_NOT_SUPPORTED + 1), VK_RESULT_MAX_ENUM = 0x7FFFFFFF } VkResult; typedef enum VkStructureType { VK_STRUCTURE_TYPE_APPLICATION_INFO = 0, - VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO = 1, - VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO = 2, - VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO = 3, - VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO = 4, - VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO = 6, - VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO = 7, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO = 8, - VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO = 9, + VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 1, + VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO = 2, + VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO = 3, + VK_STRUCTURE_TYPE_SUBMIT_INFO = 4, + VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO = 5, + VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE = 6, + VK_STRUCTURE_TYPE_BIND_SPARSE_INFO = 7, + VK_STRUCTURE_TYPE_FENCE_CREATE_INFO = 8, + VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO = 9, VK_STRUCTURE_TYPE_EVENT_CREATE_INFO = 10, - VK_STRUCTURE_TYPE_FENCE_CREATE_INFO = 11, - VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO = 12, - VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO = 13, - VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO = 14, - VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO = 15, - VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO = 16, - VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO = 17, - VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO = 18, - VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO = 19, - VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO = 20, - VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO = 21, - VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO = 22, - VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO = 23, - VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO = 24, - VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO = 25, - VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO = 26, - VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO = 27, - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO = 28, - VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO = 29, - VK_STRUCTURE_TYPE_MEMORY_BARRIER = 30, - VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER = 31, - VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER = 32, + VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO = 11, + VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO = 12, + VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO = 13, + VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO = 14, + VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO = 15, + VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO = 16, + VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO = 17, + VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO = 18, + VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO = 19, + VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO = 20, + VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO = 21, + VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO = 22, + VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO = 23, + VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO = 24, + VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO = 25, + VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO = 26, + VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO = 27, + VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO = 28, + VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO = 29, + VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO = 30, + VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO = 31, + VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO = 32, VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO = 33, - VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET = 34, - VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET = 35, - VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 36, - VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO = 37, - VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE = 38, - VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO = 39, - VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION = 40, - VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION = 41, - VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY = 42, - VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 43, - VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO = 44, - VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO = 45, - VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO = 46, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO = 47, + VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO = 34, + VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET = 35, + VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET = 36, + VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO = 37, + VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO = 38, + VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO = 39, + VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO = 40, + VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO = 41, + VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 42, + VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER = 43, + VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER = 44, + VK_STRUCTURE_TYPE_MEMORY_BARRIER = 45, + VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO = 46, + VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO = 47, VK_STRUCTURE_TYPE_BEGIN_RANGE = VK_STRUCTURE_TYPE_APPLICATION_INFO, - VK_STRUCTURE_TYPE_END_RANGE = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, - VK_STRUCTURE_TYPE_NUM = (VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO - VK_STRUCTURE_TYPE_APPLICATION_INFO + 1), + VK_STRUCTURE_TYPE_END_RANGE = VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO, + VK_STRUCTURE_TYPE_RANGE_SIZE = (VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO - VK_STRUCTURE_TYPE_APPLICATION_INFO + 1), VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF } VkStructureType; diff --git a/src/vulkan/anv_device.c b/src/vulkan/anv_device.c index 9cf40e6d858..3fba33960d5 100644 --- a/src/vulkan/anv_device.c +++ b/src/vulkan/anv_device.c @@ -92,7 +92,7 @@ anv_physical_device_init(struct anv_physical_device *device, } else if (device->info->gen == 8 && !device->info->is_cherryview) { /* Broadwell is as fully supported as anything */ } else { - result = vk_errorf(VK_UNSUPPORTED, + result = vk_errorf(VK_ERROR_INCOMPATIBLE_DRIVER, "Vulkan not yet supported on %s", device->name); goto fail; } @@ -272,7 +272,7 @@ VkResult anv_EnumeratePhysicalDevices( if (instance->physicalDeviceCount < 0) { result = anv_physical_device_init(&instance->physicalDevice, instance, "/dev/dri/renderD128"); - if (result == VK_UNSUPPORTED) { + if (result == VK_ERROR_INCOMPATIBLE_DRIVER) { instance->physicalDeviceCount = 0; } else if (result == VK_SUCCESS) { instance->physicalDeviceCount = 1; @@ -1122,7 +1122,7 @@ VkResult anv_QueueBindSparse( const VkBindSparseInfo* pBindInfo, VkFence fence) { - stub_return(VK_UNSUPPORTED); + stub_return(VK_ERROR_INCOMPATIBLE_DRIVER); } VkResult anv_CreateFence( @@ -1302,7 +1302,7 @@ VkResult anv_CreateEvent( const VkAllocationCallbacks* pAllocator, VkEvent* pEvent) { - stub_return(VK_UNSUPPORTED); + stub_return(VK_ERROR_INCOMPATIBLE_DRIVER); } void anv_DestroyEvent( @@ -1317,21 +1317,21 @@ VkResult anv_GetEventStatus( VkDevice device, VkEvent event) { - stub_return(VK_UNSUPPORTED); + stub_return(VK_ERROR_INCOMPATIBLE_DRIVER); } VkResult anv_SetEvent( VkDevice device, VkEvent event) { - stub_return(VK_UNSUPPORTED); + stub_return(VK_ERROR_INCOMPATIBLE_DRIVER); } VkResult anv_ResetEvent( VkDevice device, VkEvent event) { - stub_return(VK_UNSUPPORTED); + stub_return(VK_ERROR_INCOMPATIBLE_DRIVER); } // Buffer functions @@ -1401,7 +1401,7 @@ VkResult anv_CreateBufferView( const VkAllocationCallbacks* pAllocator, VkBufferView* pView) { - stub_return(VK_UNSUPPORTED); + stub_return(VK_ERROR_INCOMPATIBLE_DRIVER); } void anv_DestroyBufferView( diff --git a/src/vulkan/anv_pipeline.c b/src/vulkan/anv_pipeline.c index e910298921e..367d5180bd3 100644 --- a/src/vulkan/anv_pipeline.c +++ b/src/vulkan/anv_pipeline.c @@ -158,7 +158,8 @@ VkResult anv_GetPipelineCacheData( size_t* pDataSize, void* pData) { - stub_return(VK_UNSUPPORTED); + *pDataSize = 0; + stub_return(VK_SUCCESS); } VkResult anv_MergePipelineCaches( @@ -167,7 +168,7 @@ VkResult anv_MergePipelineCaches( uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches) { - stub_return(VK_UNSUPPORTED); + stub_return(VK_SUCCESS); } void anv_DestroyPipeline( diff --git a/src/vulkan/anv_query.c b/src/vulkan/anv_query.c index cbceacf7f8e..320d42cb6fd 100644 --- a/src/vulkan/anv_query.c +++ b/src/vulkan/anv_query.c @@ -46,7 +46,7 @@ VkResult anv_CreateQueryPool( case VK_QUERY_TYPE_OCCLUSION: break; case VK_QUERY_TYPE_PIPELINE_STATISTICS: - return VK_UNSUPPORTED; + return VK_ERROR_INCOMPATIBLE_DRIVER; default: unreachable(""); } @@ -107,7 +107,7 @@ VkResult anv_GetQueryPoolResults( if (flags & VK_QUERY_RESULT_WITH_AVAILABILITY_BIT) { /* Where is the availabilty info supposed to go? */ anv_finishme("VK_QUERY_RESULT_WITH_AVAILABILITY_BIT"); - return VK_UNSUPPORTED; + return VK_ERROR_INCOMPATIBLE_DRIVER; } assert(pool->type == VK_QUERY_TYPE_OCCLUSION); -- 2.30.2