mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
feat: correct bounds policy checking on MSL (#3603)
This commit is contained in:
parent
7495646d5f
commit
a502282307
@ -139,6 +139,7 @@ By @teoxoy in [#3534](https://github.com/gfx-rs/wgpu/pull/3534)
|
||||
#### Metal
|
||||
- `create_texture` returns an error if `new_texture` returns NULL. By @jinleili in [#3554](https://github.com/gfx-rs/wgpu/pull/3554)
|
||||
- Fix definition of `NSOperatingSystemVersion` to avoid potential crashes. By @grovesNL in [#3557](https://github.com/gfx-rs/wgpu/pull/3557)
|
||||
- Fix shader bounds checking being ignored. By @FL33TW00D in [#3603](https://github.com/gfx-rs/wgpu/pull/3603)
|
||||
|
||||
## wgpu-0.15.0 (2023-01-25)
|
||||
|
||||
|
||||
@ -75,11 +75,25 @@ impl super::Device {
|
||||
},
|
||||
};
|
||||
|
||||
let mut temp_options;
|
||||
let options = if !stage.module.runtime_checks {
|
||||
temp_options = layout.naga_options.clone();
|
||||
temp_options.bounds_check_policies = naga::proc::BoundsCheckPolicies {
|
||||
index: naga::proc::BoundsCheckPolicy::Unchecked,
|
||||
buffer: naga::proc::BoundsCheckPolicy::Unchecked,
|
||||
image: naga::proc::BoundsCheckPolicy::Unchecked,
|
||||
binding_array: naga::proc::BoundsCheckPolicy::Unchecked,
|
||||
};
|
||||
&temp_options
|
||||
} else {
|
||||
&layout.naga_options
|
||||
};
|
||||
|
||||
let module = &stage.module.naga.module;
|
||||
let (source, info) = naga::back::msl::write_string(
|
||||
module,
|
||||
&stage.module.naga.info,
|
||||
&layout.naga_options,
|
||||
options,
|
||||
&pipeline_options,
|
||||
)
|
||||
.map_err(|e| crate::PipelineError::Linkage(stage_bit, format!("MSL: {:?}", e)))?;
|
||||
@ -777,11 +791,14 @@ impl crate::Device<super::Api> for super::Device {
|
||||
|
||||
unsafe fn create_shader_module(
|
||||
&self,
|
||||
_desc: &crate::ShaderModuleDescriptor,
|
||||
desc: &crate::ShaderModuleDescriptor,
|
||||
shader: crate::ShaderInput,
|
||||
) -> Result<super::ShaderModule, crate::ShaderError> {
|
||||
match shader {
|
||||
crate::ShaderInput::Naga(naga) => Ok(super::ShaderModule { naga }),
|
||||
crate::ShaderInput::Naga(naga) => Ok(super::ShaderModule {
|
||||
naga,
|
||||
runtime_checks: desc.runtime_checks,
|
||||
}),
|
||||
crate::ShaderInput::SpirV(_) => {
|
||||
panic!("SPIRV_SHADER_PASSTHROUGH is not enabled for this backend")
|
||||
}
|
||||
|
||||
@ -622,6 +622,7 @@ unsafe impl Sync for BindGroup {}
|
||||
#[derive(Debug)]
|
||||
pub struct ShaderModule {
|
||||
naga: crate::NagaShader,
|
||||
runtime_checks: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user