mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 12:41:30 +11:00
Fix non-mac builds
Also updates comment. We know the implementation is incomplete and needs refinement, but it seems useful to commit as a starting point for further work.
This commit is contained in:
parent
2613a7e500
commit
b2e7c80d3b
|
@ -21,7 +21,7 @@ use raw_window_handle::{HasRawWindowHandle, RawWindowHandle};
|
|||
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use crate::{BindType, BufferUsage, Error, GpuInfo, ImageLayout, MapMode, WorkgroupLimits};
|
||||
use crate::{BindType, BufferUsage, Error, GpuInfo, ImageLayout, MapMode, WorkgroupLimits, ImageFormat};
|
||||
|
||||
use self::{
|
||||
descriptor::{CpuHeapRefOwned, DescriptorPool, GpuHeapRefOwned},
|
||||
|
@ -321,8 +321,11 @@ impl crate::backend::Device for Dx12Device {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
unsafe fn create_image2d(&self, width: u32, height: u32) -> Result<Self::Image, Error> {
|
||||
let format = winapi::shared::dxgiformat::DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
unsafe fn create_image2d(&self, width: u32, height: u32, format: ImageFormat) -> 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,
|
||||
};
|
||||
let resource = self
|
||||
.device
|
||||
.create_texture2d_buffer(width.into(), height, format, true)?;
|
||||
|
|
|
@ -308,10 +308,7 @@ impl Session {
|
|||
}
|
||||
}
|
||||
|
||||
/// Create an image.
|
||||
///
|
||||
/// Currently this creates only a 2D image in RGBA8 format, with usage
|
||||
/// so that it can be accessed by shaders and used for transfer.
|
||||
/// Create an image of the given size and pixel format.
|
||||
pub unsafe fn create_image2d(
|
||||
&self,
|
||||
width: u32,
|
||||
|
|
|
@ -13,7 +13,7 @@ use smallvec::SmallVec;
|
|||
|
||||
use crate::backend::Device as DeviceTrait;
|
||||
use crate::{
|
||||
BindType, BufferUsage, Error, GpuInfo, ImageLayout, MapMode, SamplerParams, SubgroupSize,
|
||||
BindType, BufferUsage, Error, GpuInfo, ImageFormat, ImageLayout, MapMode, SamplerParams, SubgroupSize,
|
||||
WorkgroupLimits,
|
||||
};
|
||||
|
||||
|
@ -533,7 +533,7 @@ impl crate::backend::Device for VkDevice {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
unsafe fn create_image2d(&self, width: u32, height: u32) -> Result<Self::Image, Error> {
|
||||
unsafe fn create_image2d(&self, width: u32, height: u32, format: ImageFormat) -> Result<Self::Image, Error> {
|
||||
let device = &self.device.device;
|
||||
let extent = vk::Extent3D {
|
||||
width,
|
||||
|
@ -545,10 +545,14 @@ impl crate::backend::Device for VkDevice {
|
|||
let usage = vk::ImageUsageFlags::STORAGE
|
||||
| vk::ImageUsageFlags::TRANSFER_SRC
|
||||
| vk::ImageUsageFlags::TRANSFER_DST;
|
||||
let vk_format = match format {
|
||||
ImageFormat::A8 => vk::Format::R8_UNORM,
|
||||
ImageFormat::Rgba8 => vk::Format::R8G8B8A8_UNORM,
|
||||
};
|
||||
let image = device.create_image(
|
||||
&vk::ImageCreateInfo::builder()
|
||||
.image_type(vk::ImageType::TYPE_2D)
|
||||
.format(vk::Format::R8G8B8A8_UNORM)
|
||||
.format(vk_format)
|
||||
.extent(extent)
|
||||
.mip_levels(1)
|
||||
.array_layers(1)
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
//! An experimental API for glyph rendering.
|
||||
|
||||
use piet::{kurbo::Affine, RenderContext};
|
||||
use swash::{scale::ScaleContext, CacheKey, FontDataRef, FontRef};
|
||||
use swash::{scale::ScaleContext, CacheKey, FontDataRef};
|
||||
|
||||
use crate::{encoder::GlyphEncoder, PietGpuRenderContext};
|
||||
|
||||
|
|
Loading…
Reference in a new issue