From d56eb5e4c223f5c89117cda8dfb1527e02b6a90c Mon Sep 17 00:00:00 2001 From: Irene Knapp Date: Sat, 8 Aug 2026 05:32:41 -0700 Subject: remove physical_device from ForReinit Vulkanalia tracks it for us in Device. it's used in Model, so it wasn't strictly in-scope for ForReinit; this solves the problem and simplifies some stuff. Force-Push: yes Change-Id: I8e38c236b3dc4c112671382a062c9ada2f34fbb1 --- src/graphics/model.rs | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'src/graphics/model.rs') diff --git a/src/graphics/model.rs b/src/graphics/model.rs index b691d99..bda064c 100644 --- a/src/graphics/model.rs +++ b/src/graphics/model.rs @@ -1,8 +1,6 @@ #![deny(unsafe_code)] use crate::error::*; -use crate::graphics::permanent::{ - PermanentGraphicsState, GraphicsStateForReinit -}; +use crate::graphics::permanent::PermanentGraphicsState; use crate::graphics::render_state::RenderState; use crate::graphics::util::init_buffer; use crate::graphics::window_dressing::WindowDressing; @@ -29,25 +27,23 @@ pub struct Model { impl Model { pub fn new(permanent: &PermanentGraphicsState, - for_reinit: &GraphicsStateForReinit, window_dressing: &WindowDressing) -> Result { let device = &permanent.device; let instance = &permanent.instance; let graphics_queue = &permanent.graphics_queue; - let physical_device = &for_reinit.physical_device; let transient_command_pool = &window_dressing.transient_command_pool; let (vertices, indices) = load_model()?; let index_count = indices.len(); let (vertex_buffer, vertex_buffer_memory) - = init_vertex_buffer(vertices, instance, physical_device, device, - graphics_queue, &transient_command_pool)?; + = init_vertex_buffer(vertices, instance, device, graphics_queue, + &transient_command_pool)?; let (index_buffer, index_buffer_memory) - = init_index_buffer(indices, instance, physical_device, device, - graphics_queue, &transient_command_pool)?; + = init_index_buffer(indices, instance, device, graphics_queue, + &transient_command_pool)?; Ok(Model { vertex_buffer, @@ -121,21 +117,20 @@ impl Model { fn init_vertex_buffer(vertices: Vec>, instance: &Instance, - physical_device: &vk::PhysicalDevice, device: &Device, - queue: &vk::Queue, command_pool: &vk::CommandPool) + device: &Device, queue: &vk::Queue, + command_pool: &vk::CommandPool) -> Result<(vk::Buffer, vk::DeviceMemory)> { - init_buffer(instance, physical_device, device, queue, command_pool, + init_buffer(instance, device, queue, command_pool, vk::BufferUsageFlags::VERTEX_BUFFER, &vertices) } -fn init_index_buffer(indices: Vec, instance: &Instance, - physical_device: &vk::PhysicalDevice, device: &Device, +fn init_index_buffer(indices: Vec, instance: &Instance, device: &Device, queue: &vk::Queue, command_pool: &vk::CommandPool) -> Result<(vk::Buffer, vk::DeviceMemory)> { - init_buffer(instance, physical_device, device, queue, command_pool, + init_buffer(instance, device, queue, command_pool, vk::BufferUsageFlags::INDEX_BUFFER, &indices) } -- cgit 1.4.1