2016-03-28 14:03:06 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright 2016 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GrVkDefines_DEFINED
|
|
|
|
#define GrVkDefines_DEFINED
|
|
|
|
|
2017-05-01 13:50:58 +00:00
|
|
|
#ifdef SK_VULKAN
|
|
|
|
|
2016-03-28 14:03:06 +00:00
|
|
|
#if defined(SK_BUILD_FOR_WIN) || defined(SK_BUILD_FOR_WIN32)
|
2017-04-05 16:52:55 +00:00
|
|
|
# if !defined(VK_USE_PLATFORM_WIN32_KHR)
|
|
|
|
# define VK_USE_PLATFORM_WIN32_KHR
|
|
|
|
# endif
|
2016-03-28 14:03:06 +00:00
|
|
|
#elif defined(SK_BUILD_FOR_ANDROID)
|
2017-04-05 16:52:55 +00:00
|
|
|
# if !defined(VK_USE_PLATFORM_ANDROID_KHR)
|
|
|
|
# define VK_USE_PLATFORM_ANDROID_KHR
|
|
|
|
# endif
|
2016-03-28 14:03:06 +00:00
|
|
|
#elif defined(SK_BUILD_FOR_UNIX)
|
2017-04-05 16:52:55 +00:00
|
|
|
# if defined(__Fuchsia__)
|
|
|
|
# if !defined(VK_USE_PLATFORM_MAGMA_KHR)
|
|
|
|
# define VK_USE_PLATFORM_MAGMA_KHR
|
|
|
|
# endif
|
|
|
|
# else
|
|
|
|
# if !defined(VK_USE_PLATFORM_XCB_KHR)
|
|
|
|
# define VK_USE_PLATFORM_XCB_KHR
|
|
|
|
# endif
|
|
|
|
# endif
|
2016-05-11 17:09:18 +00:00
|
|
|
#endif
|
|
|
|
|
2017-04-25 17:38:26 +00:00
|
|
|
#include <vulkan/vulkan.h>
|
|
|
|
|
|
|
|
#define SKIA_REQUIRED_VULKAN_HEADER_VERSION 17
|
|
|
|
#if VK_HEADER_VERSION < SKIA_REQUIRED_VULKAN_HEADER_VERSION
|
|
|
|
#error "Vulkan header version is too low"
|
|
|
|
#endif
|
2016-03-28 14:03:06 +00:00
|
|
|
|
2017-11-01 23:15:06 +00:00
|
|
|
#ifndef VK_KHR_get_physical_device_properties2
|
2017-06-14 01:43:29 +00:00
|
|
|
|
2017-11-01 23:15:06 +00:00
|
|
|
// Installed Vulkan SDK is too old to define VK_KHR_get_physical_device_properties2: define it here.
|
|
|
|
#define VK_KHR_get_physical_device_properties2 1
|
|
|
|
#define VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION 1
|
|
|
|
#define VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME "VK_KHR_get_physical_device_properties2"
|
|
|
|
|
|
|
|
typedef struct VkPhysicalDeviceFeatures2KHR {
|
|
|
|
VkStructureType sType;
|
|
|
|
void* pNext;
|
|
|
|
VkPhysicalDeviceFeatures features;
|
|
|
|
} VkPhysicalDeviceFeatures2KHR;
|
|
|
|
|
|
|
|
typedef struct VkPhysicalDeviceProperties2KHR {
|
|
|
|
VkStructureType sType;
|
|
|
|
void* pNext;
|
|
|
|
VkPhysicalDeviceProperties properties;
|
|
|
|
} VkPhysicalDeviceProperties2KHR;
|
|
|
|
|
|
|
|
typedef struct VkFormatProperties2KHR {
|
|
|
|
VkStructureType sType;
|
|
|
|
void* pNext;
|
|
|
|
VkFormatProperties formatProperties;
|
|
|
|
} VkFormatProperties2KHR;
|
|
|
|
|
|
|
|
typedef struct VkImageFormatProperties2KHR {
|
|
|
|
VkStructureType sType;
|
|
|
|
void* pNext;
|
|
|
|
VkImageFormatProperties imageFormatProperties;
|
|
|
|
} VkImageFormatProperties2KHR;
|
|
|
|
|
|
|
|
typedef struct VkPhysicalDeviceImageFormatInfo2KHR {
|
|
|
|
VkStructureType sType;
|
|
|
|
const void* pNext;
|
|
|
|
VkFormat format;
|
|
|
|
VkImageType type;
|
|
|
|
VkImageTiling tiling;
|
|
|
|
VkImageUsageFlags usage;
|
|
|
|
VkImageCreateFlags flags;
|
|
|
|
} VkPhysicalDeviceImageFormatInfo2KHR;
|
|
|
|
|
|
|
|
typedef struct VkQueueFamilyProperties2KHR {
|
|
|
|
VkStructureType sType;
|
|
|
|
void* pNext;
|
|
|
|
VkQueueFamilyProperties queueFamilyProperties;
|
|
|
|
} VkQueueFamilyProperties2KHR;
|
|
|
|
|
|
|
|
typedef struct VkPhysicalDeviceMemoryProperties2KHR {
|
|
|
|
VkStructureType sType;
|
|
|
|
void* pNext;
|
|
|
|
VkPhysicalDeviceMemoryProperties memoryProperties;
|
|
|
|
} VkPhysicalDeviceMemoryProperties2KHR;
|
|
|
|
|
|
|
|
typedef struct VkSparseImageFormatProperties2KHR {
|
|
|
|
VkStructureType sType;
|
|
|
|
void* pNext;
|
|
|
|
VkSparseImageFormatProperties properties;
|
|
|
|
} VkSparseImageFormatProperties2KHR;
|
|
|
|
|
|
|
|
typedef struct VkPhysicalDeviceSparseImageFormatInfo2KHR {
|
|
|
|
VkStructureType sType;
|
|
|
|
const void* pNext;
|
|
|
|
VkFormat format;
|
|
|
|
VkImageType type;
|
|
|
|
VkSampleCountFlagBits samples;
|
|
|
|
VkImageUsageFlags usage;
|
|
|
|
VkImageTiling tiling;
|
|
|
|
} VkPhysicalDeviceSparseImageFormatInfo2KHR;
|
|
|
|
|
|
|
|
|
|
|
|
typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFeatures2KHR)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2KHR* pFeatures);
|
|
|
|
typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceProperties2KHR)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2KHR* pProperties);
|
|
|
|
typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFormatProperties2KHR)(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2KHR* pFormatProperties);
|
|
|
|
typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceImageFormatProperties2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2KHR* pImageFormatInfo, VkImageFormatProperties2KHR* pImageFormatProperties);
|
|
|
|
typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR)(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties2KHR* pQueueFamilyProperties);
|
|
|
|
typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceMemoryProperties2KHR)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2KHR* pMemoryProperties);
|
|
|
|
typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2KHR* pFormatInfo, uint32_t* pPropertyCount, VkSparseImageFormatProperties2KHR* pProperties);
|
|
|
|
|
|
|
|
static constexpr VkStructureType VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR = (VkStructureType) 1000059001;
|
|
|
|
|
|
|
|
#endif // !VK_KHR_get_physical_device_properties2
|
|
|
|
|
|
|
|
#ifndef VK_EXT_discard_rectangles
|
|
|
|
|
|
|
|
// Installed Vulkan SDK is too old to define discard rectangles: define them here.
|
|
|
|
#define VK_EXT_discard_rectangles 1
|
|
|
|
#define VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION 1
|
|
|
|
#define VK_EXT_DISCARD_RECTANGLES_EXTENSION_NAME "VK_EXT_discard_rectangles"
|
|
|
|
|
|
|
|
typedef enum VkDiscardRectangleModeEXT {
|
|
|
|
VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT = 0,
|
|
|
|
VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT = 1,
|
|
|
|
VK_DISCARD_RECTANGLE_MODE_BEGIN_RANGE_EXT = VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT,
|
|
|
|
VK_DISCARD_RECTANGLE_MODE_END_RANGE_EXT = VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT,
|
|
|
|
VK_DISCARD_RECTANGLE_MODE_RANGE_SIZE_EXT = (VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT - VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT + 1),
|
|
|
|
VK_DISCARD_RECTANGLE_MODE_MAX_ENUM_EXT = 0x7FFFFFFF
|
|
|
|
} VkDiscardRectangleModeEXT;
|
|
|
|
|
|
|
|
typedef VkFlags VkPipelineDiscardRectangleStateCreateFlagsEXT;
|
|
|
|
|
|
|
|
typedef struct VkPhysicalDeviceDiscardRectanglePropertiesEXT {
|
|
|
|
VkStructureType sType;
|
|
|
|
const void* pNext;
|
|
|
|
uint32_t maxDiscardRectangles;
|
|
|
|
} VkPhysicalDeviceDiscardRectanglePropertiesEXT;
|
|
|
|
|
|
|
|
typedef struct VkPipelineDiscardRectangleStateCreateInfoEXT {
|
|
|
|
VkStructureType sType;
|
|
|
|
const void* pNext;
|
|
|
|
VkPipelineDiscardRectangleStateCreateFlagsEXT flags;
|
|
|
|
VkDiscardRectangleModeEXT discardRectangleMode;
|
|
|
|
uint32_t discardRectangleCount;
|
|
|
|
const VkRect2D* pDiscardRectangles;
|
|
|
|
} VkPipelineDiscardRectangleStateCreateInfoEXT;
|
|
|
|
|
|
|
|
|
|
|
|
typedef void (VKAPI_PTR *PFN_vkCmdSetDiscardRectangleEXT)(VkCommandBuffer commandBuffer, uint32_t firstDiscardRectangle, uint32_t discardRectangleCount, const VkRect2D* pDiscardRectangles);
|
|
|
|
|
|
|
|
static constexpr VkStructureType VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT = (VkStructureType) 1000099000;
|
|
|
|
static constexpr VkStructureType VK_STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT = (VkStructureType) 1000099001;
|
|
|
|
static constexpr VkDynamicState VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT = (VkDynamicState) 1000099000;
|
|
|
|
|
|
|
|
#endif // !VK_EXT_discard_rectangles
|
|
|
|
|
|
|
|
#endif // SK_VULKAN
|
|
|
|
|
|
|
|
#endif // GrVkDefines_DEFINED
|