Increase WGPU limits to what's supported by the adapter (#1251)

* Increase Wgpu limits

* Fix compilation of shaders

* Unbreak debug options
This commit is contained in:
Dennis Kobert 2023-05-28 00:23:47 +02:00 committed by Keavon Chambers
parent 7148b199ec
commit 6289d92e02
5 changed files with 14 additions and 5 deletions

View file

@ -15,6 +15,9 @@ pub mod color;
pub mod discrete_srgb;
pub use adjustments::*;
#[cfg(target_arch = "spirv")]
use num_traits::Float;
pub trait Linear {
fn from_f32(x: f32) -> Self;
fn to_f32(self) -> f32;

View file

@ -1,7 +1,8 @@
use dyn_any::{DynAny, StaticType};
use glam::{DAffine2, DVec2};
#[derive(Debug, Clone, DynAny)]
#[cfg_attr(not(target_arch = "spirv"), derive(Debug))]
#[derive(Clone, DynAny)]
pub struct AxisAlignedBbox {
pub start: DVec2,
pub end: DVec2,
@ -45,7 +46,8 @@ impl AxisAlignedBbox {
}
}
#[derive(Debug, Clone)]
#[cfg_attr(not(target_arch = "spirv"), derive(Debug))]
#[derive(Clone)]
pub struct Bbox {
pub top_left: DVec2,
pub top_right: DVec2,

View file

@ -68,7 +68,7 @@ pub fn float_to_srgb_u8(mut f: f32) -> u8 {
// We clamped f to [0, 1], and the integer representations
// of the positive finite non-NaN floats are monotonic.
// This makes the later LUT lookup panicless.
unsafe { std::hint::unreachable_unchecked() }
unsafe { core::hint::unreachable_unchecked() }
}
// Compute a piecewise linear interpolation that is always

View file

@ -164,7 +164,7 @@ async fn map_gpu(image: ImageFrame<Color>, node: DocumentNode) -> ImageFrame<Col
output_buffer: output_buffer.clone(),
};
log::debug!("created pipeline");
let compute_pass = executor.create_compute_pass(&pipeline, Some(readback_buffer.clone()), len.min(65535) as u32).unwrap();
let compute_pass = executor.create_compute_pass(&pipeline, Some(readback_buffer.clone()), len as u32).unwrap();
executor.execute_compute_pipeline(compute_pass).unwrap();
log::debug!("executed pipeline");
log::debug!("reading buffer");

View file

@ -16,6 +16,10 @@ impl Context {
// `request_adapter` instantiates the general connection to the GPU
let adapter = instance.request_adapter(&wgpu::RequestAdapterOptions::default()).await?;
let limits = adapter.limits();
log::trace!("Adapter limits: {:?}", limits);
// `request_device` instantiates the feature specific connection to the GPU, defining some parameters,
// `features` being the available features.
let (device, queue) = adapter
@ -23,7 +27,7 @@ impl Context {
&wgpu::DeviceDescriptor {
label: None,
features: wgpu::Features::empty(),
limits: wgpu::Limits::downlevel_defaults(),
limits,
},
None,
)