Skip to content

Commit 7b90577

Browse files
committed
lower max push constant size
close #49
1 parent ce0e2b6 commit 7b90577

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/main.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use winit::event::{ElementState, MouseButton, WindowEvent};
1010
use winit::event_loop::{ActiveEventLoop, ControlFlow, EventLoop};
1111
use winit::keyboard::NamedKey;
1212
use winit::window::{Window, WindowAttributes, WindowId};
13+
use shared::ShaderConstants;
1314

1415
#[self_referencing]
1516
struct WindowSurface {
@@ -105,8 +106,15 @@ impl ShaderToyApp {
105106
{
106107
required_features |= wgpu::Features::SPIRV_SHADER_PASSTHROUGH;
107108
}
109+
110+
const MAX_PUSH_CONSTANT_SIZE: u32 = {
111+
let v = size_of::<ShaderConstants>();
112+
// Not sure if this is portable on Metal or DX12 in the first place...
113+
assert!(v <= 128, "Push constant larger than the minimum that Vulkan requires, may not be portable!");
114+
v as u32
115+
};
108116
let required_limits = wgpu::Limits {
109-
max_push_constant_size: 256,
117+
max_push_constant_size: MAX_PUSH_CONSTANT_SIZE,
110118
..Default::default()
111119
};
112120
let (device, queue) = adapter

0 commit comments

Comments
 (0)