Flutter Engine
 
Loading...
Searching...
No Matches
context.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
6
7#include <mutex>
8#include <utility>
9
10namespace impeller {
11
13 std::future<std::shared_ptr<impeller::Context>> context)
14 : future_(std::move(context)) {}
15
16std::shared_ptr<impeller::Context> ImpellerContextFuture::GetContext() {
17 std::scoped_lock<std::mutex> lock(mutex_);
18 if (!did_wait_ && future_.valid()) {
19 context_ = future_.get();
20 did_wait_ = true;
21 }
22 return context_;
23}
24
25Context::~Context() = default;
26
27Context::Context(const Flags& flags) : flags_(flags) {}
28
30 return false;
31}
32
34 std::shared_ptr<CommandBuffer> command_buffer) {
35 return GetCommandQueue()->Submit({std::move(command_buffer)}).ok();
36}
37
39 return true;
40}
41
42std::shared_ptr<const IdleWaiter> Context::GetIdleWaiter() const {
43 return nullptr;
44}
45
47 // Nothing to do.
48}
49
50bool Context::AddTrackingFence(const std::shared_ptr<Texture>& texture) const {
51 return false;
52}
53
54bool Context::SubmitOnscreen(std::shared_ptr<CommandBuffer> cmd_buffer) {
55 return EnqueueCommandBuffer(std::move(cmd_buffer));
56}
57
58} // namespace impeller
virtual std::shared_ptr< const IdleWaiter > GetIdleWaiter() const
Definition context.cc:42
virtual bool AddTrackingFence(const std::shared_ptr< Texture > &texture) const
Definition context.cc:50
virtual std::shared_ptr< CommandQueue > GetCommandQueue() const =0
Return the graphics queue for submitting command buffers.
virtual bool SubmitOnscreen(std::shared_ptr< CommandBuffer > cmd_buffer)
Submit the command buffer that renders to the onscreen surface.
Definition context.cc:54
virtual bool UpdateOffscreenLayerPixelFormat(PixelFormat format)
Definition context.cc:29
Context(const Flags &flags)
Definition context.cc:27
virtual bool FlushCommandBuffers()
Flush all pending command buffers.
Definition context.cc:38
virtual ~Context()
Destroys an Impeller context.
virtual void ResetThreadLocalState() const
Definition context.cc:46
virtual bool EnqueueCommandBuffer(std::shared_ptr< CommandBuffer > command_buffer)
Enqueue command_buffer for submission by the end of the frame.
Definition context.cc:33
std::shared_ptr< impeller::Context > GetContext()
Definition context.cc:16
ImpellerContextFuture(std::future< std::shared_ptr< impeller::Context > > context)
Definition context.cc:12
FlTexture * texture
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
Definition formats.h:99
Definition ref_ptr.h:261