Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
texture.h File Reference

Go to the source code of this file.

Classes

class  flutter::gpu::Texture
 

Namespaces

namespace  flutter
 
namespace  flutter::gpu
 

Functions

FLUTTER_GPU_EXPORT bool InternalFlutterGpu_Texture_Initialize (Dart_Handle wrapper, flutter::gpu::Context *gpu_context, int storage_mode, int format, int width, int height, int sample_count, int coordinate_system, int texture_type, bool enable_render_target_usage, bool enable_shader_read_usage, bool enable_shader_write_usage)
 
FLUTTER_GPU_EXPORT void InternalFlutterGpu_Texture_SetCoordinateSystem (flutter::gpu::Texture *wrapper, int coordinate_system)
 
FLUTTER_GPU_EXPORT bool InternalFlutterGpu_Texture_Overwrite (flutter::gpu::Texture *wrapper, flutter::gpu::Context *gpu_context, Dart_Handle source_byte_data)
 
FLUTTER_GPU_EXPORT int InternalFlutterGpu_Texture_BytesPerTexel (flutter::gpu::Texture *wrapper)
 
FLUTTER_GPU_EXPORT Dart_Handle InternalFlutterGpu_Texture_AsImage (flutter::gpu::Texture *wrapper)
 

Function Documentation

◆ InternalFlutterGpu_Texture_AsImage()

FLUTTER_GPU_EXPORT Dart_Handle InternalFlutterGpu_Texture_AsImage ( flutter::gpu::Texture wrapper)
extern

Definition at line 175 of file texture.cc.

175 {
176 return wrapper->AsImage();
177}
Dart_Handle AsImage() const
Definition texture.cc:75

References flutter::gpu::Texture::AsImage().

◆ InternalFlutterGpu_Texture_BytesPerTexel()

FLUTTER_GPU_EXPORT int InternalFlutterGpu_Texture_BytesPerTexel ( flutter::gpu::Texture wrapper)
extern

Definition at line 170 of file texture.cc.

171 {
172 return wrapper->GetBytesPerTexel();
173}
size_t GetBytesPerTexel()
Definition texture.cc:70

References flutter::gpu::Texture::GetBytesPerTexel().

◆ InternalFlutterGpu_Texture_Initialize()

FLUTTER_GPU_EXPORT bool InternalFlutterGpu_Texture_Initialize ( Dart_Handle  wrapper,
flutter::gpu::Context gpu_context,
int  storage_mode,
int  format,
int  width,
int  height,
int  sample_count,
int  coordinate_system,
int  texture_type,
bool  enable_render_target_usage,
bool  enable_shader_read_usage,
bool  enable_shader_write_usage 
)
extern

Exports

Definition at line 97 of file texture.cc.

108 {
111 desc.size = {width, height};
113 desc.usage = {};
114 if (enable_render_target_usage) {
116 }
117 if (enable_shader_read_usage) {
119 }
120 if (enable_shader_write_usage) {
122 }
123 switch (sample_count) {
124 case 1:
126 break;
127 case 4:
129 break;
130 default:
131 return false;
132 }
133 desc.type = static_cast<impeller::TextureType>(texture_type);
136 return false;
137 }
138
139 auto texture =
140 gpu_context->GetContext().GetResourceAllocator()->CreateTexture(desc,
141 true);
142 if (!texture) {
143 FML_LOG(ERROR) << "Failed to create texture.";
144 return false;
145 }
146
147 texture->SetCoordinateSystem(
149
150 auto res = fml::MakeRefCounted<flutter::gpu::Texture>(std::move(texture));
151 res->AssociateWithDartWrapper(wrapper);
152
153 return true;
154}
impeller::Context & GetContext()
Definition context.cc:77
virtual std::shared_ptr< Allocator > GetResourceAllocator() const =0
Returns the allocator used to create textures and buffers on the device.
#define FML_LOG(severity)
Definition logging.h:101
FlTexture * texture
constexpr impeller::PixelFormat ToImpellerPixelFormat(FlutterGPUPixelFormat value)
Definition formats.h:60
constexpr impeller::TextureCoordinateSystem ToImpellerTextureCoordinateSystem(FlutterGPUTextureCoordinateSystem value)
Definition formats.h:148
constexpr impeller::StorageMode ToImpellerStorageMode(FlutterGPUStorageMode value)
Definition formats.h:25
constexpr bool IsMultisampleCapable(TextureType type)
Definition formats.h:286
int32_t height
int32_t width
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...

References FML_LOG, impeller::TextureDescriptor::format, format, flutter::gpu::Context::GetContext(), impeller::Context::GetResourceAllocator(), height, impeller::IsMultisampleCapable(), impeller::kCount1, impeller::kCount4, impeller::kRenderTarget, impeller::kShaderRead, impeller::kShaderWrite, impeller::TextureDescriptor::sample_count, impeller::TextureDescriptor::size, impeller::TextureDescriptor::storage_mode, texture, flutter::gpu::ToImpellerPixelFormat(), flutter::gpu::ToImpellerStorageMode(), flutter::gpu::ToImpellerTextureCoordinateSystem(), impeller::TextureDescriptor::type, impeller::TextureDescriptor::usage, and width.

◆ InternalFlutterGpu_Texture_Overwrite()

FLUTTER_GPU_EXPORT bool InternalFlutterGpu_Texture_Overwrite ( flutter::gpu::Texture wrapper,
flutter::gpu::Context gpu_context,
Dart_Handle  source_byte_data 
)
extern

Definition at line 163 of file texture.cc.

165 {
166 return texture->Overwrite(*gpu_context,
167 tonic::DartByteData(source_byte_data));
168}

References texture.

◆ InternalFlutterGpu_Texture_SetCoordinateSystem()

FLUTTER_GPU_EXPORT void InternalFlutterGpu_Texture_SetCoordinateSystem ( flutter::gpu::Texture wrapper,
int  coordinate_system 
)
extern

Definition at line 156 of file texture.cc.

158 {
159 return wrapper->SetCoordinateSystem(
161}
void SetCoordinateSystem(impeller::TextureCoordinateSystem coordinate_system)
Definition texture.cc:35

References flutter::gpu::Texture::SetCoordinateSystem(), and flutter::gpu::ToImpellerTextureCoordinateSystem().