13 const std::vector<uint8_t>&
data,
14 const std::shared_ptr<impeller::Context>& context,
15 std::string_view debug_label) {
16 std::shared_ptr<Texture> texture =
17 context->GetResourceAllocator()->CreateTexture(texture_descriptor);
20 std::make_shared<fml::NonOwnedMapping>(
data.data(),
data.size());
21 std::shared_ptr<DeviceBuffer> buffer =
22 context->GetResourceAllocator()->CreateBufferWithCopy(*data_mapping);
24 std::shared_ptr<CommandBuffer> cmd_buffer = context->CreateCommandBuffer();
25 std::shared_ptr<BlitPass> blit_pass = cmd_buffer->CreateBlitPass();
28 if (!blit_pass->EncodeCommands() ||
29 !context->GetCommandQueue()->Submit({std::move(cmd_buffer)}).ok()) {
33 texture->SetLabel(debug_label);
38 const std::shared_ptr<CommandBuffer>& command_buffer,
39 const std::shared_ptr<Context>& context,
40 const std::shared_ptr<Texture>& texture) {
41 std::shared_ptr<BlitPass> blit_pass = command_buffer->CreateBlitPass();
42 bool success = blit_pass->GenerateMipmap(texture);
44 return fml::Status(fml::StatusCode::kUnknown,
"");
46 success = blit_pass->EncodeCommands();
48 return fml::Status(fml::StatusCode::kUnknown,
"");
static BufferView AsBufferView(std::shared_ptr< DeviceBuffer > buffer)
Create a buffer view of this entire buffer.
fml::Status AddMipmapGeneration(const std::shared_ptr< CommandBuffer > &command_buffer, const std::shared_ptr< Context > &context, const std::shared_ptr< Texture > &texture)
Adds a blit command to the render pass.
std::shared_ptr< Texture > CreateTexture(const TextureDescriptor &texture_descriptor, const std::vector< uint8_t > &data, const std::shared_ptr< impeller::Context > &context, std::string_view debug_label)
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...
std::shared_ptr< const fml::Mapping > data