mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 12:41:30 +11:00
macOS fixes
* Fix call to removed encoded_scene method in pgpu-render * Add new ImageFormat::Surface variant to select a pixel format that matches the platform specific surface format. This makes gradients consistent across platforms.
This commit is contained in:
parent
c84d1f6df5
commit
6c5a2cb4f4
|
@ -87,7 +87,7 @@ impl PgpuRenderer {
|
|||
.session
|
||||
.image_from_raw_mtl(target, self.width, self.height);
|
||||
if let Some(renderer) = &mut self.pgpu_renderer {
|
||||
renderer.upload_scene(&scene.encoded_scene(), 0).unwrap();
|
||||
renderer.upload_scene(&scene.0, 0).unwrap();
|
||||
renderer.record(&mut cmd_buf, &self.query_pool, 0);
|
||||
// TODO later: we can bind the destination image and avoid the copy.
|
||||
cmd_buf.blit_image(&renderer.image_dev, &dst_image);
|
||||
|
|
|
@ -331,7 +331,7 @@ impl crate::backend::Device for Dx12Device {
|
|||
) -> Result<Self::Image, Error> {
|
||||
let format = match format {
|
||||
ImageFormat::A8 => winapi::shared::dxgiformat::DXGI_FORMAT_R8_UNORM,
|
||||
ImageFormat::Rgba8 => winapi::shared::dxgiformat::DXGI_FORMAT_R8G8B8A8_UNORM,
|
||||
ImageFormat::Rgba8 | ImageFormat::Surface => winapi::shared::dxgiformat::DXGI_FORMAT_R8G8B8A8_UNORM,
|
||||
};
|
||||
let resource = self
|
||||
.device
|
||||
|
|
|
@ -98,6 +98,8 @@ pub enum ImageFormat {
|
|||
A8,
|
||||
// 8 bit per pixel RGBA
|
||||
Rgba8,
|
||||
// Match default surface format
|
||||
Surface,
|
||||
}
|
||||
|
||||
bitflags! {
|
||||
|
|
|
@ -351,7 +351,8 @@ impl crate::backend::Device for MtlDevice {
|
|||
//desc.set_mipmap_level_count(1);
|
||||
let mtl_format = match format {
|
||||
ImageFormat::A8 => metal::MTLPixelFormat::R8Unorm,
|
||||
ImageFormat::Rgba8 => metal::MTLPixelFormat::BGRA8Unorm,
|
||||
ImageFormat::Rgba8 => metal::MTLPixelFormat::RGBA8Unorm,
|
||||
ImageFormat::Surface => metal::MTLPixelFormat::BGRA8Unorm,
|
||||
};
|
||||
desc.set_pixel_format(mtl_format);
|
||||
desc.set_usage(metal::MTLTextureUsage::ShaderRead | metal::MTLTextureUsage::ShaderWrite);
|
||||
|
|
|
@ -588,7 +588,7 @@ impl crate::backend::Device for VkDevice {
|
|||
| vk::ImageUsageFlags::TRANSFER_DST;
|
||||
let vk_format = match format {
|
||||
ImageFormat::A8 => vk::Format::R8_UNORM,
|
||||
ImageFormat::Rgba8 => vk::Format::R8G8B8A8_UNORM,
|
||||
ImageFormat::Rgba8 | ImageFormat::Surface => vk::Format::R8G8B8A8_UNORM,
|
||||
};
|
||||
let image = device.create_image(
|
||||
&vk::ImageCreateInfo::builder()
|
||||
|
|
|
@ -224,7 +224,7 @@ impl Renderer {
|
|||
|
||||
let image_format = match config.format {
|
||||
PixelFormat::A8 => piet_gpu_hal::ImageFormat::A8,
|
||||
PixelFormat::Rgba8 => piet_gpu_hal::ImageFormat::Rgba8,
|
||||
PixelFormat::Rgba8 => piet_gpu_hal::ImageFormat::Surface,
|
||||
};
|
||||
let image_dev = session.create_image2d(width as u32, height as u32, image_format)?;
|
||||
|
||||
|
|
Loading…
Reference in a new issue