diff options
author | Greg Daniel <egdaniel@google.com> | 2018-07-12 10:02:37 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-07-12 14:35:08 +0000 |
commit | c8cd45aaf43c5d044d8433d38c8332b1679eeadb (patch) | |
tree | 065475875fe983972a8a704ae340aa45bbe0150c /src/gpu/vk | |
parent | 77c138f2cd41cbb0e43985bb458f21455fead646 (diff) |
Generate GrVkInterface when we make the GrVkGpu.
Also add a GetProc function to the GrVkBackendContext which will be used
to create the GrVkInterface.
This change (and updating clients to use it), will allow us to move GrVkInterface
out of public which is needed to fix vulkan header issues.
Bug: skia:
Change-Id: Id8067943ae27cec8cad29fd31b05f0b8387412d4
Reviewed-on: https://skia-review.googlesource.com/140783
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/vk')
-rw-r--r-- | src/gpu/vk/GrVkGpu.cpp | 24 | ||||
-rw-r--r-- | src/gpu/vk/GrVkGpu.h | 3 |
2 files changed, 20 insertions, 7 deletions
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp index e576480129..689966a61c 100644 --- a/src/gpu/vk/GrVkGpu.cpp +++ b/src/gpu/vk/GrVkGpu.cpp @@ -57,20 +57,32 @@ sk_sp<GrGpu> GrVkGpu::Make(const GrVkBackendContext& backendContext, backendContext.fQueue == VK_NULL_HANDLE) { return nullptr; } - if (!backendContext.fInterface || - !backendContext.fInterface->validate(backendContext.fExtensions)) { + sk_sp<const GrVkInterface> interface; + if (backendContext.fGetProc) { + interface.reset(new GrVkInterface(backendContext.fGetProc, + backendContext.fInstance, + backendContext.fDevice, + backendContext.fExtensions)); + } else { + if (!backendContext.fInterface) { + return nullptr; + } + interface = backendContext.fInterface; + } + SkASSERT(interface); + if (!interface->validate(backendContext.fExtensions)) { return nullptr; } - return sk_sp<GrGpu>(new GrVkGpu(context, options, backendContext)); + return sk_sp<GrGpu>(new GrVkGpu(context, options, backendContext, interface)); } //////////////////////////////////////////////////////////////////////////////// GrVkGpu::GrVkGpu(GrContext* context, const GrContextOptions& options, - const GrVkBackendContext& backendContext) + const GrVkBackendContext& backendContext, sk_sp<const GrVkInterface> interface) : INHERITED(context) - , fInterface(std::move(backendContext.fInterface)) + , fInterface(std::move(interface)) , fMemoryAllocator(backendContext.fMemoryAllocator) , fInstance(backendContext.fInstance) , fDevice(backendContext.fDevice) @@ -82,7 +94,7 @@ GrVkGpu::GrVkGpu(GrContext* context, const GrContextOptions& options, if (!fMemoryAllocator) { // We were not given a memory allocator at creation fMemoryAllocator.reset(new GrVkAMDMemoryAllocator(backendContext.fPhysicalDevice, - fDevice, backendContext.fInterface)); + fDevice, fInterface)); } fCompiler = new SkSL::Compiler(); diff --git a/src/gpu/vk/GrVkGpu.h b/src/gpu/vk/GrVkGpu.h index 266c916cad..52b6ee759f 100644 --- a/src/gpu/vk/GrVkGpu.h +++ b/src/gpu/vk/GrVkGpu.h @@ -144,7 +144,8 @@ public: bool updateBuffer(GrVkBuffer* buffer, const void* src, VkDeviceSize offset, VkDeviceSize size); private: - GrVkGpu(GrContext*, const GrContextOptions&, const GrVkBackendContext& backendContext); + GrVkGpu(GrContext*, const GrContextOptions&, const GrVkBackendContext& backendContext, + sk_sp<const GrVkInterface>); void onResetContext(uint32_t resetBits) override {} |