Nosksp backend context (flutter/engine#5544)
* Use new vulkan factory of GrContext which doens't take an sk_sp. * remove unneeded member.
This commit is contained in:
@@ -97,9 +97,9 @@ GrContext* VulkanWindow::GetSkiaGrContext() {
|
||||
}
|
||||
|
||||
bool VulkanWindow::CreateSkiaGrContext() {
|
||||
auto backend_context = CreateSkiaBackendContext();
|
||||
GrVkBackendContext backend_context;
|
||||
|
||||
if (backend_context == nullptr) {
|
||||
if (!CreateSkiaBackendContext(&backend_context)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -111,25 +111,23 @@ bool VulkanWindow::CreateSkiaGrContext() {
|
||||
|
||||
context->setResourceCacheLimits(kGrCacheMaxCount, kGrCacheMaxByteSize);
|
||||
|
||||
skia_vk_backend_context_ = backend_context;
|
||||
skia_gr_context_ = context;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
sk_sp<GrVkBackendContext> VulkanWindow::CreateSkiaBackendContext() {
|
||||
bool VulkanWindow::CreateSkiaBackendContext(GrVkBackendContext* context) {
|
||||
auto interface = vk->CreateSkiaInterface();
|
||||
|
||||
if (interface == nullptr || !interface->validate(0)) {
|
||||
return nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t skia_features = 0;
|
||||
if (!logical_device_->GetPhysicalDeviceFeaturesSkia(&skia_features)) {
|
||||
return nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
auto context = sk_make_sp<GrVkBackendContext>();
|
||||
context->fInstance = application_->GetInstance();
|
||||
context->fPhysicalDevice = logical_device_->GetPhysicalDeviceHandle();
|
||||
context->fDevice = logical_device_->GetHandle();
|
||||
@@ -142,7 +140,7 @@ sk_sp<GrVkBackendContext> VulkanWindow::CreateSkiaBackendContext() {
|
||||
context->fFeatures = skia_features;
|
||||
context->fInterface.reset(interface.release());
|
||||
context->fOwnsInstanceAndDevice = false;
|
||||
return context;
|
||||
return true;
|
||||
}
|
||||
|
||||
sk_sp<SkSurface> VulkanWindow::AcquireSurface() {
|
||||
|
||||
@@ -47,9 +47,6 @@ class VulkanWindow {
|
||||
private:
|
||||
bool valid_;
|
||||
fxl::RefPtr<VulkanProcTable> vk;
|
||||
// Note: The order of objects here is important because the
|
||||
// GrVkBackendContext assumes ownership of the device and instance handles.
|
||||
sk_sp<GrVkBackendContext> skia_vk_backend_context_;
|
||||
std::unique_ptr<VulkanApplication> application_;
|
||||
std::unique_ptr<VulkanDevice> logical_device_;
|
||||
std::unique_ptr<VulkanSurface> surface_;
|
||||
@@ -58,7 +55,7 @@ class VulkanWindow {
|
||||
|
||||
bool CreateSkiaGrContext();
|
||||
|
||||
sk_sp<GrVkBackendContext> CreateSkiaBackendContext();
|
||||
bool CreateSkiaBackendContext(GrVkBackendContext* context);
|
||||
|
||||
FXL_WARN_UNUSED_RESULT
|
||||
bool RecreateSwapchain();
|
||||
|
||||
Reference in New Issue
Block a user