Skip to content

Commit

Permalink
Render on the second subpass
Browse files Browse the repository at this point in the history
  • Loading branch information
patowen committed May 5, 2024
1 parent e3d6abf commit 06b77c8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
4 changes: 2 additions & 2 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ server = { path = "../server" }
tracing = "0.1.10"
ash = { version = "0.38.0", default-features = false, features = ["loaded", "debug", "std"] }
lahar = { git = "https://github.com/Ralith/lahar", rev = "7963ae5750ea61fa0a894dbb73d3be0ac77255d2" }
yakui = { git = "https://github.com/SecondHalfGames/yakui", rev = "2eda113392712e87eb1c372b7d495edc29b8ccdc" }
yakui-vulkan = { git = "https://github.com/SecondHalfGames/yakui", rev = "2eda113392712e87eb1c372b7d495edc29b8ccdc" }
yakui = { git = "https://github.com/SecondHalfGames/yakui", rev = "cbac6c06dbf948268df6d9e93346788e977cbef3" }
yakui-vulkan = { git = "https://github.com/SecondHalfGames/yakui", rev = "cbac6c06dbf948268df6d9e93346788e977cbef3" }
winit = "0.29.10"
ash-window = "0.13"
raw-window-handle = "0.6"
Expand Down
31 changes: 16 additions & 15 deletions client/src/graphics/draw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ impl Draw {

let mut yakui_vulkan_options = yakui_vulkan::Options::default();
yakui_vulkan_options.render_pass = gfx.render_pass;
yakui_vulkan_options.subpass = 1;
let mut yakui_vulkan = yakui_vulkan::YakuiVulkan::new(
&yakui_vulkan::VulkanContext::new(device, gfx.queue, gfx.memory_properties),
yakui_vulkan_options,
Expand Down Expand Up @@ -287,17 +288,16 @@ impl Draw {
let state = &mut self.states[self.next_state];
let cmd = state.cmd;

let yakui_vulkan_context = yakui_vulkan::VulkanContext::new(
device,
self.gfx.queue,
self.gfx.memory_properties,
);
let yakui_vulkan_context =
yakui_vulkan::VulkanContext::new(device, self.gfx.queue, self.gfx.memory_properties);

self.yak.set_surface_size([extent.width as f32, extent.height as f32].into());
self.yak.set_unscaled_viewport(yakui::geometry::Rect::from_pos_size(
Default::default(),
[extent.width as f32, extent.height as f32].into(),
));
self.yak
.set_surface_size([extent.width as f32, extent.height as f32].into());
self.yak
.set_unscaled_viewport(yakui::geometry::Rect::from_pos_size(
Default::default(),
[extent.width as f32, extent.height as f32].into(),
));

self.yak.start();
yakui::text(96.0, "Hello world!");
Expand Down Expand Up @@ -373,7 +373,8 @@ impl Draw {
timestamp_index += 1;

self.yakui_vulkan.transfers_finished(&yakui_vulkan_context);
self.yakui_vulkan.transfer(paint, &yakui_vulkan_context, cmd);
self.yakui_vulkan
.transfer(paint, &yakui_vulkan_context, cmd);

// Schedule transfer of uniform data. Note that we defer actually preparing the data to just
// before submitting the command buffer so time-sensitive values can be set with minimum
Expand Down Expand Up @@ -501,12 +502,12 @@ impl Draw {
}
}

// TODO
self.yakui_vulkan.paint(paint, &yakui_vulkan_context, cmd, extent);

device.cmd_next_subpass(cmd, vk::SubpassContents::INLINE);

//self.fog.draw(device, state.common_ds, cmd);
self.fog.draw(device, state.common_ds, cmd);

self.yakui_vulkan
.paint(paint, &yakui_vulkan_context, cmd, extent);

// Finish up
device.cmd_end_render_pass(cmd);
Expand Down

0 comments on commit 06b77c8

Please sign in to comment.