32std::shared_ptr<Texture> DeviceBufferMTL::AsTexture(
35 uint16_t row_bytes)
const {
38 if (!mtl_texture_desc) {
43 if (@available(iOS 13.0, macos 10.15, *)) {
44 mtl_texture_desc.resourceOptions = buffer_.resourceOptions;
47 auto texture = [buffer_ newTextureWithDescriptor:mtl_texture_desc
49 bytesPerRow:row_bytes];
53 return TextureMTL::Create(descriptor,
texture);
81void DeviceBufferMTL::Flush(std::optional<Range> range)
const {
83 auto flush_range = range.value_or(
Range{0, GetDeviceBufferDescriptor().size});
84 if (storage_mode_ == MTLStorageModeManaged) {
86 didModifyRange:NSMakeRange(flush_range.offset, flush_range.length)];
static const uint8_t buffer[]
A lightweight object that describes the attributes of a texture that can then used an allocator to cr...