Skip to content

Commit

Permalink
load spirv using correct API (#3466)
Browse files Browse the repository at this point in the history
# Objective

currently spirv source loading parse then desterilize it to make wgpu happy.

## Solution

Use the right API to get spirv
  • Loading branch information
molikto committed Dec 30, 2021
1 parent b532cc9 commit 3ac55f0
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions crates/bevy_render/src/render_resource/shader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::{
borrow::Cow, collections::HashSet, marker::Copy, ops::Deref, path::PathBuf, str::FromStr,
};
use thiserror::Error;
use wgpu::{ShaderModuleDescriptor, ShaderSource};
use wgpu::{util::make_spirv, ShaderModuleDescriptor, ShaderSource};

#[derive(Copy, Clone, Hash, Eq, PartialEq, Debug)]
pub struct ShaderId(Uuid);
Expand Down Expand Up @@ -172,12 +172,7 @@ impl ProcessedShader {
let wgsl = reflection.get_wgsl()?;
ShaderSource::Wgsl(wgsl.into())
}
ProcessedShader::SpirV(_) => {
// TODO: we can probably just transmute the u8 array to u32?
let reflection = self.reflect()?;
let spirv = reflection.get_spirv()?;
ShaderSource::SpirV(Cow::Owned(spirv))
}
ProcessedShader::SpirV(source) => make_spirv(source),
},
})
}
Expand Down

0 comments on commit 3ac55f0

Please sign in to comment.