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

Go to the source code of this file.

Namespaces

namespace  flutter
 
namespace  flutter::gpu
 

Functions

 flutter::gpu::IMPLEMENT_WRAPPERTYPEINFO (flutter_gpu, Texture)
 
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)
 
void InternalFlutterGpu_Texture_SetCoordinateSystem (flutter::gpu::Texture *wrapper, int coordinate_system)
 
bool InternalFlutterGpu_Texture_Overwrite (flutter::gpu::Texture *texture, flutter::gpu::Context *gpu_context, Dart_Handle source_byte_data)
 
int InternalFlutterGpu_Texture_BytesPerTexel (flutter::gpu::Texture *wrapper)
 
Dart_Handle InternalFlutterGpu_Texture_AsImage (flutter::gpu::Texture *wrapper)
 

Function Documentation

◆ InternalFlutterGpu_Texture_AsImage()

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

Definition at line 173 of file texture.cc.

173 {
174 return wrapper->AsImage();
175}
Dart_Handle AsImage() const
Definition texture.cc:73

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

◆ InternalFlutterGpu_Texture_BytesPerTexel()

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

Definition at line 168 of file texture.cc.

169 {
170 return wrapper->GetBytesPerTexel();
171}
size_t GetBytesPerTexel()
Definition texture.cc:68

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

◆ InternalFlutterGpu_Texture_Initialize()

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 
)

Exports

Definition at line 95 of file texture.cc.

106 {
109 desc.size = {width, height};
111 desc.usage = {};
112 if (enable_render_target_usage) {
114 }
115 if (enable_shader_read_usage) {
117 }
118 if (enable_shader_write_usage) {
120 }
121 switch (sample_count) {
122 case 1:
124 break;
125 case 4:
127 break;
128 default:
129 return false;
130 }
131 desc.type = static_cast<impeller::TextureType>(texture_type);
134 return false;
135 }
136
137 auto texture =
138 gpu_context->GetContext().GetResourceAllocator()->CreateTexture(desc,
139 true);
140 if (!texture) {
141 FML_LOG(ERROR) << "Failed to create texture.";
142 return false;
143 }
144
145 texture->SetCoordinateSystem(
147
148 auto res = fml::MakeRefCounted<flutter::gpu::Texture>(std::move(texture));
149 res->AssociateWithDartWrapper(wrapper);
150
151 return true;
152}
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()

bool InternalFlutterGpu_Texture_Overwrite ( flutter::gpu::Texture texture,
flutter::gpu::Context gpu_context,
Dart_Handle  source_byte_data 
)

Definition at line 161 of file texture.cc.

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

References texture.

◆ InternalFlutterGpu_Texture_SetCoordinateSystem()

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

Definition at line 154 of file texture.cc.

156 {
157 return wrapper->SetCoordinateSystem(
159}
void SetCoordinateSystem(impeller::TextureCoordinateSystem coordinate_system)
Definition texture.cc:33

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