From fd4844bdbd284dfaaed0dc365aade0051ef3be69 Mon Sep 17 00:00:00 2001 From: Caspar Krieger Date: Wed, 26 Jun 2024 09:56:42 +0800 Subject: [PATCH] Make wgpu example compile and run again --- examples/raw-window-handle-with-wgpu/main.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/examples/raw-window-handle-with-wgpu/main.rs b/examples/raw-window-handle-with-wgpu/main.rs index b5038449a6..206f57f01b 100644 --- a/examples/raw-window-handle-with-wgpu/main.rs +++ b/examples/raw-window-handle-with-wgpu/main.rs @@ -4,6 +4,7 @@ extern crate sdl2; extern crate wgpu; use std::borrow::Cow; +use std::collections::HashMap; use wgpu::SurfaceError; use sdl2::event::{Event, WindowEvent}; @@ -79,12 +80,18 @@ fn main() -> Result<(), String> { push_constant_ranges: &[], }); + let compilation_options = wgpu::PipelineCompilationOptions { + constants: &HashMap::new(), + zero_initialize_workgroup_memory: true, + }; + let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor { layout: Some(&pipeline_layout), vertex: wgpu::VertexState { buffers: &[], module: &shader, entry_point: "vs_main", + compilation_options: compilation_options.clone(), }, fragment: Some(wgpu::FragmentState { targets: &[Some(wgpu::ColorTargetState { @@ -94,6 +101,7 @@ fn main() -> Result<(), String> { })], module: &shader, entry_point: "fs_main", + compilation_options: compilation_options.clone(), }), primitive: wgpu::PrimitiveState { topology: wgpu::PrimitiveTopology::TriangleList,