Skip to content

Updates, cleanup #450

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

Merged
merged 7 commits into from
Jun 30, 2025
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
59 changes: 49 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,55 @@
[workspace]
members = [
"benchmarks/stress-test",
"examples/complex-scene",
"examples/crab-saber",
"examples/custom-rendering",
"examples/shared",
"examples/simple-scene",
"hotham-asset-client",
"hotham-asset-server",
"hotham-simulator",
"hotham",
"benchmarks/stress-test",
"examples/complex-scene",
"examples/crab-saber",
"examples/custom-rendering",
"examples/shared",
"examples/simple-scene",
"hotham-asset-client",
"hotham-asset-server",
"hotham",
]
resolver = "2"

[workspace.dependencies]
ash = "0.38.0"
anyhow = "1.0"
bitflags = "1.3"
cpal = "0.15.2"
ctrlc = { version = "3", features = ["termination"] }
egui = "0.15"
generational-arena = "0.2.8"
glam = { features = ["mint", "serde", "approx"], version = "0.23" }
gltf = { version = "1.0", features = [
"KHR_lights_punctual",
"KHR_materials_unlit",
"names",
"utils",
], default-features = false }
half = "2.1.0"
hecs = "0.10.1"
hotham-asset-client = { path = "../hotham-asset-client" }
id-arena = "2.2.1"
image = { version = "0.24.3", default-features = false, features = [
"jpeg",
"png",
] }
itertools = "0.10.0"
ktx2 = { git = "https://github.com/BVE-Reborn/ktx2", rev = "be27131c716686a416e6a805a26384f74a7353ff" }
mint = "0.5.6"
notify-debouncer-mini = "0.2.1"
oddio = "0.5"
openxr = { features = ["loaded", "mint"], version = "0.17" }
rand = "0.8"
rapier3d = "0.17"
ruzstd = "0.3"
serde = { version = "1.0", features = ["derive"] }
symphonia = { version = "0.5", default-features = false, features = ["mp3"] }
thiserror = "1.0"
tokio = { version = "1.0.1", default-features = false, features = ["rt"] }
vk-shader-macros = "0.2.8"


# Make performance critical packages compile with optimizations
[profile.dev.package.rapier3d]
Expand Down
9 changes: 6 additions & 3 deletions benchmarks/stress-test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
edition = "2018"
edition = "2021"
license = "MIT OR Apache-2.0"
name = "hotham-stress-test"
version = "0.2.0"
Expand All @@ -12,7 +12,7 @@ name = "hotham_stress_test_desktop"
path = "src/main.rs"

[dependencies]
hotham = {path = "../../hotham"}
hotham = { path = "../../hotham" }

[target.'cfg(target_os = "android")'.dependencies]
ndk-glue = "0.6"
Expand Down Expand Up @@ -49,7 +49,10 @@ value = "vr_only"

[[package.metadata.android.application.activity.intent_filter]]
actions = ["android.intent.action.MAIN"]
categories = ["com.oculus.intent.category.VR", "android.intent.category.LAUNCHER"]
categories = [
"com.oculus.intent.category.VR",
"android.intent.category.LAUNCHER",
]

[[package.metadata.android.application.activity.meta_data]]
name = "com.oculus.vr.focusaware"
Expand Down
11 changes: 7 additions & 4 deletions examples/complex-scene/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
edition = "2018"
edition = "2021"
license = "MIT OR Apache-2.0"
name = "complex-scene-example"
version = "0.2.0"
Expand All @@ -12,8 +12,8 @@ name = "hotham_complex_scene_example"
path = "src/main.rs"

[dependencies]
hotham = {path = "../../hotham"}
hotham-examples = {path = "../shared"}
hotham = { path = "../../hotham" }
hotham-examples = { path = "../shared" }

[target.'cfg(target_os = "android")'.dependencies]
ndk-glue = "0.6"
Expand Down Expand Up @@ -50,7 +50,10 @@ value = "vr_only"

[[package.metadata.android.application.activity.intent_filter]]
actions = ["android.intent.action.MAIN"]
categories = ["com.oculus.intent.category.VR", "android.intent.category.LAUNCHER"]
categories = [
"com.oculus.intent.category.VR",
"android.intent.category.LAUNCHER",
]

[[package.metadata.android.application.activity.meta_data]]
name = "com.oculus.vr.focusaware"
Expand Down
15 changes: 9 additions & 6 deletions examples/crab-saber/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
[package]
edition = "2018"
edition = "2021"
license = "MIT OR Apache-2.0"
name = "crab-saber"
version = "0.2.0"

[lib]
crate-type = ["lib", "cdylib"]
crate-type = ["rlib", "cdylib"]

[[bin]]
name = "hotham_crab_saber"
path = "src/main.rs"

[dependencies]
hotham = {path = "../../hotham"}
hotham = { path = "../../hotham" }
rand = "0.8.0"

[dev-dependencies]
approx = "0.5"

[target.'cfg(target_os = "android")'.dependencies]
ndk-glue = "0.6"
ndk-glue = "0.7"

[package.metadata.android]
apk_label = "Crab Saber"
fullscreen = true
runtime_libs = "../common_lib"
target_sdk_version = 29
target_sdk_version = 33

[[package.metadata.android.uses_permission]]
name = "android.permission.INTERNET"
Expand Down Expand Up @@ -53,7 +53,10 @@ value = "vr_only"

[[package.metadata.android.application.activity.intent_filter]]
actions = ["android.intent.action.MAIN"]
categories = ["com.oculus.intent.category.VR", "android.intent.category.LAUNCHER"]
categories = [
"com.oculus.intent.category.VR",
"android.intent.category.LAUNCHER",
]

[[package.metadata.android.application.activity.meta_data]]
name = "com.oculus.vr.focusaware"
Expand Down
2 changes: 0 additions & 2 deletions examples/crab-saber/src/game_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ pub struct GameContext {
pub red_saber: Entity,
pub backstop: Entity,
pub songs: HashMap<String, Song>,
pub models: HashMap<String, World>,
pub last_spawn_time: Instant,
pub sound_effects: HashMap<String, SoundEmitter>,
}
Expand Down Expand Up @@ -120,7 +119,6 @@ impl GameContext {
blue_saber: sabers[0],
red_saber: sabers[1],
songs: Default::default(),
models,
last_spawn_time: Instant::now().checked_sub(Duration::new(100, 0)).unwrap(),
sound_effects: Default::default(),
}
Expand Down
7 changes: 2 additions & 5 deletions examples/crab-saber/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
use crab_saber::real_main;
use hotham::HothamResult;

fn main() -> HothamResult<()> {
real_main()
fn main() {
crab_saber::real_main().unwrap()
}
5 changes: 1 addition & 4 deletions examples/crab-saber/src/systems/game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,7 @@ fn transition(
panel.text = format!("Game Over\n{message}");
panel.buttons = vec![UIPanelButton::new("Back to main menu")];
}
_ => panic!(
"Invalid state transition {:?} -> {:?}",
current_state, next_state
),
_ => panic!("Invalid state transition {current_state:?} -> {next_state:?}",),
}

game_context.state = next_state;
Expand Down
1 change: 0 additions & 1 deletion examples/crab-saber/src/systems/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pub mod game;
pub mod sabers;
pub use game::game_system;
pub use sabers::sabers_system;
11 changes: 7 additions & 4 deletions examples/custom-rendering/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
edition = "2018"
edition = "2021"
license = "MIT OR Apache-2.0"
name = "custom-rendering-example"
version = "0.2.0"
Expand All @@ -12,8 +12,8 @@ name = "hotham_custom_rendering_example"
path = "src/main.rs"

[dependencies]
hotham = {path = "../../hotham"}
hotham-examples = {path = "../shared"}
hotham = { path = "../../hotham" }
hotham-examples = { path = "../shared" }

[target.'cfg(target_os = "android")'.dependencies]
ndk-glue = "0.6"
Expand Down Expand Up @@ -50,7 +50,10 @@ value = "vr_only"

[[package.metadata.android.application.activity.intent_filter]]
actions = ["android.intent.action.MAIN"]
categories = ["com.oculus.intent.category.VR", "android.intent.category.LAUNCHER"]
categories = [
"com.oculus.intent.category.VR",
"android.intent.category.LAUNCHER",
]

[[package.metadata.android.application.activity.meta_data]]
name = "com.oculus.vr.focusaware"
Expand Down
43 changes: 20 additions & 23 deletions examples/custom-rendering/src/custom_render_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ pub struct CustomRenderContext {
/// Data for the holographic primitives that will be drawn this frame, indexed by gl_InstanceId
pub quadrics_data_buffer: Buffer<QuadricData>,
/// Descriptors for quadrics pipeline
#[allow(unused)]
pub quadrics_descriptor_set_layout: vk::DescriptorSetLayout,
pub quadrics_descriptor_set: vk::DescriptorSet,

Expand All @@ -69,7 +70,7 @@ impl CustomRenderContext {
render_context.descriptors.graphics_layout,
quadrics_descriptor_set_layout,
];
let create_info = &vk::PipelineLayoutCreateInfo::builder().set_layouts(&layouts);
let create_info = &vk::PipelineLayoutCreateInfo::default().set_layouts(&layouts);
let quadrics_pipeline_layout =
unsafe { device.create_pipeline_layout(create_info, None).unwrap() };
let vertex_shader_code: Vec<u32> = QUADRIC_VERT.into();
Expand All @@ -87,7 +88,7 @@ impl CustomRenderContext {
vulkan_context
.device
.allocate_descriptor_sets(
&vk::DescriptorSetAllocateInfo::builder()
&vk::DescriptorSetAllocateInfo::default()
.descriptor_pool(render_context.descriptors.pool)
.set_layouts(slice::from_ref(&quadrics_descriptor_set_layout)),
)
Expand Down Expand Up @@ -133,12 +134,12 @@ fn create_quadrics_descriptor_set_layout(device: &ash::Device) -> vk::Descriptor
];

let descriptor_flags = [vk::DescriptorBindingFlags::empty()];
let mut binding_flags = vk::DescriptorSetLayoutBindingFlagsCreateInfoEXT::builder()
let mut binding_flags = vk::DescriptorSetLayoutBindingFlagsCreateInfoEXT::default()
.binding_flags(&descriptor_flags);

unsafe {
device.create_descriptor_set_layout(
&vk::DescriptorSetLayoutCreateInfo::builder()
&vk::DescriptorSetLayoutCreateInfo::default()
.bindings(&quadrics_bindings)
.push_next(&mut binding_flags)
.flags(vk::DescriptorSetLayoutCreateFlags::UPDATE_AFTER_BIND_POOL),
Expand Down Expand Up @@ -174,25 +175,23 @@ pub fn create_quadrics_pipeline(
let stages = [vertex_stage, fragment_stage];

// Vertex input state
let position_binding_description = vk::VertexInputBindingDescription::builder()
let position_binding_description = vk::VertexInputBindingDescription::default()
.binding(0)
.stride(size_of::<Vec3>() as _)
.input_rate(vk::VertexInputRate::VERTEX)
.build();
let vertex_binding_description = vk::VertexInputBindingDescription::builder()
.input_rate(vk::VertexInputRate::VERTEX);
let vertex_binding_description = vk::VertexInputBindingDescription::default()
.binding(1)
.stride(size_of::<Vertex>() as _)
.input_rate(vk::VertexInputRate::VERTEX)
.build();
.input_rate(vk::VertexInputRate::VERTEX);
let vertex_binding_descriptions = [position_binding_description, vertex_binding_description];
let vertex_attribute_descriptions = Vertex::attribute_descriptions();

let vertex_input_state = vk::PipelineVertexInputStateCreateInfo::builder()
let vertex_input_state = vk::PipelineVertexInputStateCreateInfo::default()
.vertex_attribute_descriptions(&vertex_attribute_descriptions)
.vertex_binding_descriptions(&vertex_binding_descriptions);

// Input assembly state
let input_assembly_state = vk::PipelineInputAssemblyStateCreateInfo::builder()
let input_assembly_state = vk::PipelineInputAssemblyStateCreateInfo::default()
.topology(vk::PrimitiveTopology::TRIANGLE_LIST);

// Viewport State
Expand All @@ -209,12 +208,12 @@ pub fn create_quadrics_pipeline(
// Scissors
let scissors = [*render_area];

let viewport_state = vk::PipelineViewportStateCreateInfo::builder()
let viewport_state = vk::PipelineViewportStateCreateInfo::default()
.viewports(&viewports)
.scissors(&scissors);

// Rasterization state
let rasterization_state = vk::PipelineRasterizationStateCreateInfo::builder()
let rasterization_state = vk::PipelineRasterizationStateCreateInfo::default()
.polygon_mode(vk::PolygonMode::FILL)
.cull_mode(vk::CullModeFlags::BACK)
.front_face(vk::FrontFace::COUNTER_CLOCKWISE)
Expand All @@ -227,11 +226,11 @@ pub fn create_quadrics_pipeline(
.line_width(1.0);

// Multisample state
let multisample_state = vk::PipelineMultisampleStateCreateInfo::builder()
let multisample_state = vk::PipelineMultisampleStateCreateInfo::default()
.rasterization_samples(vk::SampleCountFlags::TYPE_4);

// Depth stencil state
let depth_stencil_state = vk::PipelineDepthStencilStateCreateInfo::builder()
let depth_stencil_state = vk::PipelineDepthStencilStateCreateInfo::default()
.depth_test_enable(true)
.depth_write_enable(true)
.depth_compare_op(vk::CompareOp::GREATER)
Expand All @@ -241,23 +240,22 @@ pub fn create_quadrics_pipeline(
.stencil_test_enable(false);

// Color blend state
let color_blend_attachment = vk::PipelineColorBlendAttachmentState::builder()
let color_blend_attachment = vk::PipelineColorBlendAttachmentState::default()
.color_write_mask(
vk::ColorComponentFlags::R
| vk::ColorComponentFlags::G
| vk::ColorComponentFlags::B
| vk::ColorComponentFlags::A,
)
.blend_enable(false)
.build();
.blend_enable(false);

let color_blend_attachments = [color_blend_attachment];

let color_blend_state = vk::PipelineColorBlendStateCreateInfo::builder()
let color_blend_state = vk::PipelineColorBlendStateCreateInfo::default()
.logic_op_enable(false)
.attachments(&color_blend_attachments);

let create_info = vk::GraphicsPipelineCreateInfo::builder()
let create_info = vk::GraphicsPipelineCreateInfo::default()
.stages(&stages)
.vertex_input_state(&vertex_input_state)
.input_assembly_state(&input_assembly_state)
Expand All @@ -268,8 +266,7 @@ pub fn create_quadrics_pipeline(
.color_blend_state(&color_blend_state)
.layout(pipeline_layout)
.render_pass(render_pass)
.subpass(0)
.build();
.subpass(0);

let create_infos = [create_info];

Expand Down
Loading
Loading