aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/vk/GrVkGpu.cpp24
-rw-r--r--src/gpu/vk/GrVkGpu.h3
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 {}