Skip to content

Commit

Permalink
load spirv using correct API (bevyengine#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 authored and mockersf committed Jan 1, 2022
1 parent c0520c3 commit e463d9c
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 e463d9c

Please sign in to comment.