diff options
author | Chris Dalton <csmartdalton@google.com> | 2017-11-01 17:15:06 -0600 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-11-02 15:27:21 +0000 |
commit | 94c0468b2b4255e3beed81efdcfbf6d9d39e11e4 (patch) | |
tree | c4e318a9b0316c7b7bdb956b1502e2f08ee1fb15 /include/gpu/vk | |
parent | 8d05a2dc09b870bcd8e330a589f34cf1c7e00553 (diff) |
Implement window rectangles in vulkan
Bug: skia:
Change-Id: I32c079b90a5503c797dfc073a093f940cd8c550a
Reviewed-on: https://skia-review.googlesource.com/65423
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'include/gpu/vk')
-rw-r--r-- | include/gpu/vk/GrVkBackendContext.h | 16 | ||||
-rw-r--r-- | include/gpu/vk/GrVkDefines.h | 128 | ||||
-rw-r--r-- | include/gpu/vk/GrVkInterface.h | 4 |
3 files changed, 139 insertions, 9 deletions
diff --git a/include/gpu/vk/GrVkBackendContext.h b/include/gpu/vk/GrVkBackendContext.h index 68791ba945..4b93313a74 100644 --- a/include/gpu/vk/GrVkBackendContext.h +++ b/include/gpu/vk/GrVkBackendContext.h @@ -14,13 +14,15 @@ #include "vk/GrVkInterface.h" enum GrVkExtensionFlags { - kEXT_debug_report_GrVkExtensionFlag = 0x0001, - kNV_glsl_shader_GrVkExtensionFlag = 0x0002, - kKHR_surface_GrVkExtensionFlag = 0x0004, - kKHR_swapchain_GrVkExtensionFlag = 0x0008, - kKHR_win32_surface_GrVkExtensionFlag = 0x0010, - kKHR_android_surface_GrVkExtensionFlag = 0x0020, - kKHR_xcb_surface_GrVkExtensionFlag = 0x0040, + kKHR_get_physical_device_properties2_GrVkExtensionFlag = 0x0001, + kEXT_debug_report_GrVkExtensionFlag = 0x0002, + kNV_glsl_shader_GrVkExtensionFlag = 0x0004, + kKHR_surface_GrVkExtensionFlag = 0x0008, + kEXT_discard_rectangles_GrVkExtensionFlag = 0x0010, + kKHR_swapchain_GrVkExtensionFlag = 0x0020, + kKHR_win32_surface_GrVkExtensionFlag = 0x0040, + kKHR_android_surface_GrVkExtensionFlag = 0x0080, + kKHR_xcb_surface_GrVkExtensionFlag = 0x0100, }; enum GrVkFeatureFlags { diff --git a/include/gpu/vk/GrVkDefines.h b/include/gpu/vk/GrVkDefines.h index 0bc6fb0343..5873f9924f 100644 --- a/include/gpu/vk/GrVkDefines.h +++ b/include/gpu/vk/GrVkDefines.h @@ -38,6 +38,130 @@ #error "Vulkan header version is too low" #endif -#endif +#ifndef VK_KHR_get_physical_device_properties2 -#endif +// 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 diff --git a/include/gpu/vk/GrVkInterface.h b/include/gpu/vk/GrVkInterface.h index 05ce561829..a56df31cb2 100644 --- a/include/gpu/vk/GrVkInterface.h +++ b/include/gpu/vk/GrVkInterface.h @@ -203,9 +203,13 @@ public: VkPtr<PFN_vkCmdEndRenderPass> fCmdEndRenderPass; VkPtr<PFN_vkCmdExecuteCommands> fCmdExecuteCommands; + VkPtr<PFN_vkGetPhysicalDeviceProperties2KHR> fGetPhysicalDeviceProperties2KHR; + VkPtr<PFN_vkCreateDebugReportCallbackEXT> fCreateDebugReportCallbackEXT; VkPtr<PFN_vkDebugReportMessageEXT> fDebugReportMessageEXT; VkPtr<PFN_vkDestroyDebugReportCallbackEXT> fDestroyDebugReportCallbackEXT; + + VkPtr<PFN_vkCmdSetDiscardRectangleEXT> fCmdSetDiscardRectangleEXT; } fFunctions; }; |