mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 12:41:30 +11:00
Merge pull request #191 from linebender/version_bump
Update dependencies
This commit is contained in:
commit
12fe2c10bc
750
Cargo.lock
generated
750
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -7,12 +7,12 @@ license = "MIT/Apache-2.0"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ash = "0.33"
|
ash = { version = "0.37", features = ["loaded"] }
|
||||||
ash-window = "0.7"
|
ash-window = "0.12"
|
||||||
raw-window-handle = "0.3"
|
raw-window-handle = "0.5"
|
||||||
bitflags = "1.2.1"
|
bitflags = "1.3.2"
|
||||||
smallvec = "1.6.1"
|
smallvec = "1.9"
|
||||||
bytemuck = "1.7.2"
|
bytemuck = "1.12.1"
|
||||||
|
|
||||||
[target.'cfg(target_os="windows")'.dependencies]
|
[target.'cfg(target_os="windows")'.dependencies]
|
||||||
winapi = { version = "0.3.9", features = [
|
winapi = { version = "0.3.9", features = [
|
||||||
|
@ -24,8 +24,10 @@ winapi = { version = "0.3.9", features = [
|
||||||
wio = "0.2.2"
|
wio = "0.2.2"
|
||||||
|
|
||||||
[target.'cfg(target_os="macos")'.dependencies]
|
[target.'cfg(target_os="macos")'.dependencies]
|
||||||
metal = "0.22"
|
metal = "0.24"
|
||||||
objc = "0.2.5"
|
objc = "0.2.7"
|
||||||
block = "0.1.6"
|
block = "0.1.6"
|
||||||
cocoa-foundation = "0.1"
|
cocoa-foundation = "0.1"
|
||||||
|
# Note: foreign-types is up to 0.5 but metal hasn't upgraded to it
|
||||||
foreign-types = "0.3.2"
|
foreign-types = "0.3.2"
|
||||||
|
core-graphics-types = "0.1.1"
|
||||||
|
|
|
@ -17,7 +17,7 @@ use winapi::shared::minwindef::TRUE;
|
||||||
use winapi::shared::{dxgi, dxgi1_2, dxgitype};
|
use winapi::shared::{dxgi, dxgi1_2, dxgitype};
|
||||||
use winapi::um::d3d12;
|
use winapi::um::d3d12;
|
||||||
|
|
||||||
use raw_window_handle::{HasRawWindowHandle, RawWindowHandle};
|
use raw_window_handle::{RawDisplayHandle, RawWindowHandle};
|
||||||
|
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
|
|
||||||
|
@ -153,9 +153,10 @@ impl Dx12Instance {
|
||||||
/// Create a surface for the specified window handle.
|
/// Create a surface for the specified window handle.
|
||||||
pub fn surface(
|
pub fn surface(
|
||||||
&self,
|
&self,
|
||||||
window_handle: &dyn HasRawWindowHandle,
|
_display_handle: RawDisplayHandle,
|
||||||
|
window_handle: RawWindowHandle,
|
||||||
) -> Result<Dx12Surface, Error> {
|
) -> Result<Dx12Surface, Error> {
|
||||||
if let RawWindowHandle::Windows(w) = window_handle.raw_window_handle() {
|
if let RawWindowHandle::Win32(w) = window_handle {
|
||||||
let hwnd = w.hwnd as *mut _;
|
let hwnd = w.hwnd as *mut _;
|
||||||
Ok(Dx12Surface { hwnd })
|
Ok(Dx12Surface { hwnd })
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -29,9 +29,10 @@ use objc::rc::autoreleasepool;
|
||||||
use objc::runtime::{Object, BOOL, YES};
|
use objc::runtime::{Object, BOOL, YES};
|
||||||
use objc::{class, msg_send, sel, sel_impl};
|
use objc::{class, msg_send, sel, sel_impl};
|
||||||
|
|
||||||
use metal::{CGFloat, CommandBufferRef, MTLFeatureSet};
|
use core_graphics_types::base::CGFloat;
|
||||||
|
use metal::{CommandBufferRef, MTLFeatureSet};
|
||||||
|
|
||||||
use raw_window_handle::{HasRawWindowHandle, RawWindowHandle};
|
use raw_window_handle::{RawDisplayHandle, RawWindowHandle};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
BufferUsage, ComputePassDescriptor, Error, GpuInfo, ImageFormat, MapMode, WorkgroupLimits,
|
BufferUsage, ComputePassDescriptor, Error, GpuInfo, ImageFormat, MapMode, WorkgroupLimits,
|
||||||
|
@ -139,9 +140,10 @@ impl MtlInstance {
|
||||||
|
|
||||||
pub unsafe fn surface(
|
pub unsafe fn surface(
|
||||||
&self,
|
&self,
|
||||||
window_handle: &dyn HasRawWindowHandle,
|
_display_handle: RawDisplayHandle,
|
||||||
|
window_handle: RawWindowHandle,
|
||||||
) -> Result<MtlSurface, Error> {
|
) -> Result<MtlSurface, Error> {
|
||||||
if let RawWindowHandle::MacOS(handle) = window_handle.raw_window_handle() {
|
if let RawWindowHandle::AppKit(handle) = window_handle {
|
||||||
Ok(Self::make_surface(handle.ns_view as id, handle.ns_window as id).unwrap())
|
Ok(Self::make_surface(handle.ns_view as id, handle.ns_window as id).unwrap())
|
||||||
} else {
|
} else {
|
||||||
Err("can't create surface for window handle".into())
|
Err("can't create surface for window handle".into())
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
//! Utilities and types for Metal integration
|
//! Utilities and types for Metal integration
|
||||||
|
|
||||||
use metal::{CGFloat, CGSize};
|
use core_graphics_types::{base::CGFloat, geometry::CGSize};
|
||||||
|
|
||||||
#[link(name = "QuartzCore", kind = "framework")]
|
#[link(name = "QuartzCore", kind = "framework")]
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
|
|
||||||
//! A multiplexer module that selects a back-end at runtime.
|
//! A multiplexer module that selects a back-end at runtime.
|
||||||
|
|
||||||
|
use raw_window_handle::RawDisplayHandle;
|
||||||
|
use raw_window_handle::RawWindowHandle;
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
|
|
||||||
mux_cfg! {
|
mux_cfg! {
|
||||||
|
@ -163,12 +165,13 @@ impl Instance {
|
||||||
/// Create a surface from the specified window handle.
|
/// Create a surface from the specified window handle.
|
||||||
pub unsafe fn surface(
|
pub unsafe fn surface(
|
||||||
&self,
|
&self,
|
||||||
window_handle: &dyn raw_window_handle::HasRawWindowHandle,
|
display_handle: RawDisplayHandle,
|
||||||
|
window_handle: RawWindowHandle,
|
||||||
) -> Result<Surface, Error> {
|
) -> Result<Surface, Error> {
|
||||||
mux_match! { self;
|
mux_match! { self;
|
||||||
Instance::Vk(i) => i.surface(window_handle).map(Surface::Vk),
|
Instance::Vk(i) => i.surface(display_handle, window_handle).map(Surface::Vk),
|
||||||
Instance::Dx12(i) => i.surface(window_handle).map(Surface::Dx12),
|
Instance::Dx12(i) => i.surface(display_handle, window_handle).map(Surface::Dx12),
|
||||||
Instance::Mtl(i) => i.surface(window_handle).map(Surface::Mtl),
|
Instance::Mtl(i) => i.surface(display_handle, window_handle).map(Surface::Mtl),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ use ash::extensions::{ext::DebugUtils, khr};
|
||||||
use ash::vk::DebugUtilsLabelEXT;
|
use ash::vk::DebugUtilsLabelEXT;
|
||||||
use ash::{vk, Device, Entry, Instance};
|
use ash::{vk, Device, Entry, Instance};
|
||||||
|
|
||||||
|
use raw_window_handle::{RawDisplayHandle, RawWindowHandle};
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
|
|
||||||
use crate::backend::Device as DeviceTrait;
|
use crate::backend::Device as DeviceTrait;
|
||||||
|
@ -157,7 +158,7 @@ impl VkInstance {
|
||||||
pub fn new() -> Result<VkInstance, Error> {
|
pub fn new() -> Result<VkInstance, Error> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let app_name = CString::new("VkToy").unwrap();
|
let app_name = CString::new("VkToy").unwrap();
|
||||||
let entry = Entry::new()?;
|
let entry = Entry::load()?;
|
||||||
|
|
||||||
let mut layers = Layers::new(entry.enumerate_instance_layer_properties()?);
|
let mut layers = Layers::new(entry.enumerate_instance_layer_properties()?);
|
||||||
if cfg!(debug_assertions) {
|
if cfg!(debug_assertions) {
|
||||||
|
@ -165,7 +166,7 @@ impl VkInstance {
|
||||||
.try_add(CStr::from_bytes_with_nul(b"VK_LAYER_KHRONOS_validation\0").unwrap());
|
.try_add(CStr::from_bytes_with_nul(b"VK_LAYER_KHRONOS_validation\0").unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut exts = Extensions::new(entry.enumerate_instance_extension_properties()?);
|
let mut exts = Extensions::new(entry.enumerate_instance_extension_properties(None)?);
|
||||||
let mut has_debug_ext = false;
|
let mut has_debug_ext = false;
|
||||||
if cfg!(debug_assertions) {
|
if cfg!(debug_assertions) {
|
||||||
has_debug_ext = exts.try_add(DebugUtils::name());
|
has_debug_ext = exts.try_add(DebugUtils::name());
|
||||||
|
@ -221,12 +222,15 @@ impl VkInstance {
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let (dbg_loader, _dbg_callbk) = if has_debug_ext {
|
let (dbg_loader, _dbg_callbk) = if has_debug_ext {
|
||||||
|
let flags = vk::DebugUtilsMessageTypeFlagsEXT::GENERAL
|
||||||
|
| vk::DebugUtilsMessageTypeFlagsEXT::PERFORMANCE
|
||||||
|
| vk::DebugUtilsMessageTypeFlagsEXT::VALIDATION;
|
||||||
let dbg_info = vk::DebugUtilsMessengerCreateInfoEXT::builder()
|
let dbg_info = vk::DebugUtilsMessengerCreateInfoEXT::builder()
|
||||||
.message_severity(
|
.message_severity(
|
||||||
vk::DebugUtilsMessageSeverityFlagsEXT::ERROR
|
vk::DebugUtilsMessageSeverityFlagsEXT::ERROR
|
||||||
| vk::DebugUtilsMessageSeverityFlagsEXT::WARNING,
|
| vk::DebugUtilsMessageSeverityFlagsEXT::WARNING,
|
||||||
)
|
)
|
||||||
.message_type(vk::DebugUtilsMessageTypeFlagsEXT::all())
|
.message_type(flags)
|
||||||
.pfn_user_callback(Some(vulkan_debug_callback));
|
.pfn_user_callback(Some(vulkan_debug_callback));
|
||||||
let dbg_loader = DebugUtils::new(&entry, &instance);
|
let dbg_loader = DebugUtils::new(&entry, &instance);
|
||||||
let dbg_callbk = dbg_loader
|
let dbg_callbk = dbg_loader
|
||||||
|
@ -256,10 +260,17 @@ impl VkInstance {
|
||||||
/// The caller is responsible for making sure that the instance outlives the surface.
|
/// The caller is responsible for making sure that the instance outlives the surface.
|
||||||
pub unsafe fn surface(
|
pub unsafe fn surface(
|
||||||
&self,
|
&self,
|
||||||
window_handle: &dyn raw_window_handle::HasRawWindowHandle,
|
display_handle: RawDisplayHandle,
|
||||||
|
window_handle: RawWindowHandle,
|
||||||
) -> Result<VkSurface, Error> {
|
) -> Result<VkSurface, Error> {
|
||||||
Ok(VkSurface {
|
Ok(VkSurface {
|
||||||
surface: ash_window::create_surface(&self.entry, &self.instance, window_handle, None)?,
|
surface: ash_window::create_surface(
|
||||||
|
&self.entry,
|
||||||
|
&self.instance,
|
||||||
|
display_handle,
|
||||||
|
window_handle,
|
||||||
|
None,
|
||||||
|
)?,
|
||||||
surface_fn: khr::Surface::new(&self.entry, &self.instance),
|
surface_fn: khr::Surface::new(&self.entry, &self.instance),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -273,8 +284,7 @@ impl VkInstance {
|
||||||
/// but for now keep things simple.
|
/// but for now keep things simple.
|
||||||
pub unsafe fn device(&self) -> Result<VkDevice, Error> {
|
pub unsafe fn device(&self) -> Result<VkDevice, Error> {
|
||||||
let devices = self.instance.enumerate_physical_devices()?;
|
let devices = self.instance.enumerate_physical_devices()?;
|
||||||
let (pdevice, qfi) =
|
let (pdevice, qfi) = choose_device(&self.instance, &devices).ok_or("no suitable device")?;
|
||||||
choose_device(&self.instance, &devices).ok_or("no suitable device")?;
|
|
||||||
|
|
||||||
let mut has_descriptor_indexing = false;
|
let mut has_descriptor_indexing = false;
|
||||||
let vk1_1 = self.vk_version >= vk::make_api_version(0, 1, 1, 0);
|
let vk1_1 = self.vk_version >= vk::make_api_version(0, 1, 1, 0);
|
||||||
|
@ -1456,7 +1466,10 @@ unsafe fn choose_device(
|
||||||
// both Metal and DX12 which do not require such validation. It might be worth
|
// both Metal and DX12 which do not require such validation. It might be worth
|
||||||
// exposing this to the user in a future device enumeration API, which would
|
// exposing this to the user in a future device enumeration API, which would
|
||||||
// also allow selection between discrete and integrated devices.
|
// also allow selection between discrete and integrated devices.
|
||||||
if info.queue_flags.contains(vk::QueueFlags::COMPUTE | vk::QueueFlags::GRAPHICS) {
|
if info
|
||||||
|
.queue_flags
|
||||||
|
.contains(vk::QueueFlags::COMPUTE | vk::QueueFlags::GRAPHICS)
|
||||||
|
{
|
||||||
return Some((*pdevice, ix as u32));
|
return Some((*pdevice, ix as u32));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,11 +28,12 @@ path = "../piet-gpu-types"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
piet = "0.2.0"
|
piet = "0.2.0"
|
||||||
png = "0.16.2"
|
png = "0.17.6"
|
||||||
rand = "0.7.3"
|
rand = "0.8.5"
|
||||||
roxmltree = "0.13"
|
roxmltree = "0.13"
|
||||||
winit = "0.26.1"
|
winit = {version = "0.27.3", default-features = false, features = ["x11", "wayland", "wayland-dlopen"]}
|
||||||
clap = "2.33"
|
raw-window-handle = "0.5"
|
||||||
|
clap = "3.2.22"
|
||||||
swash = "0.1.4"
|
swash = "0.1.4"
|
||||||
bytemuck = { version = "1.7.2", features = ["derive"] }
|
bytemuck = { version = "1.7.2", features = ["derive"] }
|
||||||
|
|
||||||
|
|
|
@ -6,15 +6,14 @@
|
||||||
//! Requires the [cargo-apk] tool.
|
//! Requires the [cargo-apk] tool.
|
||||||
//! [cargo-apk]: https://crates.io/crates/cargo-apk
|
//! [cargo-apk]: https://crates.io/crates/cargo-apk
|
||||||
|
|
||||||
use raw_window_handle::android::AndroidHandle;
|
use raw_window_handle::{
|
||||||
use raw_window_handle::{HasRawWindowHandle, RawWindowHandle};
|
AndroidDisplayHandle, AndroidNdkWindowHandle, RawDisplayHandle, RawWindowHandle,
|
||||||
|
};
|
||||||
|
|
||||||
use ndk::native_window::NativeWindow;
|
|
||||||
use ndk_glue::Event;
|
use ndk_glue::Event;
|
||||||
|
|
||||||
use piet_gpu_hal::{
|
use piet_gpu_hal::{
|
||||||
CmdBuf, Error, ImageLayout, Instance, InstanceFlags, QueryPool, Semaphore, Session,
|
Error, ImageLayout, Instance, InstanceFlags, Semaphore, Session, Surface, Swapchain,
|
||||||
SubmittedCmdBuf, Surface, Swapchain,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use piet::kurbo::Point;
|
use piet::kurbo::Point;
|
||||||
|
@ -27,10 +26,6 @@ fn main() {
|
||||||
my_main().unwrap();
|
my_main().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct MyHandle {
|
|
||||||
handle: AndroidHandle,
|
|
||||||
}
|
|
||||||
|
|
||||||
// State required to render and present the contents
|
// State required to render and present the contents
|
||||||
struct GfxState {
|
struct GfxState {
|
||||||
session: Session,
|
session: Session,
|
||||||
|
@ -53,9 +48,13 @@ fn my_main() -> Result<(), Error> {
|
||||||
if let Some(window) = &*window {
|
if let Some(window) = &*window {
|
||||||
let width = window.width() as usize;
|
let width = window.width() as usize;
|
||||||
let height = window.height() as usize;
|
let height = window.height() as usize;
|
||||||
let handle = get_handle(window);
|
|
||||||
let instance = Instance::new(InstanceFlags::default())?;
|
let instance = Instance::new(InstanceFlags::default())?;
|
||||||
let surface = unsafe { instance.surface(&handle)? };
|
let mut android_handle = AndroidNdkWindowHandle::empty();
|
||||||
|
android_handle.a_native_window = window.ptr().as_ptr() as *mut _;
|
||||||
|
let window_handle = RawWindowHandle::AndroidNdk(android_handle);
|
||||||
|
let display_handle =
|
||||||
|
RawDisplayHandle::Android(AndroidDisplayHandle::empty());
|
||||||
|
let surface = unsafe { instance.surface(display_handle, window_handle)? };
|
||||||
gfx_state = Some(GfxState::new(&instance, Some(&surface), width, height)?);
|
gfx_state = Some(GfxState::new(&instance, Some(&surface), width, height)?);
|
||||||
} else {
|
} else {
|
||||||
println!("native window is sadly none");
|
println!("native window is sadly none");
|
||||||
|
@ -74,24 +73,6 @@ fn my_main() -> Result<(), Error> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_handle(window: &NativeWindow) -> MyHandle {
|
|
||||||
println!(
|
|
||||||
"window = {:?}, {}x{}",
|
|
||||||
window.ptr(),
|
|
||||||
window.width(),
|
|
||||||
window.height()
|
|
||||||
);
|
|
||||||
let mut handle = AndroidHandle::empty();
|
|
||||||
handle.a_native_window = window.ptr().as_ptr() as *mut std::ffi::c_void;
|
|
||||||
MyHandle { handle }
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe impl HasRawWindowHandle for MyHandle {
|
|
||||||
fn raw_window_handle(&self) -> RawWindowHandle {
|
|
||||||
RawWindowHandle::Android(self.handle)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl GfxState {
|
impl GfxState {
|
||||||
fn new(
|
fn new(
|
||||||
instance: &Instance,
|
instance: &Instance,
|
||||||
|
|
|
@ -218,10 +218,10 @@ fn trace_ptcl(buf: &[u32]) {
|
||||||
fn main() -> Result<(), Error> {
|
fn main() -> Result<(), Error> {
|
||||||
let matches = App::new("piet-gpu test")
|
let matches = App::new("piet-gpu test")
|
||||||
.arg(Arg::with_name("INPUT").index(1))
|
.arg(Arg::with_name("INPUT").index(1))
|
||||||
.arg(Arg::with_name("flip").short("f").long("flip"))
|
.arg(Arg::with_name("flip").short('f').long("flip"))
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("scale")
|
Arg::with_name("scale")
|
||||||
.short("s")
|
.short('s')
|
||||||
.long("scale")
|
.long("scale")
|
||||||
.takes_value(true),
|
.takes_value(true),
|
||||||
)
|
)
|
||||||
|
@ -278,7 +278,7 @@ fn main() -> Result<(), Error> {
|
||||||
let ref mut w = BufWriter::new(file);
|
let ref mut w = BufWriter::new(file);
|
||||||
|
|
||||||
let mut encoder = png::Encoder::new(w, WIDTH as u32, HEIGHT as u32);
|
let mut encoder = png::Encoder::new(w, WIDTH as u32, HEIGHT as u32);
|
||||||
encoder.set_color(png::ColorType::RGBA);
|
encoder.set_color(png::ColorType::Rgba);
|
||||||
encoder.set_depth(png::BitDepth::Eight);
|
encoder.set_depth(png::BitDepth::Eight);
|
||||||
let mut writer = encoder.write_header().unwrap();
|
let mut writer = encoder.write_header().unwrap();
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,8 @@ use piet_gpu::{test_scenes, PicoSvg, PietGpuRenderContext, RenderDriver, Rendere
|
||||||
|
|
||||||
use clap::{App, Arg};
|
use clap::{App, Arg};
|
||||||
|
|
||||||
|
use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle};
|
||||||
|
|
||||||
use winit::{
|
use winit::{
|
||||||
event::{Event, WindowEvent},
|
event::{Event, WindowEvent},
|
||||||
event_loop::{ControlFlow, EventLoop},
|
event_loop::{ControlFlow, EventLoop},
|
||||||
|
@ -20,10 +22,10 @@ const HEIGHT: usize = 1536;
|
||||||
fn main() -> Result<(), Error> {
|
fn main() -> Result<(), Error> {
|
||||||
let matches = App::new("piet-gpu test")
|
let matches = App::new("piet-gpu test")
|
||||||
.arg(Arg::with_name("INPUT").index(1))
|
.arg(Arg::with_name("INPUT").index(1))
|
||||||
.arg(Arg::with_name("flip").short("f").long("flip"))
|
.arg(Arg::with_name("flip").short('f').long("flip"))
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("scale")
|
Arg::with_name("scale")
|
||||||
.short("s")
|
.short('s')
|
||||||
.long("scale")
|
.long("scale")
|
||||||
.takes_value(true),
|
.takes_value(true),
|
||||||
)
|
)
|
||||||
|
@ -60,7 +62,9 @@ fn main() -> Result<(), Error> {
|
||||||
let instance = Instance::new(InstanceFlags::default())?;
|
let instance = Instance::new(InstanceFlags::default())?;
|
||||||
let mut info_string = "info".to_string();
|
let mut info_string = "info".to_string();
|
||||||
unsafe {
|
unsafe {
|
||||||
let surface = instance.surface(&window)?;
|
let display_handle = window.raw_display_handle();
|
||||||
|
let window_handle = window.raw_window_handle();
|
||||||
|
let surface = instance.surface(display_handle, window_handle)?;
|
||||||
let device = instance.device()?;
|
let device = instance.device()?;
|
||||||
let mut swapchain = instance.swapchain(WIDTH / 2, HEIGHT / 2, &device, &surface)?;
|
let mut swapchain = instance.swapchain(WIDTH / 2, HEIGHT / 2, &device, &surface)?;
|
||||||
let session = Session::new(device);
|
let session = Session::new(device);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
use rand::{Rng, RngCore};
|
use rand::{Rng, RngCore};
|
||||||
|
|
||||||
use crate::{Blend, BlendMode, Colrv1RadialGradient, CompositionMode, PietGpuRenderContext};
|
use crate::{Blend, BlendMode, Colrv1RadialGradient, PietGpuRenderContext};
|
||||||
use piet::kurbo::{Affine, BezPath, Circle, Line, Point, Rect, Shape};
|
use piet::kurbo::{Affine, BezPath, Circle, Line, Point, Rect, Shape};
|
||||||
use piet::{
|
use piet::{
|
||||||
Color, GradientStop, LinearGradient, Text, TextAttribute, TextLayoutBuilder, UnitPoint,
|
Color, GradientStop, LinearGradient, Text, TextAttribute, TextLayoutBuilder, UnitPoint,
|
||||||
|
@ -34,10 +34,10 @@ pub fn render_scene(rc: &mut PietGpuRenderContext) {
|
||||||
for _ in 0..N_CIRCLES {
|
for _ in 0..N_CIRCLES {
|
||||||
let color = Color::from_rgba32_u32(rng.next_u32());
|
let color = Color::from_rgba32_u32(rng.next_u32());
|
||||||
let center = Point::new(
|
let center = Point::new(
|
||||||
rng.gen_range(0.0, WIDTH as f64),
|
rng.gen_range(0.0..WIDTH as f64),
|
||||||
rng.gen_range(0.0, HEIGHT as f64),
|
rng.gen_range(0.0..HEIGHT as f64),
|
||||||
);
|
);
|
||||||
let radius = rng.gen_range(0.0, 50.0);
|
let radius = rng.gen_range(0.0..50.0);
|
||||||
let circle = Circle::new(center, radius);
|
let circle = Circle::new(center, radius);
|
||||||
rc.fill(circle, &color);
|
rc.fill(circle, &color);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ edition = "2021"
|
||||||
default = ["piet-gpu"]
|
default = ["piet-gpu"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = "2.33"
|
clap = "3.2.22"
|
||||||
bytemuck = "1.7.2"
|
bytemuck = "1.7.2"
|
||||||
kurbo = "0.7.1"
|
kurbo = "0.7.1"
|
||||||
rand = "0.7.3"
|
rand = "0.7.3"
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
//! Tests for the piet-gpu draw object stage.
|
//! Tests for the piet-gpu draw object stage.
|
||||||
|
|
||||||
use piet_gpu_hal::{BufWrite, BufferUsage};
|
use piet_gpu_hal::{BufWrite, BufferUsage};
|
||||||
use rand::{seq::SliceRandom, Rng};
|
use rand::seq::SliceRandom;
|
||||||
|
|
||||||
use crate::{Config, Runner, TestResult};
|
use crate::{Config, Runner, TestResult};
|
||||||
|
|
||||||
|
|
|
@ -42,27 +42,27 @@ fn main() {
|
||||||
let matches = App::new("piet-gpu-tests")
|
let matches = App::new("piet-gpu-tests")
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("verbose")
|
Arg::with_name("verbose")
|
||||||
.short("v")
|
.short('v')
|
||||||
.long("verbose")
|
.long("verbose")
|
||||||
.help("Verbose reporting of results"),
|
.help("Verbose reporting of results"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("groups")
|
Arg::with_name("groups")
|
||||||
.short("g")
|
.short('g')
|
||||||
.long("groups")
|
.long("groups")
|
||||||
.help("Groups to run")
|
.help("Groups to run")
|
||||||
.takes_value(true),
|
.takes_value(true),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("size")
|
Arg::with_name("size")
|
||||||
.short("s")
|
.short('s')
|
||||||
.long("size")
|
.long("size")
|
||||||
.help("Size of tests")
|
.help("Size of tests")
|
||||||
.takes_value(true),
|
.takes_value(true),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("n_iter")
|
Arg::with_name("n_iter")
|
||||||
.short("n")
|
.short('n')
|
||||||
.long("n_iter")
|
.long("n_iter")
|
||||||
.help("Number of iterations")
|
.help("Number of iterations")
|
||||||
.takes_value(true),
|
.takes_value(true),
|
||||||
|
|
Loading…
Reference in a new issue