vk/0.210.0: Switch to the new VKAPI function decorations

While we're at it, we do a bunch of the VkResult -> void updates
This commit is contained in:
Jason Ekstrand 2015-11-30 12:21:19 -08:00
parent a89a485e79
commit f1a7c7841f
11 changed files with 372 additions and 379 deletions

View File

@ -144,60 +144,60 @@ typedef struct {
// ------------------------------------------------------------------------------------------------
// Function types
typedef VkResult (VKAPI *PFN_vkGetSurfacePropertiesKHR)(VkDevice device, const VkSurfaceDescriptionKHR* pSurfaceDescription, VkSurfacePropertiesKHR* pSurfaceProperties);
typedef VkResult (VKAPI *PFN_vkGetSurfaceFormatsKHR)(VkDevice device, const VkSurfaceDescriptionKHR* pSurfaceDescription, uint32_t* pCount, VkSurfaceFormatKHR* pSurfaceFormats);
typedef VkResult (VKAPI *PFN_vkGetSurfacePresentModesKHR)(VkDevice device, const VkSurfaceDescriptionKHR* pSurfaceDescription, uint32_t* pCount, VkPresentModeKHR* pPresentModes);
typedef VkResult (VKAPI *PFN_vkCreateSwapchainKHR)(VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInfo, VkSwapchainKHR* pSwapchain);
typedef VkResult (VKAPI *PFN_vkDestroySwapchainKHR)(VkDevice device, VkSwapchainKHR swapchain);
typedef VkResult (VKAPI *PFN_vkGetSwapchainImagesKHR)(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pCount, VkImage* pSwapchainImages);
typedef VkResult (VKAPI *PFN_vkAcquireNextImageKHR)(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, uint32_t* pImageIndex);
typedef VkResult (VKAPI *PFN_vkQueuePresentKHR)(VkQueue queue, VkPresentInfoKHR* pPresentInfo);
typedef VkResult (VKAPI_PTR *PFN_vkGetSurfacePropertiesKHR)(VkDevice device, const VkSurfaceDescriptionKHR* pSurfaceDescription, VkSurfacePropertiesKHR* pSurfaceProperties);
typedef VkResult (VKAPI_PTR *PFN_vkGetSurfaceFormatsKHR)(VkDevice device, const VkSurfaceDescriptionKHR* pSurfaceDescription, uint32_t* pCount, VkSurfaceFormatKHR* pSurfaceFormats);
typedef VkResult (VKAPI_PTR *PFN_vkGetSurfacePresentModesKHR)(VkDevice device, const VkSurfaceDescriptionKHR* pSurfaceDescription, uint32_t* pCount, VkPresentModeKHR* pPresentModes);
typedef VkResult (VKAPI_PTR *PFN_vkCreateSwapchainKHR)(VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInfo, VkSwapchainKHR* pSwapchain);
typedef VkResult (VKAPI_PTR *PFN_vkDestroySwapchainKHR)(VkDevice device, VkSwapchainKHR swapchain);
typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainImagesKHR)(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pCount, VkImage* pSwapchainImages);
typedef VkResult (VKAPI_PTR *PFN_vkAcquireNextImageKHR)(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, uint32_t* pImageIndex);
typedef VkResult (VKAPI_PTR *PFN_vkQueuePresentKHR)(VkQueue queue, VkPresentInfoKHR* pPresentInfo);
// ------------------------------------------------------------------------------------------------
// Function prototypes
#ifdef VK_PROTOTYPES
VkResult VKAPI vkGetSurfacePropertiesKHR(
VKAPI_ATTR VkResult VKAPI_CALL vkGetSurfacePropertiesKHR(
VkDevice device,
const VkSurfaceDescriptionKHR* pSurfaceDescription,
VkSurfacePropertiesKHR* pSurfaceProperties);
VkResult VKAPI vkGetSurfaceFormatsKHR(
VKAPI_ATTR VkResult VKAPI_CALL vkGetSurfaceFormatsKHR(
VkDevice device,
const VkSurfaceDescriptionKHR* pSurfaceDescription,
uint32_t* pCount,
VkSurfaceFormatKHR* pSurfaceFormats);
VkResult VKAPI vkGetSurfacePresentModesKHR(
VKAPI_ATTR VkResult VKAPI_CALL vkGetSurfacePresentModesKHR(
VkDevice device,
const VkSurfaceDescriptionKHR* pSurfaceDescription,
uint32_t* pCount,
VkPresentModeKHR* pPresentModes);
VkResult VKAPI vkCreateSwapchainKHR(
VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR(
VkDevice device,
const VkSwapchainCreateInfoKHR* pCreateInfo,
VkSwapchainKHR* pSwapchain);
VkResult VKAPI vkDestroySwapchainKHR(
VKAPI_ATTR VkResult VKAPI_CALL vkDestroySwapchainKHR(
VkDevice device,
VkSwapchainKHR swapchain);
VkResult VKAPI vkGetSwapchainImagesKHR(
VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainImagesKHR(
VkDevice device,
VkSwapchainKHR swapchain,
uint32_t* pCount,
VkImage* pSwapchainImages);
VkResult VKAPI vkAcquireNextImageKHR(
VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImageKHR(
VkDevice device,
VkSwapchainKHR swapchain,
uint64_t timeout,
VkSemaphore semaphore,
uint32_t* pImageIndex);
VkResult VKAPI vkQueuePresentKHR(
VKAPI_ATTR VkResult VKAPI_CALL vkQueuePresentKHR(
VkQueue queue,
VkPresentInfoKHR* pPresentInfo);

View File

@ -131,14 +131,14 @@ typedef struct {
// ------------------------------------------------------------------------------------------------
// Function types
typedef VkResult (VKAPI *PFN_vkGetPhysicalDeviceSurfaceSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, const VkSurfaceDescriptionKHR* pSurfaceDescription, VkBool32* pSupported);
typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, const VkSurfaceDescriptionKHR* pSurfaceDescription, VkBool32* pSupported);
// ------------------------------------------------------------------------------------------------
// Function prototypes
#ifdef VK_PROTOTYPES
VkResult VKAPI vkGetPhysicalDeviceSurfaceSupportKHR(
VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceSupportKHR(
VkPhysicalDevice physicalDevice,
uint32_t queueFamilyIndex,
const VkSurfaceDescriptionKHR* pSurfaceDescription,

View File

@ -39,15 +39,40 @@ extern "C"
***************************************************************************************************
*/
/* Platform-specific calling convention macros.
*
* Platforms should define these so that Vulkan clients call Vulkan commands
* with the same calling conventions that the Vulkan implementation expects.
*
* VKAPI_ATTR - Placed before the return type in function declarations.
* Useful for C++11 and GCC/Clang-style function attribute syntax.
* VKAPI_CALL - Placed after the return type in function declarations.
* Useful for MSVC-style calling convention syntax.
* VKAPI_PTR - Placed between the '(' and '*' in function pointer types.
*
* Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void);
* Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void);
*/
#if defined(_WIN32)
// On Windows, VKAPI should equate to the __stdcall convention
#define VKAPI __stdcall
#elif defined(__GNUC__)
// On other platforms using GCC, VKAPI stays undefined
#define VKAPI
// On Windows, Vulkan commands use the stdcall convention
#define VKAPI_ATTR
#define VKAPI_CALL __stdcall
#define VKAPI_PTR VKAPI_CALL
#elif defined(__ANDROID__) && defined(__ARM_EABI__) && !defined(__ARM_ARCH_7A__)
// Android does not support Vulkan in native code using the "armeabi" ABI.
#error "Vulkan requires the 'armeabi-v7a' or 'armeabi-v7a-hard' ABI on 32-bit ARM CPUs"
#elif defined(__ANDROID__) && defined(__ARM_ARCH_7A__)
// On Android/ARMv7a, Vulkan functions use the armeabi-v7a-hard calling
// convention, even if the application's native code is compiled with the
// armeabi-v7a calling convention.
#define VKAPI_ATTR __attribute__((pcs("aapcs-vfp")))
#define VKAPI_CALL
#define VKAPI_PTR VKAPI_ATTR
#else
// Unsupported Platform!
#error "Unsupported OS Platform detected!"
// On other platforms, use the default calling convention
#define VKAPI_ATTR
#define VKAPI_CALL
#define VKAPI_PTR
#endif
#include <stddef.h>

File diff suppressed because it is too large Load Diff

View File

@ -42,11 +42,11 @@ typedef struct VkDmaBufImageCreateInfo_
uint32_t strideInBytes;
} VkDmaBufImageCreateInfo;
typedef VkResult (VKAPI *PFN_vkCreateDmaBufImageINTEL)(VkDevice device, const VkDmaBufImageCreateInfo* pCreateInfo, VkDeviceMemory* pMem, VkImage* pImage);
typedef VkResult (VKAPI_PTR *PFN_vkCreateDmaBufImageINTEL)(VkDevice device, const VkDmaBufImageCreateInfo* pCreateInfo, VkDeviceMemory* pMem, VkImage* pImage);
#ifdef VK_PROTOTYPES
VkResult VKAPI vkCreateDmaBufImageINTEL(
VKAPI_ATTR VkResult VKAPI_CALL vkCreateDmaBufImageINTEL(
VkDevice _device,
const VkDmaBufImageCreateInfo* pCreateInfo,
VkDeviceMemory* pMem,

View File

@ -330,7 +330,7 @@ VkResult anv_EnumeratePhysicalDevices(
return VK_SUCCESS;
}
VkResult anv_GetPhysicalDeviceFeatures(
void anv_GetPhysicalDeviceFeatures(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceFeatures* pFeatures)
{
@ -378,11 +378,9 @@ VkResult anv_GetPhysicalDeviceFeatures(
.shaderInt16 = false,
.alphaToOne = true,
};
return VK_SUCCESS;
}
VkResult anv_GetPhysicalDeviceProperties(
void anv_GetPhysicalDeviceProperties(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceProperties* pProperties)
{
@ -514,18 +512,16 @@ VkResult anv_GetPhysicalDeviceProperties(
strcpy(pProperties->deviceName, pdevice->name);
snprintf((char *)pProperties->pipelineCacheUUID, VK_UUID_LENGTH,
"anv-%s", MESA_GIT_SHA1 + 4);
return VK_SUCCESS;
}
VkResult anv_GetPhysicalDeviceQueueFamilyProperties(
void anv_GetPhysicalDeviceQueueFamilyProperties(
VkPhysicalDevice physicalDevice,
uint32_t* pCount,
VkQueueFamilyProperties* pQueueFamilyProperties)
{
if (pQueueFamilyProperties == NULL) {
*pCount = 1;
return VK_SUCCESS;
return;
}
assert(*pCount >= 1);
@ -537,11 +533,9 @@ VkResult anv_GetPhysicalDeviceQueueFamilyProperties(
.queueCount = 1,
.supportsTimestamps = true,
};
return VK_SUCCESS;
}
VkResult anv_GetPhysicalDeviceMemoryProperties(
void anv_GetPhysicalDeviceMemoryProperties(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceMemoryProperties* pMemoryProperties)
{
@ -565,8 +559,6 @@ VkResult anv_GetPhysicalDeviceMemoryProperties(
.size = heap_size,
.flags = VK_MEMORY_HEAP_HOST_LOCAL_BIT,
};
return VK_SUCCESS;
}
PFN_vkVoidFunction anv_GetInstanceProcAddr(
@ -795,7 +787,7 @@ VkResult anv_EnumerateDeviceLayerProperties(
return vk_error(VK_ERROR_LAYER_NOT_PRESENT);
}
VkResult anv_GetDeviceQueue(
void anv_GetDeviceQueue(
VkDevice _device,
uint32_t queueNodeIndex,
uint32_t queueIndex,
@ -806,8 +798,6 @@ VkResult anv_GetDeviceQueue(
assert(queueIndex == 0);
*pQueue = anv_queue_to_handle(&device->queue);
return VK_SUCCESS;
}
VkResult anv_QueueSubmit(
@ -1059,7 +1049,7 @@ VkResult anv_InvalidateMappedMemoryRanges(
return anv_FlushMappedMemoryRanges(device, memRangeCount, pMemRanges);
}
VkResult anv_GetBufferMemoryRequirements(
void anv_GetBufferMemoryRequirements(
VkDevice device,
VkBuffer _buffer,
VkMemoryRequirements* pMemoryRequirements)
@ -1079,11 +1069,9 @@ VkResult anv_GetBufferMemoryRequirements(
pMemoryRequirements->size = buffer->size;
pMemoryRequirements->alignment = 16;
return VK_SUCCESS;
}
VkResult anv_GetImageMemoryRequirements(
void anv_GetImageMemoryRequirements(
VkDevice device,
VkImage _image,
VkMemoryRequirements* pMemoryRequirements)
@ -1103,26 +1091,23 @@ VkResult anv_GetImageMemoryRequirements(
pMemoryRequirements->size = image->size;
pMemoryRequirements->alignment = image->alignment;
return VK_SUCCESS;
}
VkResult anv_GetImageSparseMemoryRequirements(
void anv_GetImageSparseMemoryRequirements(
VkDevice device,
VkImage image,
uint32_t* pNumRequirements,
VkSparseImageMemoryRequirements* pSparseMemoryRequirements)
{
return vk_error(VK_UNSUPPORTED);
stub();
}
VkResult anv_GetDeviceMemoryCommitment(
void anv_GetDeviceMemoryCommitment(
VkDevice device,
VkDeviceMemory memory,
VkDeviceSize* pCommittedMemoryInBytes)
{
*pCommittedMemoryInBytes = 0;
stub_return(VK_SUCCESS);
}
VkResult anv_BindBufferMemory(

View File

@ -58,7 +58,7 @@ anv_dump_image_to_ppm(struct anv_device *device,
assert(result == VK_SUCCESS);
VkMemoryRequirements reqs;
result = anv_GetImageMemoryRequirements(vk_device, copy_image, &reqs);
anv_GetImageMemoryRequirements(vk_device, copy_image, &reqs);
VkDeviceMemory memory;
result = anv_AllocMemory(vk_device,
@ -176,13 +176,12 @@ anv_dump_image_to_ppm(struct anv_device *device,
assert(result == VK_SUCCESS);
VkSubresourceLayout layout;
result = anv_GetImageSubresourceLayout(vk_device, copy_image,
anv_GetImageSubresourceLayout(vk_device, copy_image,
&(VkImageSubresource) {
.aspect = VK_IMAGE_ASPECT_COLOR,
.mipLevel = 0,
.arrayLayer = 0,
}, &layout);
assert(result == VK_SUCCESS);
map += layout.offset;

View File

@ -27,7 +27,7 @@ import fileinput, re, sys
# Each function typedef in the vulkan.h header is all on one line and matches
# this regepx. We hope that won't change.
p = re.compile('typedef ([^ ]*) *\(VKAPI \*PFN_vk([^(]*)\)(.*);')
p = re.compile('typedef ([^ ]*) *\(VKAPI_PTR \*PFN_vk([^(]*)\)(.*);')
entrypoints = []

View File

@ -227,17 +227,17 @@ anv_format_for_vk_format(VkFormat format)
// Format capabilities
VkResult anv_validate_GetPhysicalDeviceFormatProperties(
void anv_validate_GetPhysicalDeviceFormatProperties(
VkPhysicalDevice physicalDevice,
VkFormat _format,
VkFormatProperties* pFormatProperties)
{
const struct anv_format *format = anv_format_for_vk_format(_format);
fprintf(stderr, "vkGetFormatProperties(%s)\n", format->name);
return anv_GetPhysicalDeviceFormatProperties(physicalDevice, _format, pFormatProperties);
anv_GetPhysicalDeviceFormatProperties(physicalDevice, _format, pFormatProperties);
}
static VkResult
static void
anv_physical_device_get_format_properties(struct anv_physical_device *physical_device,
const struct anv_format *format,
VkFormatProperties *out_properties)
@ -296,32 +296,25 @@ anv_physical_device_get_format_properties(struct anv_physical_device *physical_d
out_properties->optimalTilingFeatures = tiled;
out_properties->bufferFeatures = 0; /* FINISHME */
return VK_SUCCESS;
return;
unsupported:
out_properties->linearTilingFeatures = 0;
out_properties->optimalTilingFeatures = 0;
return VK_SUCCESS;
}
VkResult anv_GetPhysicalDeviceFormatProperties(
void anv_GetPhysicalDeviceFormatProperties(
VkPhysicalDevice physicalDevice,
VkFormat format,
VkFormatProperties* pFormatProperties)
{
ANV_FROM_HANDLE(anv_physical_device, physical_device, physicalDevice);
VkResult result;
result = anv_physical_device_get_format_properties(
anv_physical_device_get_format_properties(
physical_device,
anv_format_for_vk_format(format),
pFormatProperties);
if (result != VK_SUCCESS)
return vk_error(result);
return VK_SUCCESS;
}
VkResult anv_GetPhysicalDeviceImageFormatProperties(
@ -340,12 +333,9 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties(
VkExtent3D maxExtent;
uint32_t maxMipLevels;
uint32_t maxArraySize;
VkResult result;
result = anv_physical_device_get_format_properties(physical_device, format,
&format_props);
if (result != VK_SUCCESS)
return vk_error(result);
anv_physical_device_get_format_properties(physical_device, format,
&format_props);
/* Extract the VkFormatFeatureFlags that are relevant for the queried
* tiling.
@ -453,7 +443,7 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties(
.maxResourceSize = UINT32_MAX,
};
return VK_SUCCESS;
return VK_SUCCESS;
unsupported:
*pImageFormatProperties = (VkImageFormatProperties) {
@ -467,7 +457,7 @@ unsupported:
return VK_SUCCESS;
}
VkResult anv_GetPhysicalDeviceSparseImageFormatProperties(
void anv_GetPhysicalDeviceSparseImageFormatProperties(
VkPhysicalDevice physicalDevice,
VkFormat format,
VkImageType type,
@ -479,6 +469,4 @@ VkResult anv_GetPhysicalDeviceSparseImageFormatProperties(
{
/* Sparse images are not yet supported. */
*pNumProperties = 0;
return VK_SUCCESS;
}

View File

@ -422,7 +422,7 @@ anv_surface_get_subresource_layout(struct anv_image *image,
layout->size = surface->stride * image->extent.height;
}
VkResult anv_GetImageSubresourceLayout(
void anv_GetImageSubresourceLayout(
VkDevice device,
VkImage _image,
const VkImageSubresource* pSubresource,
@ -444,10 +444,8 @@ VkResult anv_GetImageSubresourceLayout(
pSubresource, pLayout);
break;
default:
return vk_error(VK_UNSUPPORTED);
assert(!"Invalid image aspect");
}
return VK_SUCCESS;
}
VkResult

View File

@ -133,12 +133,10 @@ void anv_DestroyRenderPass(
anv_device_free(device, pass);
}
VkResult anv_GetRenderAreaGranularity(
void anv_GetRenderAreaGranularity(
VkDevice device,
VkRenderPass renderPass,
VkExtent2D* pGranularity)
{
*pGranularity = (VkExtent2D) { 1, 1 };
return VK_SUCCESS;
}