vk/vulkan.h: Move format quering to the physical device
This commit is contained in:
parent
719fa8ac74
commit
cc29a5f4be
|
@ -1890,6 +1890,7 @@ typedef VkResult (VKAPI *PFN_vkCreateInstance)(const VkInstanceCreateInfo* pCrea
|
|||
typedef VkResult (VKAPI *PFN_vkDestroyInstance)(VkInstance instance);
|
||||
typedef VkResult (VKAPI *PFN_vkEnumeratePhysicalDevices)(VkInstance instance, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices);
|
||||
typedef VkResult (VKAPI *PFN_vkGetPhysicalDeviceInfo)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceInfoType infoType, size_t* pDataSize, void* pData);
|
||||
typedef VkResult (VKAPI *PFN_vkGetPhysicalDeviceFormatInfo)(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatInfo);
|
||||
typedef PFN_vkVoidFunction (VKAPI *PFN_vkGetInstanceProcAddr)(VkInstance instance, const char* pName);
|
||||
typedef PFN_vkVoidFunction (VKAPI *PFN_vkGetDeviceProcAddr)(VkDevice device, const char* pName);
|
||||
typedef VkResult (VKAPI *PFN_vkCreateDevice)(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, VkDevice* pDevice);
|
||||
|
@ -1925,7 +1926,6 @@ typedef VkResult (VKAPI *PFN_vkSetEvent)(VkDevice device, VkEvent event);
|
|||
typedef VkResult (VKAPI *PFN_vkResetEvent)(VkDevice device, VkEvent event);
|
||||
typedef VkResult (VKAPI *PFN_vkCreateQueryPool)(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, VkQueryPool* pQueryPool);
|
||||
typedef VkResult (VKAPI *PFN_vkGetQueryPoolResults)(VkDevice device, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount, size_t* pDataSize, void* pData, VkQueryResultFlags flags);
|
||||
typedef VkResult (VKAPI *PFN_vkGetFormatInfo)(VkDevice device, VkFormat format, VkFormatInfoType infoType, size_t* pDataSize, void* pData);
|
||||
typedef VkResult (VKAPI *PFN_vkCreateBuffer)(VkDevice device, const VkBufferCreateInfo* pCreateInfo, VkBuffer* pBuffer);
|
||||
typedef VkResult (VKAPI *PFN_vkCreateBufferView)(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, VkBufferView* pView);
|
||||
typedef VkResult (VKAPI *PFN_vkCreateImage)(VkDevice device, const VkImageCreateInfo* pCreateInfo, VkImage* pImage);
|
||||
|
@ -2014,6 +2014,11 @@ VkResult VKAPI vkGetPhysicalDeviceInfo(
|
|||
size_t* pDataSize,
|
||||
void* pData);
|
||||
|
||||
VkResult VKAPI vkGetPhysicalDeviceFormatInfo(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
VkFormat format,
|
||||
VkFormatProperties* pFormatInfo);
|
||||
|
||||
PFN_vkVoidFunction VKAPI vkGetInstanceProcAddr(
|
||||
VkInstance instance,
|
||||
const char* pName);
|
||||
|
@ -2197,13 +2202,6 @@ VkResult VKAPI vkGetQueryPoolResults(
|
|||
void* pData,
|
||||
VkQueryResultFlags flags);
|
||||
|
||||
VkResult VKAPI vkGetFormatInfo(
|
||||
VkDevice device,
|
||||
VkFormat format,
|
||||
VkFormatInfoType infoType,
|
||||
size_t* pDataSize,
|
||||
void* pData);
|
||||
|
||||
VkResult VKAPI vkCreateBuffer(
|
||||
VkDevice device,
|
||||
const VkBufferCreateInfo* pCreateInfo,
|
||||
|
|
|
@ -232,28 +232,32 @@ struct surface_format_info {
|
|||
|
||||
extern const struct surface_format_info surface_formats[];
|
||||
|
||||
VkResult anv_validate_GetFormatInfo(
|
||||
VkDevice _device,
|
||||
VkResult anv_validate_GetPhysicalDeviceFormatInfo(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
VkFormat _format,
|
||||
VkFormatInfoType infoType,
|
||||
size_t* pDataSize,
|
||||
void* pData)
|
||||
VkFormatProperties* pFormatInfo)
|
||||
{
|
||||
const struct anv_format *format = anv_format_for_vk_format(_format);
|
||||
fprintf(stderr, "vkGetFormatInfo(%s)\n", format->name);
|
||||
return anv_GetFormatInfo(_device, _format, infoType, pDataSize, pData);
|
||||
return anv_GetPhysicalDeviceFormatInfo(physicalDevice, _format, pFormatInfo);
|
||||
}
|
||||
|
||||
static void
|
||||
anv_format_get_properties(struct anv_device *device,
|
||||
const struct anv_format *format,
|
||||
VkFormatProperties *properties)
|
||||
VkResult anv_GetPhysicalDeviceFormatInfo(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
VkFormat _format,
|
||||
VkFormatProperties* pFormatInfo)
|
||||
{
|
||||
struct anv_physical_device *physical_device =
|
||||
(struct anv_physical_device *) physicalDevice;
|
||||
const struct surface_format_info *info;
|
||||
int gen;
|
||||
|
||||
gen = device->info.gen * 10;
|
||||
if (device->info.is_haswell)
|
||||
const struct anv_format *format = anv_format_for_vk_format(_format);
|
||||
if (format == NULL)
|
||||
return vk_error(VK_ERROR_INVALID_VALUE);
|
||||
|
||||
gen = physical_device->info->gen * 10;
|
||||
if (physical_device->info->is_haswell)
|
||||
gen += 5;
|
||||
|
||||
if (format->surface_format == UNSUPPORTED)
|
||||
|
@ -280,42 +284,14 @@ anv_format_get_properties(struct anv_device *device,
|
|||
linear |= VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT;
|
||||
}
|
||||
|
||||
properties->linearTilingFeatures = linear;
|
||||
properties->optimalTilingFeatures = tiled;
|
||||
return;
|
||||
pFormatInfo->linearTilingFeatures = linear;
|
||||
pFormatInfo->optimalTilingFeatures = tiled;
|
||||
|
||||
return VK_SUCCESS;
|
||||
|
||||
unsupported:
|
||||
properties->linearTilingFeatures = 0;
|
||||
properties->optimalTilingFeatures = 0;
|
||||
}
|
||||
|
||||
VkResult anv_GetFormatInfo(
|
||||
VkDevice _device,
|
||||
VkFormat _format,
|
||||
VkFormatInfoType infoType,
|
||||
size_t* pDataSize,
|
||||
void* pData)
|
||||
{
|
||||
struct anv_device *device = (struct anv_device *) _device;
|
||||
const struct anv_format *format;
|
||||
VkFormatProperties *properties;
|
||||
|
||||
format = anv_format_for_vk_format(_format);
|
||||
if (format == 0)
|
||||
return vk_error(VK_ERROR_INVALID_VALUE);
|
||||
|
||||
switch (infoType) {
|
||||
case VK_FORMAT_INFO_TYPE_PROPERTIES:
|
||||
properties = (VkFormatProperties *)pData;
|
||||
|
||||
*pDataSize = sizeof(*properties);
|
||||
if (pData == NULL)
|
||||
return VK_SUCCESS;
|
||||
|
||||
anv_format_get_properties(device, format, properties);
|
||||
return VK_SUCCESS;
|
||||
|
||||
default:
|
||||
return vk_error(VK_ERROR_INVALID_VALUE);
|
||||
}
|
||||
pFormatInfo->linearTilingFeatures = 0;
|
||||
pFormatInfo->optimalTilingFeatures = 0;
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue