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
2 changes: 1 addition & 1 deletion impeller/renderer/backend/gles/allocator_gles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace impeller {

AllocatorGLES::AllocatorGLES(ReactorGLES::Ref reactor)
AllocatorGLES::AllocatorGLES(std::shared_ptr<ReactorGLES> reactor)
: reactor_(std::move(reactor)), is_valid_(true) {}

// |Allocator|
Expand Down
4 changes: 2 additions & 2 deletions impeller/renderer/backend/gles/allocator_gles.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ class AllocatorGLES final : public Allocator {
private:
friend class ContextGLES;

ReactorGLES::Ref reactor_;
std::shared_ptr<ReactorGLES> reactor_;
bool is_valid_ = false;

explicit AllocatorGLES(ReactorGLES::Ref reactor);
explicit AllocatorGLES(std::shared_ptr<ReactorGLES> reactor);

// |Allocator|
bool IsValid() const;
Expand Down
2 changes: 1 addition & 1 deletion impeller/renderer/backend/gles/blit_pass_gles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

namespace impeller {

BlitPassGLES::BlitPassGLES(ReactorGLES::Ref reactor)
BlitPassGLES::BlitPassGLES(std::shared_ptr<ReactorGLES> reactor)
: reactor_(std::move(reactor)),
is_valid_(reactor_ && reactor_->IsValid()) {}

Expand Down
4 changes: 2 additions & 2 deletions impeller/renderer/backend/gles/blit_pass_gles.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ class BlitPassGLES final : public BlitPass,
friend class CommandBufferGLES;

std::vector<std::unique_ptr<BlitEncodeGLES>> commands_;
ReactorGLES::Ref reactor_;
std::shared_ptr<ReactorGLES> reactor_;
std::string label_;
bool is_valid_ = false;

explicit BlitPassGLES(ReactorGLES::Ref reactor);
explicit BlitPassGLES(std::shared_ptr<ReactorGLES> reactor);

// |BlitPass|
bool IsValid() const override;
Expand Down
2 changes: 1 addition & 1 deletion impeller/renderer/backend/gles/command_buffer_gles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace impeller {

CommandBufferGLES::CommandBufferGLES(std::weak_ptr<const Context> context,
ReactorGLES::Ref reactor)
std::shared_ptr<ReactorGLES> reactor)
: CommandBuffer(std::move(context)),
reactor_(std::move(reactor)),
is_valid_(reactor_ && reactor_->IsValid()) {}
Expand Down
4 changes: 2 additions & 2 deletions impeller/renderer/backend/gles/command_buffer_gles.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class CommandBufferGLES final : public CommandBuffer {
private:
friend class ContextGLES;

ReactorGLES::Ref reactor_;
std::shared_ptr<ReactorGLES> reactor_;
bool is_valid_ = false;

CommandBufferGLES(std::weak_ptr<const Context> context,
ReactorGLES::Ref reactor);
std::shared_ptr<ReactorGLES> reactor);

// |CommandBuffer|
void SetLabel(std::string_view label) const override;
Expand Down
2 changes: 1 addition & 1 deletion impeller/renderer/backend/gles/context_gles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Context::BackendType ContextGLES::GetBackendType() const {
return Context::BackendType::kOpenGLES;
}

const ReactorGLES::Ref& ContextGLES::GetReactor() const {
const std::shared_ptr<ReactorGLES>& ContextGLES::GetReactor() const {
return reactor_;
}

Expand Down
4 changes: 2 additions & 2 deletions impeller/renderer/backend/gles/context_gles.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ContextGLES final : public Context,
// |Context|
BackendType GetBackendType() const override;

const ReactorGLES::Ref& GetReactor() const;
const std::shared_ptr<ReactorGLES>& GetReactor() const;

std::optional<ReactorGLES::WorkerID> AddReactorWorker(
const std::shared_ptr<ReactorGLES::Worker>& worker);
Expand All @@ -44,7 +44,7 @@ class ContextGLES final : public Context,
std::shared_ptr<GPUTracerGLES> GetGPUTracer() const { return gpu_tracer_; }

private:
ReactorGLES::Ref reactor_;
std::shared_ptr<ReactorGLES> reactor_;
std::shared_ptr<ShaderLibraryGLES> shader_library_;
std::shared_ptr<PipelineLibraryGLES> pipeline_library_;
std::shared_ptr<SamplerLibraryGLES> sampler_library_;
Expand Down
2 changes: 1 addition & 1 deletion impeller/renderer/backend/gles/device_buffer_gles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
namespace impeller {

DeviceBufferGLES::DeviceBufferGLES(DeviceBufferDescriptor desc,
ReactorGLES::Ref reactor,
std::shared_ptr<ReactorGLES> reactor,
std::shared_ptr<Allocation> backing_store)
: DeviceBuffer(desc),
reactor_(std::move(reactor)),
Expand Down
4 changes: 2 additions & 2 deletions impeller/renderer/backend/gles/device_buffer_gles.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DeviceBufferGLES final
public BackendCast<DeviceBufferGLES, DeviceBuffer> {
public:
DeviceBufferGLES(DeviceBufferDescriptor desc,
ReactorGLES::Ref reactor,
std::shared_ptr<ReactorGLES> reactor,
std::shared_ptr<Allocation> backing_store);

// |DeviceBuffer|
Expand All @@ -41,7 +41,7 @@ class DeviceBufferGLES final
void Flush(std::optional<Range> range = std::nullopt) const override;

private:
ReactorGLES::Ref reactor_;
std::shared_ptr<ReactorGLES> reactor_;
HandleGLES handle_;
mutable std::shared_ptr<Allocation> backing_store_;
mutable std::optional<Range> dirty_range_ = std::nullopt;
Expand Down
2 changes: 1 addition & 1 deletion impeller/renderer/backend/gles/pipeline_gles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace impeller {

PipelineGLES::PipelineGLES(ReactorGLES::Ref reactor,
PipelineGLES::PipelineGLES(std::shared_ptr<ReactorGLES> reactor,
std::weak_ptr<PipelineLibrary> library,
const PipelineDescriptor& desc,
std::shared_ptr<UniqueHandleGLES> handle)
Expand Down
4 changes: 2 additions & 2 deletions impeller/renderer/backend/gles/pipeline_gles.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ class PipelineGLES final
private:
friend PipelineLibraryGLES;

ReactorGLES::Ref reactor_;
std::shared_ptr<ReactorGLES> reactor_;
std::shared_ptr<UniqueHandleGLES> handle_;
std::unique_ptr<BufferBindingsGLES> buffer_bindings_;
bool is_valid_ = false;

// |Pipeline|
bool IsValid() const override;

PipelineGLES(ReactorGLES::Ref reactor,
PipelineGLES(std::shared_ptr<ReactorGLES> reactor,
std::weak_ptr<PipelineLibrary> library,
const PipelineDescriptor& desc,
std::shared_ptr<UniqueHandleGLES> handle);
Expand Down
4 changes: 2 additions & 2 deletions impeller/renderer/backend/gles/pipeline_library_gles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

namespace impeller {

PipelineLibraryGLES::PipelineLibraryGLES(ReactorGLES::Ref reactor)
PipelineLibraryGLES::PipelineLibraryGLES(std::shared_ptr<ReactorGLES> reactor)
: reactor_(std::move(reactor)) {}

static std::string GetShaderInfoLog(const ProcTableGLES& gl, GLuint shader) {
Expand Down Expand Up @@ -324,7 +324,7 @@ void PipelineLibraryGLES::RemovePipelinesWithEntryPoint(
// |PipelineLibrary|
PipelineLibraryGLES::~PipelineLibraryGLES() = default;

const ReactorGLES::Ref& PipelineLibraryGLES::GetReactor() const {
const std::shared_ptr<ReactorGLES>& PipelineLibraryGLES::GetReactor() const {
return reactor_;
}

Expand Down
6 changes: 3 additions & 3 deletions impeller/renderer/backend/gles/pipeline_library_gles.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ class PipelineLibraryGLES final
ProgramKey::Hash,
ProgramKey::Equal>;

ReactorGLES::Ref reactor_;
std::shared_ptr<ReactorGLES> reactor_;
PipelineMap pipelines_;
Mutex programs_mutex_;
ProgramMap programs_ IPLR_GUARDED_BY(programs_mutex_);

explicit PipelineLibraryGLES(ReactorGLES::Ref reactor);
explicit PipelineLibraryGLES(std::shared_ptr<ReactorGLES> reactor);

// |PipelineLibrary|
bool IsValid() const override;
Expand All @@ -113,7 +113,7 @@ class PipelineLibraryGLES final
void RemovePipelinesWithEntryPoint(
std::shared_ptr<const ShaderFunction> function) override;

const ReactorGLES::Ref& GetReactor() const;
const std::shared_ptr<ReactorGLES>& GetReactor() const;

static std::shared_ptr<PipelineGLES> CreatePipeline(
const std::weak_ptr<PipelineLibrary>& weak_library,
Expand Down
2 changes: 0 additions & 2 deletions impeller/renderer/backend/gles/reactor_gles.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ class ReactorGLES {
const ReactorGLES& reactor) const = 0;
};

using Ref = std::shared_ptr<ReactorGLES>;

//----------------------------------------------------------------------------
/// @brief Create a new reactor. There are expensive and only one per
/// application instance is necessary.
Expand Down
2 changes: 1 addition & 1 deletion impeller/renderer/backend/gles/render_pass_gles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace impeller {

RenderPassGLES::RenderPassGLES(std::shared_ptr<const Context> context,
const RenderTarget& target,
ReactorGLES::Ref reactor)
std::shared_ptr<ReactorGLES> reactor)
: RenderPass(std::move(context), target),
reactor_(std::move(reactor)),
is_valid_(reactor_ && reactor_->IsValid()) {}
Expand Down
4 changes: 2 additions & 2 deletions impeller/renderer/backend/gles/render_pass_gles.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ class RenderPassGLES final
private:
friend class CommandBufferGLES;

ReactorGLES::Ref reactor_;
std::shared_ptr<ReactorGLES> reactor_;
std::string label_;
bool is_valid_ = false;

RenderPassGLES(std::shared_ptr<const Context> context,
const RenderTarget& target,
ReactorGLES::Ref reactor);
std::shared_ptr<ReactorGLES> reactor);

// |RenderPass|
bool IsValid() const override;
Expand Down
14 changes: 8 additions & 6 deletions impeller/renderer/backend/gles/texture_gles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,10 @@ HandleType ToHandleType(TextureGLES::Type type) {
FML_UNREACHABLE();
}

std::shared_ptr<TextureGLES> TextureGLES::WrapFBO(ReactorGLES::Ref reactor,
TextureDescriptor desc,
GLuint fbo) {
std::shared_ptr<TextureGLES> TextureGLES::WrapFBO(
std::shared_ptr<ReactorGLES> reactor,
TextureDescriptor desc,
GLuint fbo) {
auto texture = std::shared_ptr<TextureGLES>(
new TextureGLES(std::move(reactor), desc, fbo, std::nullopt));
if (!texture->IsValid()) {
Expand All @@ -152,7 +153,7 @@ std::shared_ptr<TextureGLES> TextureGLES::WrapFBO(ReactorGLES::Ref reactor,
}

std::shared_ptr<TextureGLES> TextureGLES::WrapTexture(
ReactorGLES::Ref reactor,
std::shared_ptr<ReactorGLES> reactor,
TextureDescriptor desc,
HandleGLES external_handle) {
if (external_handle.IsDead()) {
Expand All @@ -172,12 +173,13 @@ std::shared_ptr<TextureGLES> TextureGLES::WrapTexture(
}

std::shared_ptr<TextureGLES> TextureGLES::CreatePlaceholder(
ReactorGLES::Ref reactor,
std::shared_ptr<ReactorGLES> reactor,
TextureDescriptor desc) {
return TextureGLES::WrapFBO(std::move(reactor), desc, 0u);
}

TextureGLES::TextureGLES(ReactorGLES::Ref reactor, TextureDescriptor desc)
TextureGLES::TextureGLES(std::shared_ptr<ReactorGLES> reactor,
TextureDescriptor desc)
: TextureGLES(std::move(reactor), //
desc, //
std::nullopt, //
Expand Down
20 changes: 11 additions & 9 deletions impeller/renderer/backend/gles/texture_gles.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ class TextureGLES final : public Texture,
/// @return If a texture representation of the framebuffer could be
/// created.
///
static std::shared_ptr<TextureGLES> WrapFBO(ReactorGLES::Ref reactor,
TextureDescriptor desc,
GLuint fbo);
static std::shared_ptr<TextureGLES> WrapFBO(
std::shared_ptr<ReactorGLES> reactor,
TextureDescriptor desc,
GLuint fbo);

//----------------------------------------------------------------------------
/// @brief Create a texture by wrapping an external OpenGL texture
Expand All @@ -55,9 +56,10 @@ class TextureGLES final : public Texture,
/// @return If a texture representation of the framebuffer could be
/// created.
///
static std::shared_ptr<TextureGLES> WrapTexture(ReactorGLES::Ref reactor,
TextureDescriptor desc,
HandleGLES external_handle);
static std::shared_ptr<TextureGLES> WrapTexture(
std::shared_ptr<ReactorGLES> reactor,
TextureDescriptor desc,
HandleGLES external_handle);

//----------------------------------------------------------------------------
/// @brief Create a "texture" that is never expected to be bound/unbound
Expand All @@ -70,10 +72,10 @@ class TextureGLES final : public Texture,
/// @return If a texture placeholder could be created.
///
static std::shared_ptr<TextureGLES> CreatePlaceholder(
ReactorGLES::Ref reactor,
std::shared_ptr<ReactorGLES> reactor,
TextureDescriptor desc);

TextureGLES(ReactorGLES::Ref reactor, TextureDescriptor desc);
TextureGLES(std::shared_ptr<ReactorGLES> reactor, TextureDescriptor desc);

// |Texture|
~TextureGLES() override;
Expand Down Expand Up @@ -143,7 +145,7 @@ class TextureGLES final : public Texture,
std::optional<HandleGLES> GetSyncFence() const;

private:
ReactorGLES::Ref reactor_;
std::shared_ptr<ReactorGLES> reactor_;
const Type type_;
HandleGLES handle_;
mutable std::optional<HandleGLES> fence_ = std::nullopt;
Expand Down
11 changes: 7 additions & 4 deletions impeller/renderer/backend/gles/unique_handle_gles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,25 @@

namespace impeller {

UniqueHandleGLES::UniqueHandleGLES(ReactorGLES::Ref reactor, HandleType type)
UniqueHandleGLES::UniqueHandleGLES(std::shared_ptr<ReactorGLES> reactor,
HandleType type)
: reactor_(std::move(reactor)) {
if (reactor_) {
handle_ = reactor_->CreateHandle(type);
}
}

// static
UniqueHandleGLES UniqueHandleGLES::MakeUntracked(ReactorGLES::Ref reactor,
HandleType type) {
UniqueHandleGLES UniqueHandleGLES::MakeUntracked(
std::shared_ptr<ReactorGLES> reactor,
HandleType type) {
FML_DCHECK(reactor);
HandleGLES handle = reactor->CreateUntrackedHandle(type);
return UniqueHandleGLES(std::move(reactor), handle);
}

UniqueHandleGLES::UniqueHandleGLES(ReactorGLES::Ref reactor, HandleGLES handle)
UniqueHandleGLES::UniqueHandleGLES(std::shared_ptr<ReactorGLES> reactor,
HandleGLES handle)
: reactor_(std::move(reactor)), handle_(handle) {}

UniqueHandleGLES::~UniqueHandleGLES() {
Expand Down
8 changes: 4 additions & 4 deletions impeller/renderer/backend/gles/unique_handle_gles.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ namespace impeller {
///
class UniqueHandleGLES {
public:
UniqueHandleGLES(ReactorGLES::Ref reactor, HandleType type);
UniqueHandleGLES(std::shared_ptr<ReactorGLES> reactor, HandleType type);

static UniqueHandleGLES MakeUntracked(ReactorGLES::Ref reactor,
static UniqueHandleGLES MakeUntracked(std::shared_ptr<ReactorGLES> reactor,
HandleType type);

UniqueHandleGLES(ReactorGLES::Ref reactor, HandleGLES handle);
UniqueHandleGLES(std::shared_ptr<ReactorGLES> reactor, HandleGLES handle);

~UniqueHandleGLES();

Expand All @@ -37,7 +37,7 @@ class UniqueHandleGLES {
bool IsValid() const;

private:
ReactorGLES::Ref reactor_ = nullptr;
std::shared_ptr<ReactorGLES> reactor_ = nullptr;
HandleGLES handle_ = HandleGLES::DeadHandle();
};

Expand Down
Loading