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

Commit eef5247

Browse files
authored
[Impeller] Make DeviceHolder follow convention for backend specific utilities. (#51300)
Utilities below the HAL that are backend specific have the VK (in case of Vulkan) suffix. The only class that doesn't follow this convention is/was DeviceHolder. This caused some confusion when reading code leading to wondering what a device holder above the HAL was supposed to do/mean. Adds the VK suffix to device holder with a docstring. Also adds the file the source set as it was missing. No change in functionality. Just a rename of an existing class.
1 parent 7541e90 commit eef5247

29 files changed

+90
-83
lines changed

ci/licenses_golden/licenses_flutter

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38103,7 +38103,7 @@ ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/descriptor_pool_vk.cc
3810338103
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/descriptor_pool_vk.h + ../../../flutter/LICENSE
3810438104
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/device_buffer_vk.cc + ../../../flutter/LICENSE
3810538105
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/device_buffer_vk.h + ../../../flutter/LICENSE
38106-
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/device_holder.h + ../../../flutter/LICENSE
38106+
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/device_holder_vk.h + ../../../flutter/LICENSE
3810738107
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/fence_waiter_vk.cc + ../../../flutter/LICENSE
3810838108
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/fence_waiter_vk.h + ../../../flutter/LICENSE
3810938109
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/formats_vk.cc + ../../../flutter/LICENSE
@@ -40954,7 +40954,7 @@ FILE: ../../../flutter/impeller/renderer/backend/vulkan/descriptor_pool_vk.cc
4095440954
FILE: ../../../flutter/impeller/renderer/backend/vulkan/descriptor_pool_vk.h
4095540955
FILE: ../../../flutter/impeller/renderer/backend/vulkan/device_buffer_vk.cc
4095640956
FILE: ../../../flutter/impeller/renderer/backend/vulkan/device_buffer_vk.h
40957-
FILE: ../../../flutter/impeller/renderer/backend/vulkan/device_holder.h
40957+
FILE: ../../../flutter/impeller/renderer/backend/vulkan/device_holder_vk.h
4095840958
FILE: ../../../flutter/impeller/renderer/backend/vulkan/fence_waiter_vk.cc
4095940959
FILE: ../../../flutter/impeller/renderer/backend/vulkan/fence_waiter_vk.h
4096040960
FILE: ../../../flutter/impeller/renderer/backend/vulkan/formats_vk.cc

impeller/renderer/backend/vulkan/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ impeller_component("vulkan") {
6464
"descriptor_pool_vk.h",
6565
"device_buffer_vk.cc",
6666
"device_buffer_vk.h",
67+
"device_holder_vk.h",
6768
"fence_waiter_vk.cc",
6869
"fence_waiter_vk.h",
6970
"formats_vk.cc",

impeller/renderer/backend/vulkan/allocator_vk.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static PoolVMA CreateBufferPool(VmaAllocator allocator) {
9494
AllocatorVK::AllocatorVK(std::weak_ptr<Context> context,
9595
uint32_t vulkan_api_version,
9696
const vk::PhysicalDevice& physical_device,
97-
const std::shared_ptr<DeviceHolder>& device_holder,
97+
const std::shared_ptr<DeviceHolderVK>& device_holder,
9898
const vk::Instance& instance,
9999
const CapabilitiesVK& capabilities)
100100
: context_(std::move(context)), device_holder_(device_holder) {

impeller/renderer/backend/vulkan/allocator_vk.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include "impeller/core/allocator.h"
1111
#include "impeller/renderer/backend/vulkan/context_vk.h"
1212
#include "impeller/renderer/backend/vulkan/device_buffer_vk.h"
13-
#include "impeller/renderer/backend/vulkan/device_holder.h"
13+
#include "impeller/renderer/backend/vulkan/device_holder_vk.h"
1414
#include "impeller/renderer/backend/vulkan/vk.h"
1515

1616
#include <array>
@@ -33,7 +33,7 @@ class AllocatorVK final : public Allocator {
3333
UniqueAllocatorVMA allocator_;
3434
UniquePoolVMA staging_buffer_pool_;
3535
std::weak_ptr<Context> context_;
36-
std::weak_ptr<DeviceHolder> device_holder_;
36+
std::weak_ptr<DeviceHolderVK> device_holder_;
3737
ISize max_texture_size_;
3838
bool is_valid_ = false;
3939
bool supports_memoryless_textures_ = false;
@@ -44,7 +44,7 @@ class AllocatorVK final : public Allocator {
4444
AllocatorVK(std::weak_ptr<Context> context,
4545
uint32_t vulkan_api_version,
4646
const vk::PhysicalDevice& physical_device,
47-
const std::shared_ptr<DeviceHolder>& device_holder,
47+
const std::shared_ptr<DeviceHolderVK>& device_holder,
4848
const vk::Instance& instance,
4949
const CapabilitiesVK& capabilities);
5050

impeller/renderer/backend/vulkan/command_encoder_vk.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ std::shared_ptr<CommandEncoderVK> CommandEncoderFactoryVK::Create() {
6666
}
6767

6868
CommandEncoderVK::CommandEncoderVK(
69-
std::weak_ptr<const DeviceHolder> device_holder,
69+
std::weak_ptr<const DeviceHolderVK> device_holder,
7070
std::shared_ptr<TrackedObjectsVK> tracked_objects,
7171
const std::shared_ptr<QueueVK>& queue,
7272
std::shared_ptr<FenceWaiterVK> fence_waiter)

impeller/renderer/backend/vulkan/command_encoder_vk.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "impeller/renderer/backend/vulkan/command_queue_vk.h"
1414
#include "impeller/renderer/backend/vulkan/context_vk.h"
1515
#include "impeller/renderer/backend/vulkan/descriptor_pool_vk.h"
16-
#include "impeller/renderer/backend/vulkan/device_holder.h"
16+
#include "impeller/renderer/backend/vulkan/device_holder_vk.h"
1717
#include "impeller/renderer/backend/vulkan/queue_vk.h"
1818
#include "impeller/renderer/backend/vulkan/shared_object_vk.h"
1919
#include "impeller/renderer/backend/vulkan/vk.h"
@@ -52,7 +52,7 @@ class CommandEncoderVK {
5252
using SubmitCallback = std::function<void(bool)>;
5353

5454
// Visible for testing.
55-
CommandEncoderVK(std::weak_ptr<const DeviceHolder> device_holder,
55+
CommandEncoderVK(std::weak_ptr<const DeviceHolderVK> device_holder,
5656
std::shared_ptr<TrackedObjectsVK> tracked_objects,
5757
const std::shared_ptr<QueueVK>& queue,
5858
std::shared_ptr<FenceWaiterVK> fence_waiter);
@@ -91,7 +91,7 @@ class CommandEncoderVK {
9191
friend class ContextVK;
9292
friend class CommandQueueVK;
9393

94-
std::weak_ptr<const DeviceHolder> device_holder_;
94+
std::weak_ptr<const DeviceHolderVK> device_holder_;
9595
std::shared_ptr<TrackedObjectsVK> tracked_objects_;
9696
std::shared_ptr<QueueVK> queue_;
9797
const std::shared_ptr<FenceWaiterVK> fence_waiter_;

impeller/renderer/backend/vulkan/compute_pipeline_vk.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
namespace impeller {
88

99
ComputePipelineVK::ComputePipelineVK(
10-
std::weak_ptr<DeviceHolder> device_holder,
10+
std::weak_ptr<DeviceHolderVK> device_holder,
1111
std::weak_ptr<PipelineLibrary> library,
1212
const ComputePipelineDescriptor& desc,
1313
vk::UniquePipeline pipeline,
@@ -22,7 +22,7 @@ ComputePipelineVK::ComputePipelineVK(
2222
}
2323

2424
ComputePipelineVK::~ComputePipelineVK() {
25-
std::shared_ptr<DeviceHolder> device_holder = device_holder_.lock();
25+
std::shared_ptr<DeviceHolderVK> device_holder = device_holder_.lock();
2626
if (device_holder) {
2727
descriptor_set_layout_.reset();
2828
layout_.reset();

impeller/renderer/backend/vulkan/compute_pipeline_vk.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#include "flutter/fml/macros.h"
1111
#include "impeller/base/backend_cast.h"
12-
#include "impeller/renderer/backend/vulkan/device_holder.h"
12+
#include "impeller/renderer/backend/vulkan/device_holder_vk.h"
1313
#include "impeller/renderer/backend/vulkan/vk.h"
1414
#include "impeller/renderer/pipeline.h"
1515

@@ -20,7 +20,7 @@ class ComputePipelineVK final
2020
public BackendCast<ComputePipelineVK,
2121
Pipeline<ComputePipelineDescriptor>> {
2222
public:
23-
ComputePipelineVK(std::weak_ptr<DeviceHolder> device_holder,
23+
ComputePipelineVK(std::weak_ptr<DeviceHolderVK> device_holder,
2424
std::weak_ptr<PipelineLibrary> library,
2525
const ComputePipelineDescriptor& desc,
2626
vk::UniquePipeline pipeline,
@@ -39,7 +39,7 @@ class ComputePipelineVK final
3939
private:
4040
friend class PipelineLibraryVK;
4141

42-
std::weak_ptr<DeviceHolder> device_holder_;
42+
std::weak_ptr<DeviceHolderVK> device_holder_;
4343
vk::UniquePipeline pipeline_;
4444
vk::UniquePipelineLayout layout_;
4545
vk::UniqueDescriptorSetLayout descriptor_set_layout_;

impeller/renderer/backend/vulkan/context_vk.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include "impeller/base/backend_cast.h"
1515
#include "impeller/core/formats.h"
1616
#include "impeller/renderer/backend/vulkan/command_pool_vk.h"
17-
#include "impeller/renderer/backend/vulkan/device_holder.h"
17+
#include "impeller/renderer/backend/vulkan/device_holder_vk.h"
1818
#include "impeller/renderer/backend/vulkan/pipeline_library_vk.h"
1919
#include "impeller/renderer/backend/vulkan/queue_vk.h"
2020
#include "impeller/renderer/backend/vulkan/sampler_library_vk.h"
@@ -130,7 +130,7 @@ class ContextVK final : public Context,
130130
return true;
131131
}
132132

133-
std::shared_ptr<DeviceHolder> GetDeviceHolder() const {
133+
std::shared_ptr<DeviceHolderVK> GetDeviceHolder() const {
134134
return device_holder_;
135135
}
136136

@@ -164,7 +164,7 @@ class ContextVK final : public Context,
164164
void InitializeCommonlyUsedShadersIfNeeded() const override;
165165

166166
private:
167-
struct DeviceHolderImpl : public DeviceHolder {
167+
struct DeviceHolderImpl : public DeviceHolderVK {
168168
// |DeviceHolder|
169169
const vk::Device& GetDevice() const override { return device.get(); }
170170
// |DeviceHolder|

impeller/renderer/backend/vulkan/device_holder.h

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)