Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kanerogers/issue182 #194

Merged
merged 2 commits into from
Apr 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions hotham-simulator/src/simulator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,6 @@ pub unsafe extern "system" fn create_vulkan_instance(
for ext in &(*xr_extensions) {
enabled_extensions.push(CStr::from_ptr(*ext));
}
enabled_extensions.push(CStr::from_bytes_with_nul_unchecked(b"VK_EXT_debug_utils\0"));
create_info.pp_enabled_layer_names =
[CStr::from_bytes_with_nul_unchecked(b"VK_LAYER_KHRONOS_validation\0").as_ptr()].as_ptr();
create_info.enabled_layer_count = 1;

let enabled_extensions = enabled_extensions
.iter()
Expand Down
15 changes: 10 additions & 5 deletions hotham/src/resources/vulkan_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,15 @@ fn vulkan_init_legacy(
unsafe {
let app_name = CString::new("Hotham Asteroid")?;
let entry = Entry::new()?;

#[cfg(debug_assertions)]
let layers = vec!["VK_LAYER_KHRONOS_validation\0"];

#[cfg(not(debug_assertions))]
let layers = vec![];

println!("[HOTHAM_VULKAN] Requesting layers: {:?}", layers);

let layer_names = get_raw_strings(layers);
let mut vk_instance_exts = xr_instance
.vulkan_legacy_instance_extensions(system)
Expand All @@ -1114,7 +1122,7 @@ fn vulkan_init_legacy(
vk_instance_exts.push(vk::ExtDebugUtilsFn::name().to_owned());

println!(
"Required Vulkan instance extensions: {:?}",
"[HOTHAM_VULKAN] Required Vulkan instance extensions: {:?}",
vk_instance_exts
);
let vk_instance_ext_ptrs = vk_instance_exts
Expand All @@ -1126,15 +1134,12 @@ fn vulkan_init_legacy(
.application_name(&app_name)
.api_version(vk::make_api_version(0, 1, 2, 0));

let validation_features_enables = [
// vk::ValidationFeatureEnableEXT::BEST_PRACTICES,
];
let validation_features_enables = [];
let validation_features_disables = [];
let mut validation_features = vk::ValidationFeaturesEXT::builder()
.enabled_validation_features(&validation_features_enables)
.disabled_validation_features(&validation_features_disables);

// TODO: Disable validation in release
let instance = entry
.create_instance(
&vk::InstanceCreateInfo::builder()
Expand Down