Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Namespaces | Functions
texture.h File Reference
#include "flutter/lib/gpu/context.h"
#include "flutter/lib/gpu/export.h"
#include "flutter/lib/ui/dart_wrapper.h"
#include "impeller/core/formats.h"
#include "third_party/tonic/typed_data/dart_byte_data.h"

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, 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, 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 144 of file texture.cc.

144 {
145 return wrapper->AsImage();
146}
Dart_Handle AsImage() const
Definition texture.cc:52

◆ InternalFlutterGpu_Texture_BytesPerTexel()

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

Definition at line 139 of file texture.cc.

140 {
141 return wrapper->GetBytesPerTexel();
142}
size_t GetBytesPerTexel()
Definition texture.cc:47

◆ 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,
bool  enable_render_target_usage,
bool  enable_shader_read_usage,
bool  enable_shader_write_usage 
)
extern

Exports

Definition at line 74 of file texture.cc.

84 {
86 desc.storage_mode = flutter::gpu::ToImpellerStorageMode(storage_mode);
87 desc.size = {width, height};
89 desc.usage = {};
90 if (enable_render_target_usage) {
92 }
93 if (enable_shader_read_usage) {
95 }
96 if (enable_shader_write_usage) {
98 }
99 switch (sample_count) {
100 case 1:
103 break;
104 case 4:
107 break;
108 default:
109 return false;
110 }
111 auto texture =
112 gpu_context->GetContext()->GetResourceAllocator()->CreateTexture(desc);
113 if (!texture) {
114 FML_LOG(ERROR) << "Failed to create texture.";
115 return false;
116 }
117
118 texture->SetCoordinateSystem(
120
121 auto res = fml::MakeRefCounted<flutter::gpu::Texture>(std::move(texture));
122 res->AssociateWithDartWrapper(wrapper);
123
124 return true;
125}
std::shared_ptr< impeller::Context > GetContext()
Definition context.cc:65
uint32_t uint32_t * format
#define FML_LOG(severity)
Definition logging.h:82
FlTexture * texture
constexpr impeller::PixelFormat ToImpellerPixelFormat(FlutterGPUPixelFormat value)
Definition formats.h:60
constexpr impeller::TextureCoordinateSystem ToImpellerTextureCoordinateSystem(FlutterGPUTextureCoordinateSystem value)
Definition formats.h:145
constexpr impeller::StorageMode ToImpellerStorageMode(FlutterGPUStorageMode value)
Definition formats.h:25
int32_t height
int32_t width
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...
#define ERROR(message)

◆ InternalFlutterGpu_Texture_Overwrite()

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

Definition at line 134 of file texture.cc.

135 {
136 return texture->Overwrite(tonic::DartByteData(source_byte_data));
137}

◆ InternalFlutterGpu_Texture_SetCoordinateSystem()

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

Definition at line 127 of file texture.cc.

129 {
130 return wrapper->SetCoordinateSystem(
132}
void SetCoordinateSystem(impeller::TextureCoordinateSystem coordinate_system)
Definition texture.cc:30