Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 77444a7

Browse files
authored
Migrate VK calls of GrBackend* (#45325)
In https://skia-review.googlesource.com/c/skia/+/742797 Skia refactored GrBackend* to not require #ifdefs. This changes callsites in Flutter to use static functions instead of methods that were conditionally compiled on those classes. There should be no functional change.
1 parent cfc8823 commit 77444a7

File tree

5 files changed

+23
-17
lines changed

5 files changed

+23
-17
lines changed

shell/gpu/gpu_surface_vulkan.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "third_party/skia/include/gpu/GrBackendSurface.h"
1414
#include "third_party/skia/include/gpu/GrDirectContext.h"
1515
#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
16+
#include "third_party/skia/include/gpu/ganesh/vk/GrVkBackendSurface.h"
1617
#include "vulkan/vulkan_core.h"
1718

1819
namespace flutter {
@@ -115,10 +116,8 @@ sk_sp<SkSurface> GPUSurfaceVulkan::CreateSurfaceFromVulkanImage(
115116
.fSampleCount = 1,
116117
.fLevelCount = 1,
117118
};
118-
GrBackendTexture backend_texture(size.width(), //
119-
size.height(), //
120-
image_info //
121-
);
119+
auto backend_texture =
120+
GrBackendTextures::MakeVk(size.width(), size.height(), image_info);
122121

123122
SkSurfaceProps surface_properties(0, kUnknown_SkPixelGeometry);
124123

shell/platform/embedder/embedder.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ extern const intptr_t kPlatformStrongDillSize;
9494
#endif // IMPELLER_SUPPORTS_RENDERING
9595
#endif // SHELL_ENABLE_METAL
9696

97+
#ifdef SHELL_ENABLE_VULKAN
98+
#include "third_party/skia/include/gpu/ganesh/vk/GrVkBackendSurface.h"
99+
#endif // SHELL_ENABLE_VULKAN
100+
97101
const int32_t kFlutterSemanticsNodeIdBatchEnd = -1;
98102
const int32_t kFlutterSemanticsCustomActionIdBatchEnd = -1;
99103

@@ -1105,10 +1109,8 @@ static sk_sp<SkSurface> MakeSkSurfaceFromBackingStore(
11051109
.fSampleCount = 1,
11061110
.fLevelCount = 1,
11071111
};
1108-
GrBackendTexture backend_texture(config.size.width, //
1109-
config.size.height, //
1110-
image_info //
1111-
);
1112+
auto backend_texture = GrBackendTextures::MakeVk(
1113+
config.size.width, config.size.height, image_info);
11121114

11131115
SkSurfaceProps surface_properties(0, kUnknown_SkPixelGeometry);
11141116

shell/platform/embedder/tests/embedder_test_backingstore_producer.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
#include <memory>
2222
#include <utility>
2323

24+
#ifdef SHELL_ENABLE_VULKAN
25+
#include "third_party/skia/include/gpu/ganesh/vk/GrVkBackendSurface.h"
26+
#endif // SHELL_ENABLE_VULKAN
27+
2428
// TODO(zanderso): https://github.com/flutter/flutter/issues/127701
2529
// NOLINTBEGIN(bugprone-unchecked-optional-access)
2630

@@ -329,8 +333,8 @@ bool EmbedderTestBackingStoreProducer::CreateVulkanImage(
329333
.fSampleCount = 1,
330334
.fLevelCount = 1,
331335
};
332-
GrBackendTexture backend_texture(surface_size.width(), surface_size.height(),
333-
image_info);
336+
auto backend_texture = GrBackendTextures::MakeVk(
337+
surface_size.width(), surface_size.height(), image_info);
334338

335339
SkSurfaceProps surface_properties(0, kUnknown_SkPixelGeometry);
336340

testing/test_vulkan_surface.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "third_party/skia/include/core/SkSurfaceProps.h"
1414
#include "third_party/skia/include/gpu/GrBackendSurface.h"
1515
#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
16+
#include "third_party/skia/include/gpu/ganesh/vk/GrVkBackendSurface.h"
1617
#include "third_party/skia/include/gpu/vk/GrVkTypes.h"
1718

1819
namespace flutter {
@@ -43,10 +44,8 @@ std::unique_ptr<TestVulkanSurface> TestVulkanSurface::Create(
4344
.fSampleCount = 1,
4445
.fLevelCount = 1,
4546
};
46-
GrBackendTexture backend_texture(surface_size.width(), //
47-
surface_size.height(), //
48-
image_info //
49-
);
47+
auto backend_texture = GrBackendTextures::MakeVk(
48+
surface_size.width(), surface_size.height(), image_info);
5049

5150
SkSurfaceProps surface_properties(0, kUnknown_SkPixelGeometry);
5251

vulkan/vulkan_swapchain.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "third_party/skia/include/gpu/GrBackendSurface.h"
1212
#include "third_party/skia/include/gpu/GrDirectContext.h"
1313
#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
14+
#include "third_party/skia/include/gpu/ganesh/vk/GrVkBackendSurface.h"
1415
#include "third_party/skia/include/gpu/vk/GrVkTypes.h"
1516

1617
#include "vulkan_backbuffer.h"
@@ -242,8 +243,8 @@ sk_sp<SkSurface> VulkanSwapchain::CreateSkiaSurface(
242243
image_info.fLevelCount = 1;
243244

244245
// TODO(chinmaygarde): Setup the stencil buffer and the sampleCnt.
245-
GrBackendRenderTarget backend_render_target(size.fWidth, size.fHeight,
246-
image_info);
246+
auto backend_render_target =
247+
GrBackendRenderTargets::MakeVk(size.fWidth, size.fHeight, image_info);
247248
SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
248249

249250
return SkSurfaces::WrapBackendRenderTarget(
@@ -483,7 +484,8 @@ VulkanSwapchain::AcquireResult VulkanSwapchain::AcquireSurface() {
483484
FML_DLOG(INFO) << "Could not get backend render target.";
484485
return error;
485486
}
486-
backendRT.setVkImageLayout(destination_image_layout);
487+
GrBackendRenderTargets::SetVkImageLayout(&backendRT,
488+
destination_image_layout);
487489

488490
current_image_index_ = next_image_index;
489491

0 commit comments

Comments
 (0)