Skip to content

Commit

Permalink
Remove use of GrVkInterface in vulkan. (flutter#5764)
Browse files Browse the repository at this point in the history
  • Loading branch information
egdaniel authored and brianosman committed Jul 17, 2018
1 parent 45b6f0f commit 4eb2a5e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
17 changes: 17 additions & 0 deletions vulkan/vulkan_proc_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,21 @@ sk_sp<GrVkInterface> VulkanProcTable::CreateSkiaInterface() const {
0 /* extensions */);
}

GrVkGetProc VulkanProcTable::CreateSkiaGetProc() const {
if (!IsValid()) {
return nullptr;
}

return [this](const char* proc_name, VkInstance instance, VkDevice device) {
if (device != VK_NULL_HANDLE) {
auto result = AcquireProc(proc_name, {device, nullptr});
if (result != nullptr) {
return result;
}
}

return AcquireProc(proc_name, {instance, nullptr});
};
}

} // namespace vulkan
3 changes: 3 additions & 0 deletions vulkan/vulkan_proc_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "lib/fxl/memory/ref_counted.h"
#include "lib/fxl/memory/ref_ptr.h"
#include "third_party/skia/include/core/SkRefCnt.h"
#include "third_party/skia/include/gpu/vk/GrVkBackendContext.h"
#include "third_party/skia/include/gpu/vk/GrVkInterface.h"

namespace vulkan {
Expand Down Expand Up @@ -59,7 +60,9 @@ class VulkanProcTable : public fxl::RefCountedThreadSafe<VulkanProcTable> {

bool SetupDeviceProcAddresses(const VulkanHandle<VkDevice>& device);

// CreateSkiaInterface is deprecated.
sk_sp<GrVkInterface> CreateSkiaInterface() const;
GrVkGetProc CreateSkiaGetProc() const;

#define DEFINE_PROC(name) Proc<PFN_vk##name> name;

Expand Down
7 changes: 3 additions & 4 deletions vulkan/vulkan_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "flutter/vulkan/vulkan_surface.h"
#include "flutter/vulkan/vulkan_swapchain.h"
#include "third_party/skia/include/gpu/GrContext.h"
#include "third_party/skia/include/gpu/vk/GrVkInterface.h"

namespace vulkan {

Expand Down Expand Up @@ -117,9 +116,9 @@ bool VulkanWindow::CreateSkiaGrContext() {
}

bool VulkanWindow::CreateSkiaBackendContext(GrVkBackendContext* context) {
auto interface = vk->CreateSkiaInterface();
auto getProc = vk->CreateSkiaGetProc();

if (interface == nullptr || !interface->validate(0)) {
if (getProc == nullptr) {
return false;
}

Expand All @@ -138,7 +137,7 @@ bool VulkanWindow::CreateSkiaBackendContext(GrVkBackendContext* context) {
kKHR_swapchain_GrVkExtensionFlag |
surface_->GetNativeSurface().GetSkiaExtensionName();
context->fFeatures = skia_features;
context->fInterface.reset(interface.release());
context->fGetProc = std::move(getProc);
context->fOwnsInstanceAndDevice = false;
return true;
}
Expand Down

0 comments on commit 4eb2a5e

Please sign in to comment.