mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 14:55:05 +00:00
Check if source
is empty when constructing hal::DebugSource
This commit is contained in:
parent
7f72c9fc3b
commit
261cb7c27d
@ -1325,18 +1325,19 @@ impl<A: HalApi> Device<A> {
|
||||
.contains(wgt::DownlevelFlags::CUBE_ARRAY_TEXTURES),
|
||||
);
|
||||
|
||||
let debug_source = if self.instance_flags.contains(wgt::InstanceFlags::DEBUG) {
|
||||
Some(hal::DebugSource {
|
||||
file_name: Cow::Owned(
|
||||
desc.label
|
||||
.as_ref()
|
||||
.map_or("shader".to_string(), |l| l.to_string()),
|
||||
),
|
||||
source_code: Cow::Owned(source.clone()),
|
||||
})
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let debug_source =
|
||||
if self.instance_flags.contains(wgt::InstanceFlags::DEBUG) && !source.is_empty() {
|
||||
Some(hal::DebugSource {
|
||||
file_name: Cow::Owned(
|
||||
desc.label
|
||||
.as_ref()
|
||||
.map_or("shader".to_string(), |l| l.to_string()),
|
||||
),
|
||||
source_code: Cow::Owned(source.clone()),
|
||||
})
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let info = naga::valid::Validator::new(naga::valid::ValidationFlags::all(), caps)
|
||||
.validate(&module)
|
||||
|
Loading…
Reference in New Issue
Block a user