Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
context.h File Reference
#include "dart_api.h"
#include "flutter/lib/gpu/export.h"
#include "flutter/lib/ui/dart_wrapper.h"
#include "impeller/renderer/context.h"

Go to the source code of this file.

Classes

class  flutter::gpu::Context
 

Namespaces

namespace  flutter
 
namespace  flutter::gpu
 

Functions

bool flutter::gpu::SupportsNormalOffscreenMSAA (const impeller::Context &context)
 
FLUTTER_GPU_EXPORT Dart_Handle InternalFlutterGpu_Context_InitializeDefault (Dart_Handle wrapper)
 
FLUTTER_GPU_EXPORT int InternalFlutterGpu_Context_GetBackendType (flutter::gpu::Context *wrapper)
 
FLUTTER_GPU_EXPORT int InternalFlutterGpu_Context_GetDefaultColorFormat (flutter::gpu::Context *wrapper)
 
FLUTTER_GPU_EXPORT int InternalFlutterGpu_Context_GetDefaultStencilFormat (flutter::gpu::Context *wrapper)
 
FLUTTER_GPU_EXPORT int InternalFlutterGpu_Context_GetDefaultDepthStencilFormat (flutter::gpu::Context *wrapper)
 
FLUTTER_GPU_EXPORT int InternalFlutterGpu_Context_GetMinimumUniformByteAlignment (flutter::gpu::Context *wrapper)
 
FLUTTER_GPU_EXPORT bool InternalFlutterGpu_Context_GetSupportsOffscreenMSAA (flutter::gpu::Context *wrapper)
 
FLUTTER_GPU_EXPORT bool InternalFlutterGpu_Context_GetSupportsFramebufferRenderMipmap (flutter::gpu::Context *wrapper)
 
FLUTTER_GPU_EXPORT bool InternalFlutterGpu_Context_GetSupportsManuallyMippedTextures (flutter::gpu::Context *wrapper)
 
FLUTTER_GPU_EXPORT bool InternalFlutterGpu_Context_SupportsTextureCompression (flutter::gpu::Context *wrapper, int family)
 
FLUTTER_GPU_EXPORT bool InternalFlutterGpu_Context_SupportsTextureFormat (flutter::gpu::Context *wrapper, int format, bool render_target, bool shader_read, bool shader_write)
 

Function Documentation

◆ InternalFlutterGpu_Context_GetBackendType()

FLUTTER_GPU_EXPORT int InternalFlutterGpu_Context_GetBackendType ( flutter::gpu::Context wrapper)
extern

◆ InternalFlutterGpu_Context_GetDefaultColorFormat()

FLUTTER_GPU_EXPORT int InternalFlutterGpu_Context_GetDefaultColorFormat ( flutter::gpu::Context wrapper)
extern

Definition at line 115 of file context.cc.

116 {
117 return static_cast<int>(flutter::gpu::FromImpellerPixelFormat(
118 wrapper->GetContext().GetCapabilities()->GetDefaultColorFormat()));
119}
impeller::Context & GetContext()
Definition context.cc:87
virtual const std::shared_ptr< const Capabilities > & GetCapabilities() const =0
Get the capabilities of Impeller context. All optionally supported feature of the platform,...
constexpr FlutterGPUPixelFormat FromImpellerPixelFormat(impeller::PixelFormat value)
Definition formats.h:176

References flutter::gpu::FromImpellerPixelFormat(), impeller::Context::GetCapabilities(), and flutter::gpu::Context::GetContext().

◆ InternalFlutterGpu_Context_GetDefaultDepthStencilFormat()

FLUTTER_GPU_EXPORT int InternalFlutterGpu_Context_GetDefaultDepthStencilFormat ( flutter::gpu::Context wrapper)
extern

Definition at line 127 of file context.cc.

128 {
129 return static_cast<int>(flutter::gpu::FromImpellerPixelFormat(
130 wrapper->GetContext().GetCapabilities()->GetDefaultDepthStencilFormat()));
131}

References flutter::gpu::FromImpellerPixelFormat(), impeller::Context::GetCapabilities(), and flutter::gpu::Context::GetContext().

◆ InternalFlutterGpu_Context_GetDefaultStencilFormat()

FLUTTER_GPU_EXPORT int InternalFlutterGpu_Context_GetDefaultStencilFormat ( flutter::gpu::Context wrapper)
extern

Definition at line 121 of file context.cc.

122 {
123 return static_cast<int>(flutter::gpu::FromImpellerPixelFormat(
124 wrapper->GetContext().GetCapabilities()->GetDefaultStencilFormat()));
125}

References flutter::gpu::FromImpellerPixelFormat(), impeller::Context::GetCapabilities(), and flutter::gpu::Context::GetContext().

◆ InternalFlutterGpu_Context_GetMinimumUniformByteAlignment()

FLUTTER_GPU_EXPORT int InternalFlutterGpu_Context_GetMinimumUniformByteAlignment ( flutter::gpu::Context wrapper)
extern

Definition at line 133 of file context.cc.

134 {
135 return wrapper->GetContext().GetCapabilities()->GetMinimumUniformAlignment();
136}

References impeller::Context::GetCapabilities(), and flutter::gpu::Context::GetContext().

◆ InternalFlutterGpu_Context_GetSupportsFramebufferRenderMipmap()

FLUTTER_GPU_EXPORT bool InternalFlutterGpu_Context_GetSupportsFramebufferRenderMipmap ( flutter::gpu::Context wrapper)
extern

Definition at line 143 of file context.cc.

144 {
145 return wrapper->GetContext()
147 ->SupportsFramebufferRenderMipmap();
148}

References impeller::Context::GetCapabilities(), and flutter::gpu::Context::GetContext().

◆ InternalFlutterGpu_Context_GetSupportsManuallyMippedTextures()

FLUTTER_GPU_EXPORT bool InternalFlutterGpu_Context_GetSupportsManuallyMippedTextures ( flutter::gpu::Context wrapper)
extern

Definition at line 150 of file context.cc.

151 {
152 return wrapper->GetContext()
154 ->SupportsManuallyMippedTextures();
155}

References impeller::Context::GetCapabilities(), and flutter::gpu::Context::GetContext().

◆ InternalFlutterGpu_Context_GetSupportsOffscreenMSAA()

FLUTTER_GPU_EXPORT bool InternalFlutterGpu_Context_GetSupportsOffscreenMSAA ( flutter::gpu::Context wrapper)
extern

Definition at line 138 of file context.cc.

139 {
141}
bool SupportsNormalOffscreenMSAA(const impeller::Context &context)
Definition context.cc:21

References flutter::gpu::Context::GetContext(), and flutter::gpu::SupportsNormalOffscreenMSAA().

◆ InternalFlutterGpu_Context_InitializeDefault()

FLUTTER_GPU_EXPORT Dart_Handle InternalFlutterGpu_Context_InitializeDefault ( Dart_Handle  wrapper)
extern

Exports

Definition at line 102 of file context.cc.

102 {
103 std::optional<std::string> out_error;
104 auto impeller_context = flutter::gpu::Context::GetDefaultContext(out_error);
105 if (out_error.has_value()) {
106 return tonic::ToDart(out_error.value());
107 }
108
109 auto res = fml::MakeRefCounted<flutter::gpu::Context>(impeller_context);
110 res->AssociateWithDartWrapper(wrapper);
111
112 return Dart_Null();
113}
static std::shared_ptr< impeller::Context > GetDefaultContext(std::optional< std::string > &out_error)
Definition context.cc:39
Dart_Handle ToDart(const T &object)

References flutter::gpu::Context::GetDefaultContext(), and tonic::ToDart().

◆ InternalFlutterGpu_Context_SupportsTextureCompression()

FLUTTER_GPU_EXPORT bool InternalFlutterGpu_Context_SupportsTextureCompression ( flutter::gpu::Context wrapper,
int  family 
)
extern

Definition at line 157 of file context.cc.

159 {
160 return wrapper->GetContext().GetCapabilities()->SupportsTextureCompression(
162}
constexpr impeller::CompressedTextureFamily ToImpellerCompressedTextureFamily(FlutterGPUTextureCompressionFamily value)
Definition formats.h:84

References impeller::Context::GetCapabilities(), flutter::gpu::Context::GetContext(), and flutter::gpu::ToImpellerCompressedTextureFamily().

◆ InternalFlutterGpu_Context_SupportsTextureFormat()

FLUTTER_GPU_EXPORT bool InternalFlutterGpu_Context_SupportsTextureFormat ( flutter::gpu::Context wrapper,
int  format,
bool  render_target,
bool  shader_read,
bool  shader_write 
)
extern

Definition at line 164 of file context.cc.

169 {
170 const impeller::PixelFormat impeller_format =
172 if (impeller_format == impeller::PixelFormat::kUnknown) {
173 return false;
174 }
175 // Compressed formats are sample-only: shader_read must be true, and
176 // render-target or shader-write usage is never available.
177 if (impeller::IsCompressed(impeller_format)) {
178 if (render_target || shader_write || !shader_read) {
179 return false;
180 }
181 return wrapper->GetContext().GetCapabilities()->SupportsTextureCompression(
183 }
184 // For uncompressed formats, today's Impeller capability surface does not
185 // expose a per-format usage query, so this returns true. As that surface
186 // grows it should be wired in here.
187 return true;
188}
constexpr impeller::PixelFormat ToImpellerPixelFormat(FlutterGPUPixelFormat value)
Definition formats.h:104
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
Definition formats.h:99
constexpr CompressedTextureFamily CompressedTextureFamilyForFormat(PixelFormat format)
The compression family that format belongs to. Only valid for formats where IsCompressed is true.
Definition formats.h:185
constexpr bool IsCompressed(PixelFormat format)
Whether format is a block-compressed format.
Definition formats.h:158

References impeller::CompressedTextureFamilyForFormat(), format, impeller::Context::GetCapabilities(), flutter::gpu::Context::GetContext(), impeller::IsCompressed(), impeller::kUnknown, and flutter::gpu::ToImpellerPixelFormat().