Skip to content

Commit

Permalink
Merge pull request #1412 from caspark/fix-wgpu-example
Browse files Browse the repository at this point in the history
Make wgpu example compile and run again
  • Loading branch information
Cobrand authored Jun 26, 2024
2 parents c06bf40 + fd4844b commit a57f9ad
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions examples/raw-window-handle-with-wgpu/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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 {
Expand All @@ -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,
Expand Down

0 comments on commit a57f9ad

Please sign in to comment.