Fix up gpui1

This commit is contained in:
Piotr Osiewicz 2024-01-02 13:18:56 +01:00
parent 388c2d8e7f
commit 576d8806f5

View file

@ -162,7 +162,7 @@ impl Renderer {
"underline_fragment", "underline_fragment",
PIXEL_FORMAT, PIXEL_FORMAT,
); );
let cv_texture_cache = CVMetalTextureCache::new(device.as_ptr()).unwrap(); let cv_texture_cache = unsafe { CVMetalTextureCache::new(device.as_ptr()).unwrap() };
Self { Self {
layer, layer,
command_queue: device.new_command_queue(), command_queue: device.new_command_queue(),
@ -887,28 +887,30 @@ impl Renderer {
core_video::kCVPixelFormatType_420YpCbCr8BiPlanarFullRange core_video::kCVPixelFormatType_420YpCbCr8BiPlanarFullRange
); );
let y_texture = self let y_texture = unsafe {
.cv_texture_cache self.cv_texture_cache
.create_texture_from_image( .create_texture_from_image(
surface.image_buffer.as_concrete_TypeRef(), surface.image_buffer.as_concrete_TypeRef(),
ptr::null(), ptr::null(),
MTLPixelFormat::R8Unorm, MTLPixelFormat::R8Unorm,
surface.image_buffer.plane_width(0), surface.image_buffer.plane_width(0),
surface.image_buffer.plane_height(0), surface.image_buffer.plane_height(0),
0, 0,
) )
.unwrap(); .unwrap()
let cb_cr_texture = self };
.cv_texture_cache let cb_cr_texture = unsafe {
.create_texture_from_image( self.cv_texture_cache
surface.image_buffer.as_concrete_TypeRef(), .create_texture_from_image(
ptr::null(), surface.image_buffer.as_concrete_TypeRef(),
MTLPixelFormat::RG8Unorm, ptr::null(),
surface.image_buffer.plane_width(1), MTLPixelFormat::RG8Unorm,
surface.image_buffer.plane_height(1), surface.image_buffer.plane_width(1),
1, surface.image_buffer.plane_height(1),
) 1,
.unwrap(); )
.unwrap()
};
align_offset(offset); align_offset(offset);
let next_offset = *offset + mem::size_of::<shaders::GPUISurface>(); let next_offset = *offset + mem::size_of::<shaders::GPUISurface>();