diff options
author | Greg Daniel <egdaniel@google.com> | 2018-06-28 20:18:59 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-06-28 20:50:17 +0000 |
commit | a782dcb3c407a7e30d7c1263bf9965792088e786 (patch) | |
tree | 516d027239462f6b5f8cc56a4731f0e5e195c6d3 /include/gpu | |
parent | 2b3808eda2e5ce82b33c17a9e04f1f0fa441e397 (diff) |
Reland "Let client pass in full extension to GrVkBackendContext."
This reverts commit cb92b26e5ca6063bcf1a922109b8224e0b6eb4da.
Reason for revert: <INSERT REASONING HERE>
Original change's description:
> Revert "Let client pass in full extension to GrVkBackendContext."
>
> This reverts commit 45c9dab4c3ec43cedb28d1b8c08e166fe0c2e767.
>
> Reason for revert: fucshia uses GrVkBackendContext. Need to revert earlier changes
>
> Original change's description:
> > Let client pass in full extension to GrVkBackendContext.
> >
> > Bug: skia:
> > Change-Id: I772ab4ccbca0f4f7e7d429d6c421b07d97f0606f
> > Reviewed-on: https://skia-review.googlesource.com/131880
> > Reviewed-by: Jim Van Verth <jvanverth@google.com>
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
>
> TBR=egdaniel@google.com,jvanverth@google.com,bsalomon@google.com
>
> Change-Id: I1a765ff406c83cb234c3614b804fbed677d5a382
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:
> Reviewed-on: https://skia-review.googlesource.com/137901
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>
TBR=egdaniel@google.com,jvanverth@google.com,bsalomon@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: skia:
Change-Id: I0af797c51dde705473e9afaccb1d4b4423e8c41e
Reviewed-on: https://skia-review.googlesource.com/138302
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'include/gpu')
-rw-r--r-- | include/gpu/vk/GrVkBackendContext.h | 1 | ||||
-rw-r--r-- | include/gpu/vk/GrVkExtensions.h | 35 | ||||
-rw-r--r-- | include/gpu/vk/GrVkInterface.h | 21 |
3 files changed, 52 insertions, 5 deletions
diff --git a/include/gpu/vk/GrVkBackendContext.h b/include/gpu/vk/GrVkBackendContext.h index fe018e494f..3775c345ce 100644 --- a/include/gpu/vk/GrVkBackendContext.h +++ b/include/gpu/vk/GrVkBackendContext.h @@ -49,7 +49,6 @@ struct SK_API GrVkBackendContext { uint32_t fFeatures; sk_sp<const GrVkInterface> fInterface; sk_sp<GrVkMemoryAllocator> fMemoryAllocator; - // This is deprecated and should be set to false. The client is responsible for managing the // lifetime of the VkInstance and VkDevice objects. bool fOwnsInstanceAndDevice = false; diff --git a/include/gpu/vk/GrVkExtensions.h b/include/gpu/vk/GrVkExtensions.h new file mode 100644 index 0000000000..a6badcd33f --- /dev/null +++ b/include/gpu/vk/GrVkExtensions.h @@ -0,0 +1,35 @@ +/* + * 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 GrVkExtensions_DEFINED +#define GrVkExtensions_DEFINED + +#include "../private/SkTArray.h" +#include "SkString.h" + +/** + * Helper class that eats in an array of extensions strings for instance and device and allows for + * quicker querying if an extension is present. + */ +class GrVkExtensions { +public: + GrVkExtensions(uint32_t instanceExtensionCount, const char* const* instanceExtensions, + uint32_t deviceExtensionCount, const char* const* deviceExtensions); + // TODO: Remove once we remove the old fExtensions from GrVkBackendContext + GrVkExtensions(uint32_t extensionFlags); + + // TODO: Remove once we remove the old fExtensions from GrVkBackendContext + static void GetExtensionArrayFromFlags(uint32_t extensionFlags, + SkTArray<const char*>* extensions); + + bool hasExtension(const char[]) const; + +private: + SkTArray<SkString> fExtensionStrings; +}; + +#endif diff --git a/include/gpu/vk/GrVkInterface.h b/include/gpu/vk/GrVkInterface.h index 05ce561829..b4691e8994 100644 --- a/include/gpu/vk/GrVkInterface.h +++ b/include/gpu/vk/GrVkInterface.h @@ -11,6 +11,7 @@ #include "SkRefCnt.h" #include "vk/GrVkDefines.h" +#include "vk/GrVkExtensions.h" //////////////////////////////////////////////////////////////////////////////// @@ -50,17 +51,25 @@ public: GrVkInterface(GetProc getProc, VkInstance instance, VkDevice device, - uint32_t extensionFlags); + uint32_t instanceExtensionCount, + const char* const* instanceExtensions, + uint32_t deviceExtensionCount, + const char* const* deviceExtensions); - GrVkInterface(const GetInstanceProc&, - const GetDeviceProc&, + // TODO: This is deprecated. Remove onces clients have switch to new interface + GrVkInterface(GetProc getProc, VkInstance instance, VkDevice device, uint32_t extensionFlags); // Validates that the GrVkInterface supports its advertised standard. This means the necessary // function pointers have been initialized for Vulkan version. - bool validate(uint32_t extensionFlags) const; + bool validate() const; + + // This is deprecated since the extensions information is stored already on the GrVkInterface. + bool validate(uint32_t /*extensionFlags*/) const { + return this->validate(); + } /** * The function pointers are in a struct so that we can have a compiler generated assignment @@ -208,6 +217,10 @@ public: VkPtr<PFN_vkDestroyDebugReportCallbackEXT> fDestroyDebugReportCallbackEXT; } fFunctions; + GrVkExtensions fExtensions; + +private: + void init(GetProc getProc, VkInstance instance, VkDevice device); }; #endif |