Skip to content

Commit f676e44

Browse files
committed
Allow for disabling initialization tracking.
1 parent 4a4ed30 commit f676e44

17 files changed

+1471
-487
lines changed

naga-test/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ pub struct SpirvOutParameters {
114114
pub separate_entry_points: bool,
115115
#[serde(deserialize_with = "deserialize_binding_map")]
116116
pub binding_map: naga::back::spv::BindingMap,
117+
pub ray_query_initialization_tracking: bool,
117118
pub use_storage_input_output_16: bool,
118119
}
119120
impl Default for SpirvOutParameters {
@@ -126,6 +127,7 @@ impl Default for SpirvOutParameters {
126127
force_point_size: false,
127128
clamp_frag_depth: false,
128129
separate_entry_points: false,
130+
ray_query_initialization_tracking: true,
129131
use_storage_input_output_16: true,
130132
binding_map: naga::back::spv::BindingMap::default(),
131133
}
@@ -159,6 +161,7 @@ impl SpirvOutParameters {
159161
binding_map: self.binding_map.clone(),
160162
zero_initialize_workgroup_memory: spv::ZeroInitializeWorkgroupMemoryMode::Polyfill,
161163
force_loop_bounding: true,
164+
ray_query_initialization_tracking: true,
162165
debug_info,
163166
use_storage_input_output_16: self.use_storage_input_output_16,
164167
}

naga/src/back/spv/mod.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,7 @@ pub struct Writer {
798798

799799
/// Non semantic debug printf extension `OpExtInstImport`
800800
debug_printf: Option<Word>,
801+
pub(crate) ray_query_initialization_tracking: bool,
801802
}
802803

803804
bitflags::bitflags! {
@@ -833,7 +834,8 @@ bitflags::bitflags! {
833834
/// Instead of silently failing if the arguments to generate a ray query are
834835
/// invalid, uses debug printf extension to print to the command line
835836
///
836-
/// Note: VK_KHR_shader_non_semantic_info must be enabled.
837+
/// Note: VK_KHR_shader_non_semantic_info must be enabled. This will have no
838+
/// effect if `options.ray_query_initialization_tracking` is set to false.
837839
const PRINT_ON_RAY_QUERY_INITIALIZATION_FAIL = 0x20;
838840
}
839841
}
@@ -905,6 +907,10 @@ pub struct Options<'a> {
905907
/// to think the number of iterations is bounded.
906908
pub force_loop_bounding: bool,
907909

910+
/// if set, ray queries will get a variable to track their state to prevent
911+
/// misuse.
912+
pub ray_query_initialization_tracking: bool,
913+
908914
/// Whether to use the `StorageInputOutput16` capability for `f16` shader I/O.
909915
/// When false, `f16` I/O is polyfilled using `f32` types with conversions.
910916
pub use_storage_input_output_16: bool,
@@ -929,6 +935,7 @@ impl Default for Options<'_> {
929935
bounds_check_policies: BoundsCheckPolicies::default(),
930936
zero_initialize_workgroup_memory: ZeroInitializeWorkgroupMemoryMode::Polyfill,
931937
force_loop_bounding: true,
938+
ray_query_initialization_tracking: true,
932939
use_storage_input_output_16: true,
933940
debug_info: None,
934941
}

0 commit comments

Comments
 (0)