mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
glsl: reflect textures without samplers
This commit is contained in:
@@ -2718,13 +2718,13 @@ impl<'a, W: Write> Writer<'a, W> {
|
|||||||
fn collect_reflection_info(&self) -> Result<ReflectionInfo, Error> {
|
fn collect_reflection_info(&self) -> Result<ReflectionInfo, Error> {
|
||||||
use std::collections::hash_map::Entry;
|
use std::collections::hash_map::Entry;
|
||||||
let info = self.info.get_entry_point(self.entry_point_idx as usize);
|
let info = self.info.get_entry_point(self.entry_point_idx as usize);
|
||||||
let mut mappings = crate::FastHashMap::default();
|
let mut texture_mapping = crate::FastHashMap::default();
|
||||||
let mut uniforms = crate::FastHashMap::default();
|
let mut uniforms = crate::FastHashMap::default();
|
||||||
|
|
||||||
for sampling in info.sampling_set.iter() {
|
for sampling in info.sampling_set.iter() {
|
||||||
let tex_name = self.reflection_names_globals[&sampling.image].clone();
|
let tex_name = self.reflection_names_globals[&sampling.image].clone();
|
||||||
|
|
||||||
match mappings.entry(tex_name) {
|
match texture_mapping.entry(tex_name) {
|
||||||
Entry::Vacant(v) => {
|
Entry::Vacant(v) => {
|
||||||
v.insert(TextureMapping {
|
v.insert(TextureMapping {
|
||||||
texture: sampling.image,
|
texture: sampling.image,
|
||||||
@@ -2752,12 +2752,26 @@ impl<'a, W: Write> Writer<'a, W> {
|
|||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
},
|
},
|
||||||
_ => continue,
|
crate::TypeInner::Image { .. } => {
|
||||||
|
let tex_name = self.reflection_names_globals[&handle].clone();
|
||||||
|
match texture_mapping.entry(tex_name) {
|
||||||
|
Entry::Vacant(v) => {
|
||||||
|
v.insert(TextureMapping {
|
||||||
|
texture: handle,
|
||||||
|
sampler: None,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Entry::Occupied(_) => {
|
||||||
|
// already used with a sampler, do nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(ReflectionInfo {
|
Ok(ReflectionInfo {
|
||||||
texture_mapping: mappings,
|
texture_mapping,
|
||||||
uniforms,
|
uniforms,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user