Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -38103,7 +38103,7 @@ ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/descriptor_pool_vk.cc
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/descriptor_pool_vk.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/device_buffer_vk.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/device_buffer_vk.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/device_holder.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/device_holder_vk.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/fence_waiter_vk.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/fence_waiter_vk.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/formats_vk.cc + ../../../flutter/LICENSE
Expand Down Expand Up @@ -40954,7 +40954,7 @@ FILE: ../../../flutter/impeller/renderer/backend/vulkan/descriptor_pool_vk.cc
FILE: ../../../flutter/impeller/renderer/backend/vulkan/descriptor_pool_vk.h
FILE: ../../../flutter/impeller/renderer/backend/vulkan/device_buffer_vk.cc
FILE: ../../../flutter/impeller/renderer/backend/vulkan/device_buffer_vk.h
FILE: ../../../flutter/impeller/renderer/backend/vulkan/device_holder.h
FILE: ../../../flutter/impeller/renderer/backend/vulkan/device_holder_vk.h
FILE: ../../../flutter/impeller/renderer/backend/vulkan/fence_waiter_vk.cc
FILE: ../../../flutter/impeller/renderer/backend/vulkan/fence_waiter_vk.h
FILE: ../../../flutter/impeller/renderer/backend/vulkan/formats_vk.cc
Expand Down
1 change: 1 addition & 0 deletions impeller/renderer/backend/vulkan/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ impeller_component("vulkan") {
"descriptor_pool_vk.h",
"device_buffer_vk.cc",
"device_buffer_vk.h",
"device_holder_vk.h",
"fence_waiter_vk.cc",
"fence_waiter_vk.h",
"formats_vk.cc",
Expand Down
2 changes: 1 addition & 1 deletion impeller/renderer/backend/vulkan/allocator_vk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static PoolVMA CreateBufferPool(VmaAllocator allocator) {
AllocatorVK::AllocatorVK(std::weak_ptr<Context> context,
uint32_t vulkan_api_version,
const vk::PhysicalDevice& physical_device,
const std::shared_ptr<DeviceHolder>& device_holder,
const std::shared_ptr<DeviceHolderVK>& device_holder,
const vk::Instance& instance,
const CapabilitiesVK& capabilities)
: context_(std::move(context)), device_holder_(device_holder) {
Expand Down
6 changes: 3 additions & 3 deletions impeller/renderer/backend/vulkan/allocator_vk.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "impeller/core/allocator.h"
#include "impeller/renderer/backend/vulkan/context_vk.h"
#include "impeller/renderer/backend/vulkan/device_buffer_vk.h"
#include "impeller/renderer/backend/vulkan/device_holder.h"
#include "impeller/renderer/backend/vulkan/device_holder_vk.h"
#include "impeller/renderer/backend/vulkan/vk.h"

#include <array>
Expand All @@ -33,7 +33,7 @@ class AllocatorVK final : public Allocator {
UniqueAllocatorVMA allocator_;
UniquePoolVMA staging_buffer_pool_;
std::weak_ptr<Context> context_;
std::weak_ptr<DeviceHolder> device_holder_;
std::weak_ptr<DeviceHolderVK> device_holder_;
ISize max_texture_size_;
bool is_valid_ = false;
bool supports_memoryless_textures_ = false;
Expand All @@ -44,7 +44,7 @@ class AllocatorVK final : public Allocator {
AllocatorVK(std::weak_ptr<Context> context,
uint32_t vulkan_api_version,
const vk::PhysicalDevice& physical_device,
const std::shared_ptr<DeviceHolder>& device_holder,
const std::shared_ptr<DeviceHolderVK>& device_holder,
const vk::Instance& instance,
const CapabilitiesVK& capabilities);

Expand Down
2 changes: 1 addition & 1 deletion impeller/renderer/backend/vulkan/command_encoder_vk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ std::shared_ptr<CommandEncoderVK> CommandEncoderFactoryVK::Create() {
}

CommandEncoderVK::CommandEncoderVK(
std::weak_ptr<const DeviceHolder> device_holder,
std::weak_ptr<const DeviceHolderVK> device_holder,
std::shared_ptr<TrackedObjectsVK> tracked_objects,
const std::shared_ptr<QueueVK>& queue,
std::shared_ptr<FenceWaiterVK> fence_waiter)
Expand Down
6 changes: 3 additions & 3 deletions impeller/renderer/backend/vulkan/command_encoder_vk.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "impeller/renderer/backend/vulkan/command_queue_vk.h"
#include "impeller/renderer/backend/vulkan/context_vk.h"
#include "impeller/renderer/backend/vulkan/descriptor_pool_vk.h"
#include "impeller/renderer/backend/vulkan/device_holder.h"
#include "impeller/renderer/backend/vulkan/device_holder_vk.h"
#include "impeller/renderer/backend/vulkan/queue_vk.h"
#include "impeller/renderer/backend/vulkan/shared_object_vk.h"
#include "impeller/renderer/backend/vulkan/vk.h"
Expand Down Expand Up @@ -52,7 +52,7 @@ class CommandEncoderVK {
using SubmitCallback = std::function<void(bool)>;

// Visible for testing.
CommandEncoderVK(std::weak_ptr<const DeviceHolder> device_holder,
CommandEncoderVK(std::weak_ptr<const DeviceHolderVK> device_holder,
std::shared_ptr<TrackedObjectsVK> tracked_objects,
const std::shared_ptr<QueueVK>& queue,
std::shared_ptr<FenceWaiterVK> fence_waiter);
Expand Down Expand Up @@ -91,7 +91,7 @@ class CommandEncoderVK {
friend class ContextVK;
friend class CommandQueueVK;

std::weak_ptr<const DeviceHolder> device_holder_;
std::weak_ptr<const DeviceHolderVK> device_holder_;
std::shared_ptr<TrackedObjectsVK> tracked_objects_;
std::shared_ptr<QueueVK> queue_;
const std::shared_ptr<FenceWaiterVK> fence_waiter_;
Expand Down
4 changes: 2 additions & 2 deletions impeller/renderer/backend/vulkan/compute_pipeline_vk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace impeller {

ComputePipelineVK::ComputePipelineVK(
std::weak_ptr<DeviceHolder> device_holder,
std::weak_ptr<DeviceHolderVK> device_holder,
std::weak_ptr<PipelineLibrary> library,
const ComputePipelineDescriptor& desc,
vk::UniquePipeline pipeline,
Expand All @@ -22,7 +22,7 @@ ComputePipelineVK::ComputePipelineVK(
}

ComputePipelineVK::~ComputePipelineVK() {
std::shared_ptr<DeviceHolder> device_holder = device_holder_.lock();
std::shared_ptr<DeviceHolderVK> device_holder = device_holder_.lock();
if (device_holder) {
descriptor_set_layout_.reset();
layout_.reset();
Expand Down
6 changes: 3 additions & 3 deletions impeller/renderer/backend/vulkan/compute_pipeline_vk.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "flutter/fml/macros.h"
#include "impeller/base/backend_cast.h"
#include "impeller/renderer/backend/vulkan/device_holder.h"
#include "impeller/renderer/backend/vulkan/device_holder_vk.h"
#include "impeller/renderer/backend/vulkan/vk.h"
#include "impeller/renderer/pipeline.h"

Expand All @@ -20,7 +20,7 @@ class ComputePipelineVK final
public BackendCast<ComputePipelineVK,
Pipeline<ComputePipelineDescriptor>> {
public:
ComputePipelineVK(std::weak_ptr<DeviceHolder> device_holder,
ComputePipelineVK(std::weak_ptr<DeviceHolderVK> device_holder,
std::weak_ptr<PipelineLibrary> library,
const ComputePipelineDescriptor& desc,
vk::UniquePipeline pipeline,
Expand All @@ -39,7 +39,7 @@ class ComputePipelineVK final
private:
friend class PipelineLibraryVK;

std::weak_ptr<DeviceHolder> device_holder_;
std::weak_ptr<DeviceHolderVK> device_holder_;
vk::UniquePipeline pipeline_;
vk::UniquePipelineLayout layout_;
vk::UniqueDescriptorSetLayout descriptor_set_layout_;
Expand Down
6 changes: 3 additions & 3 deletions impeller/renderer/backend/vulkan/context_vk.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "impeller/base/backend_cast.h"
#include "impeller/core/formats.h"
#include "impeller/renderer/backend/vulkan/command_pool_vk.h"
#include "impeller/renderer/backend/vulkan/device_holder.h"
#include "impeller/renderer/backend/vulkan/device_holder_vk.h"
#include "impeller/renderer/backend/vulkan/pipeline_library_vk.h"
#include "impeller/renderer/backend/vulkan/queue_vk.h"
#include "impeller/renderer/backend/vulkan/sampler_library_vk.h"
Expand Down Expand Up @@ -130,7 +130,7 @@ class ContextVK final : public Context,
return true;
}

std::shared_ptr<DeviceHolder> GetDeviceHolder() const {
std::shared_ptr<DeviceHolderVK> GetDeviceHolder() const {
return device_holder_;
}

Expand Down Expand Up @@ -164,7 +164,7 @@ class ContextVK final : public Context,
void InitializeCommonlyUsedShadersIfNeeded() const override;

private:
struct DeviceHolderImpl : public DeviceHolder {
struct DeviceHolderImpl : public DeviceHolderVK {
// |DeviceHolder|
const vk::Device& GetDevice() const override { return device.get(); }
// |DeviceHolder|
Expand Down
23 changes: 0 additions & 23 deletions impeller/renderer/backend/vulkan/device_holder.h

This file was deleted.

29 changes: 29 additions & 0 deletions impeller/renderer/backend/vulkan/device_holder_vk.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_DEVICE_HOLDER_VK_H_
#define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_DEVICE_HOLDER_VK_H_

#include "impeller/renderer/backend/vulkan/vk.h" // IWYU pragma: keep.

namespace impeller {

//------------------------------------------------------------------------------
/// @brief Holds a strong reference to the underlying logical Vulkan
/// device. This comes in handy when the context is being torn down
/// and the various components on different threads may need to
/// orchestrate safe shutdown.
///
class DeviceHolderVK {
public:
virtual ~DeviceHolderVK() = default;

virtual const vk::Device& GetDevice() const = 0;

virtual const vk::PhysicalDevice& GetPhysicalDevice() const = 0;
};

} // namespace impeller

#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_DEVICE_HOLDER_VK_H_
2 changes: 1 addition & 1 deletion impeller/renderer/backend/vulkan/fence_waiter_vk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class WaitSetEntry {
WaitSetEntry& operator=(WaitSetEntry&&) = delete;
};

FenceWaiterVK::FenceWaiterVK(std::weak_ptr<DeviceHolder> device_holder)
FenceWaiterVK::FenceWaiterVK(std::weak_ptr<DeviceHolderVK> device_holder)
: device_holder_(std::move(device_holder)) {
waiter_thread_ = std::make_unique<std::thread>([&]() { Main(); });
}
Expand Down
6 changes: 3 additions & 3 deletions impeller/renderer/backend/vulkan/fence_waiter_vk.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "flutter/fml/closure.h"
#include "flutter/fml/macros.h"
#include "impeller/base/thread.h"
#include "impeller/renderer/backend/vulkan/device_holder.h"
#include "impeller/renderer/backend/vulkan/device_holder_vk.h"
#include "impeller/renderer/backend/vulkan/shared_object_vk.h"
#include "impeller/renderer/backend/vulkan/vk.h"

Expand All @@ -37,14 +37,14 @@ class FenceWaiterVK {
private:
friend class ContextVK;

std::weak_ptr<DeviceHolder> device_holder_;
std::weak_ptr<DeviceHolderVK> device_holder_;
std::unique_ptr<std::thread> waiter_thread_;
std::mutex wait_set_mutex_;
std::condition_variable wait_set_cv_;
WaitSet wait_set_;
bool terminate_ = false;

explicit FenceWaiterVK(std::weak_ptr<DeviceHolder> device_holder);
explicit FenceWaiterVK(std::weak_ptr<DeviceHolderVK> device_holder);

void Main();

Expand Down
2 changes: 1 addition & 1 deletion impeller/renderer/backend/vulkan/gpu_tracer_vk.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <thread>

#include "impeller/renderer/backend/vulkan/context_vk.h"
#include "impeller/renderer/backend/vulkan/device_holder.h"
#include "impeller/renderer/backend/vulkan/device_holder_vk.h"
#include "vulkan/vulkan_handles.hpp"

namespace impeller {
Expand Down
10 changes: 5 additions & 5 deletions impeller/renderer/backend/vulkan/pipeline_cache_vk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static std::unique_ptr<fml::Mapping> OpenCacheFile(
}

PipelineCacheVK::PipelineCacheVK(std::shared_ptr<const Capabilities> caps,
std::shared_ptr<DeviceHolder> device_holder,
std::shared_ptr<DeviceHolderVK> device_holder,
fml::UniqueFD cache_directory)
: caps_(std::move(caps)),
device_holder_(device_holder),
Expand Down Expand Up @@ -101,7 +101,7 @@ PipelineCacheVK::PipelineCacheVK(std::shared_ptr<const Capabilities> caps,
}

PipelineCacheVK::~PipelineCacheVK() {
std::shared_ptr<DeviceHolder> device_holder = device_holder_.lock();
std::shared_ptr<DeviceHolderVK> device_holder = device_holder_.lock();
if (device_holder) {
cache_.reset();
} else {
Expand All @@ -115,7 +115,7 @@ bool PipelineCacheVK::IsValid() const {

vk::UniquePipeline PipelineCacheVK::CreatePipeline(
const vk::GraphicsPipelineCreateInfo& info) {
std::shared_ptr<DeviceHolder> strong_device = device_holder_.lock();
std::shared_ptr<DeviceHolderVK> strong_device = device_holder_.lock();
if (!strong_device) {
return {};
}
Expand All @@ -131,7 +131,7 @@ vk::UniquePipeline PipelineCacheVK::CreatePipeline(

vk::UniquePipeline PipelineCacheVK::CreatePipeline(
const vk::ComputePipelineCreateInfo& info) {
std::shared_ptr<DeviceHolder> strong_device = device_holder_.lock();
std::shared_ptr<DeviceHolderVK> strong_device = device_holder_.lock();
if (!strong_device) {
return {};
}
Expand All @@ -146,7 +146,7 @@ vk::UniquePipeline PipelineCacheVK::CreatePipeline(
}

std::shared_ptr<fml::Mapping> PipelineCacheVK::CopyPipelineCacheData() const {
std::shared_ptr<DeviceHolder> strong_device = device_holder_.lock();
std::shared_ptr<DeviceHolderVK> strong_device = device_holder_.lock();
if (!strong_device) {
return nullptr;
}
Expand Down
6 changes: 3 additions & 3 deletions impeller/renderer/backend/vulkan/pipeline_cache_vk.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "flutter/fml/file.h"
#include "flutter/fml/macros.h"
#include "impeller/renderer/backend/vulkan/capabilities_vk.h"
#include "impeller/renderer/backend/vulkan/device_holder.h"
#include "impeller/renderer/backend/vulkan/device_holder_vk.h"

namespace impeller {

Expand All @@ -19,7 +19,7 @@ class PipelineCacheVK {
// at the time of executing `PipelineCacheVK` because of how `ContextVK` does
// initialization.
explicit PipelineCacheVK(std::shared_ptr<const Capabilities> caps,
std::shared_ptr<DeviceHolder> device_holder,
std::shared_ptr<DeviceHolderVK> device_holder,
fml::UniqueFD cache_directory);

~PipelineCacheVK();
Expand All @@ -36,7 +36,7 @@ class PipelineCacheVK {

private:
const std::shared_ptr<const Capabilities> caps_;
std::weak_ptr<DeviceHolder> device_holder_;
std::weak_ptr<DeviceHolderVK> device_holder_;
const fml::UniqueFD cache_directory_;
vk::UniquePipelineCache cache_;
bool is_valid_ = false;
Expand Down
4 changes: 2 additions & 2 deletions impeller/renderer/backend/vulkan/pipeline_library_vk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
namespace impeller {

PipelineLibraryVK::PipelineLibraryVK(
const std::shared_ptr<DeviceHolder>& device_holder,
const std::shared_ptr<DeviceHolderVK>& device_holder,
std::shared_ptr<const Capabilities> caps,
fml::UniqueFD cache_directory,
std::shared_ptr<fml::ConcurrentTaskRunner> worker_task_runner)
Expand Down Expand Up @@ -63,7 +63,7 @@ std::unique_ptr<ComputePipelineVK> PipelineLibraryVK::CreateComputePipeline(
return nullptr;
}

std::shared_ptr<DeviceHolder> strong_device = device_holder_.lock();
std::shared_ptr<DeviceHolderVK> strong_device = device_holder_.lock();
if (!strong_device) {
return nullptr;
}
Expand Down
4 changes: 2 additions & 2 deletions impeller/renderer/backend/vulkan/pipeline_library_vk.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class PipelineLibraryVK final
private:
friend ContextVK;

std::weak_ptr<DeviceHolder> device_holder_;
std::weak_ptr<DeviceHolderVK> device_holder_;
std::shared_ptr<PipelineCacheVK> pso_cache_;
std::shared_ptr<fml::ConcurrentTaskRunner> worker_task_runner_;
Mutex pipelines_mutex_;
Expand All @@ -51,7 +51,7 @@ class PipelineLibraryVK final
bool is_valid_ = false;

PipelineLibraryVK(
const std::shared_ptr<DeviceHolder>& device_holder,
const std::shared_ptr<DeviceHolderVK>& device_holder,
std::shared_ptr<const Capabilities> caps,
fml::UniqueFD cache_directory,
std::shared_ptr<fml::ConcurrentTaskRunner> worker_task_runner);
Expand Down
4 changes: 2 additions & 2 deletions impeller/renderer/backend/vulkan/pipeline_vk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ static vk::UniqueRenderPass CreateCompatRenderPassForPipeline(

std::unique_ptr<PipelineVK> PipelineVK::Create(
const PipelineDescriptor& desc,
const std::shared_ptr<DeviceHolder>& device_holder,
const std::shared_ptr<DeviceHolderVK>& device_holder,
const std::weak_ptr<PipelineLibrary>& weak_library,
std::shared_ptr<SamplerVK> immutable_sampler) {
TRACE_EVENT0("flutter", "PipelineVK::Create");
Expand Down Expand Up @@ -462,7 +462,7 @@ std::unique_ptr<PipelineVK> PipelineVK::Create(
return pipeline_vk;
}

PipelineVK::PipelineVK(std::weak_ptr<DeviceHolder> device_holder,
PipelineVK::PipelineVK(std::weak_ptr<DeviceHolderVK> device_holder,
std::weak_ptr<PipelineLibrary> library,
const PipelineDescriptor& desc,
vk::UniquePipeline pipeline,
Expand Down
Loading