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 /src/gpu/vk/GrVkCaps.cpp | |
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 'src/gpu/vk/GrVkCaps.cpp')
-rw-r--r-- | src/gpu/vk/GrVkCaps.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp index 2b24205af8..9f635e2f20 100644 --- a/src/gpu/vk/GrVkCaps.cpp +++ b/src/gpu/vk/GrVkCaps.cpp @@ -75,9 +75,30 @@ bool GrVkCaps::initDescForDstCopy(const GrRenderTargetProxy* src, GrSurfaceDesc* void GrVkCaps::init(const GrContextOptions& contextOptions, const GrVkInterface* vkInterface, VkPhysicalDevice physDev, uint32_t featureFlags, uint32_t extensionFlags) { + VkPhysicalDeviceProperties2KHR khrProperties; + if (SkToBool(extensionFlags & kKHR_get_physical_device_properties2_GrVkExtensionFlag)) { + khrProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR; + khrProperties.pNext = nullptr; + + VkPhysicalDeviceDiscardRectanglePropertiesEXT discardRectsProperties; + if (SkToBool(extensionFlags & kEXT_discard_rectangles_GrVkExtensionFlag)) { + discardRectsProperties.sType = + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT; + discardRectsProperties.pNext = khrProperties.pNext; + khrProperties.pNext = &discardRectsProperties; + } + + GR_VK_CALL(vkInterface, GetPhysicalDeviceProperties2KHR(physDev, &khrProperties)); + + if (SkToBool(extensionFlags & kEXT_discard_rectangles_GrVkExtensionFlag)) { + fWindowRectsSupport = WindowRectsSupport::kDrawOnly; + fMaxWindowRectangles = discardRectsProperties.maxDiscardRectangles; + } + } else { + GR_VK_CALL(vkInterface, GetPhysicalDeviceProperties(physDev, &khrProperties.properties)); + } - VkPhysicalDeviceProperties properties; - GR_VK_CALL(vkInterface, GetPhysicalDeviceProperties(physDev, &properties)); + const VkPhysicalDeviceProperties& properties = khrProperties.properties; VkPhysicalDeviceMemoryProperties memoryProperties; GR_VK_CALL(vkInterface, GetPhysicalDeviceMemoryProperties(physDev, &memoryProperties)); |