mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-23 07:51:08 +01:00
[spv-out]: Ensure array subscripts are in bounds.
This commit is contained in:
1 parent
a7cacab276
commit
c16f2097ad
19 files changed
+1415
-104
No files matched your search
@@ -6,6 +6,7 @@ use std::{env, error::Error, path::Path};
|
||||
#[derive(Default)]
|
||||
struct Parameters {
|
||||
validation_flags: naga::valid::ValidationFlags,
|
||||
index_bounds_check_policy: naga::back::IndexBoundsCheckPolicy,
|
||||
spv_adjust_coordinate_space: bool,
|
||||
spv_flow_dump_prefix: Option<String>,
|
||||
spv: naga::back::spv::Options,
|
||||
@@ -69,6 +70,24 @@ fn main() {
|
||||
params.validation_flags =
|
||||
naga::valid::ValidationFlags::from_bits(value).unwrap();
|
||||
}
|
||||
"index-bounds-check-policy" => {
|
||||
let value = args.next().unwrap();
|
||||
params.index_bounds_check_policy = match value.as_str() {
|
||||
"Restrict" => naga::back::IndexBoundsCheckPolicy::Restrict,
|
||||
"ReadZeroSkipWrite" => {
|
||||
naga::back::IndexBoundsCheckPolicy::ReadZeroSkipWrite
|
||||
}
|
||||
"UndefinedBehavior" => {
|
||||
naga::back::IndexBoundsCheckPolicy::UndefinedBehavior
|
||||
}
|
||||
other => {
|
||||
panic!(
|
||||
"Unrecognized '--index-bounds-check-policy' value: {:?}",
|
||||
other
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
"flow-dir" => params.spv_flow_dump_prefix = args.next(),
|
||||
"entry-point" => params.glsl.entry_point = args.next().unwrap(),
|
||||
"profile" => {
|
||||
@@ -241,6 +260,8 @@ fn main() {
|
||||
"spv" => {
|
||||
use naga::back::spv;
|
||||
|
||||
params.spv.index_bounds_check_policy = params.index_bounds_check_policy;
|
||||
|
||||
let spv =
|
||||
spv::write_vec(&module, info.as_ref().unwrap(), ¶ms.spv).unwrap_pretty();
|
||||
let bytes = spv
|
||||
|
||||
Reference in new issue
Block a user