Remove unused code

This commit is contained in:
Keavon Chambers 2020-05-23 12:47:36 -07:00
parent a9859b4bb4
commit 8fb1a703af
7 changed files with 18 additions and 21 deletions

View File

@ -69,8 +69,8 @@ impl Application {
// Temporary setup below, TODO: move to appropriate place in architecture // Temporary setup below, TODO: move to appropriate place in architecture
// Window uniform bind group layout // Window uniform bind group layout
let window_binding_types = vec![wgpu::BindingType::UniformBuffer { dynamic: false }]; // let window_binding_types = vec![wgpu::BindingType::UniformBuffer { dynamic: false }];
let window_bind_group_layout = Pipeline::build_bind_group_layout(&device, &window_binding_types); // let window_bind_group_layout = Pipeline::build_bind_group_layout(&device, &window_binding_types);
// Data structure maintaining the user interface // Data structure maintaining the user interface
// let extra_layouts = vec![&window_bind_group_layout]; // let extra_layouts = vec![&window_bind_group_layout];
@ -112,7 +112,7 @@ impl Application {
// Handle custom-dispatched events // Handle custom-dispatched events
Event::UserEvent(_) => (), Event::UserEvent(_) => (),
// Called once every event is handled and the GUI structure is updated // Called once every event is handled and the GUI structure is updated
Event::MainEventsCleared => self.update_gui(window), Event::MainEventsCleared => self.update_gui(),
// Resizing or calling `window.request_redraw()` renders the GUI with the queued draw commands // Resizing or calling `window.request_redraw()` renders the GUI with the queued draw commands
Event::RedrawRequested(_) => self.render(), Event::RedrawRequested(_) => self.render(),
// Once all windows have been redrawn // Once all windows have been redrawn
@ -125,7 +125,7 @@ impl Application {
} }
} }
pub fn update_gui(&mut self, window: &Window) { pub fn update_gui(&mut self) {
} }

View File

@ -1,13 +0,0 @@
pub enum BindGroupResource<'a> {
Owned(wgpu::BindGroup),
Borrowed(&'a wgpu::BindGroup),
}
impl<'a> BindGroupResource<'a> {
pub fn borrow(&self) -> BindGroupResource {
match self {
BindGroupResource::Owned(ref bind_group) => BindGroupResource::Borrowed(bind_group),
BindGroupResource::Borrowed(ref bind_group) => BindGroupResource::Borrowed(bind_group),
}
}
}

View File

@ -12,6 +12,7 @@ impl Color {
Self { r, g, b, a } Self { r, g, b, a }
} }
#[allow(dead_code)]
pub const TRANSPARENT: Self = Color { pub const TRANSPARENT: Self = Color {
r: 0.0, r: 0.0,
g: 0.0, g: 0.0,
@ -19,6 +20,7 @@ impl Color {
a: 0.0, a: 0.0,
}; };
#[allow(dead_code)]
pub const BLACK: Self = Color { pub const BLACK: Self = Color {
r: 0.0, r: 0.0,
g: 0.0, g: 0.0,
@ -26,6 +28,7 @@ impl Color {
a: 1.0, a: 1.0,
}; };
#[allow(dead_code)]
pub const WHITE: Self = Color { pub const WHITE: Self = Color {
r: 1.0, r: 1.0,
g: 1.0, g: 1.0,
@ -33,6 +36,7 @@ impl Color {
a: 1.0, a: 1.0,
}; };
#[allow(dead_code)]
pub const RED: Self = Color { pub const RED: Self = Color {
r: 1.0, r: 1.0,
g: 0.0, g: 0.0,
@ -40,6 +44,7 @@ impl Color {
a: 1.0, a: 1.0,
}; };
#[allow(dead_code)]
pub const YELLOW: Self = Color { pub const YELLOW: Self = Color {
r: 1.0, r: 1.0,
g: 1.0, g: 1.0,
@ -47,6 +52,7 @@ impl Color {
a: 1.0, a: 1.0,
}; };
#[allow(dead_code)]
pub const GREEN: Self = Color { pub const GREEN: Self = Color {
r: 0.0, r: 0.0,
g: 1.0, g: 1.0,
@ -54,6 +60,7 @@ impl Color {
a: 1.0, a: 1.0,
}; };
#[allow(dead_code)]
pub const CYAN: Self = Color { pub const CYAN: Self = Color {
r: 0.0, r: 0.0,
g: 1.0, g: 1.0,
@ -61,6 +68,7 @@ impl Color {
a: 1.0, a: 1.0,
}; };
#[allow(dead_code)]
pub const BLUE: Self = Color { pub const BLUE: Self = Color {
r: 0.0, r: 0.0,
g: 0.0, g: 0.0,
@ -68,6 +76,7 @@ impl Color {
a: 1.0, a: 1.0,
}; };
#[allow(dead_code)]
pub const MAGENTA: Self = Color { pub const MAGENTA: Self = Color {
r: 1.0, r: 1.0,
g: 0.0, g: 0.0,

View File

@ -22,6 +22,7 @@ pub enum ColorPalette {
} }
impl ColorPalette { impl ColorPalette {
#[allow(dead_code)]
pub fn get_color_srgb(self) -> Color { pub fn get_color_srgb(self) -> Color {
let grayscale = match self { let grayscale = match self {
ColorPalette::Black => 0 * 17, // #000000 ColorPalette::Black => 0 * 17, // #000000
@ -56,6 +57,7 @@ impl ColorPalette {
Color::new(rgba.0 as f32 / 255.0, rgba.1 as f32 / 255.0, rgba.2 as f32 / 255.0, rgba.3 as f32 / 255.0) Color::new(rgba.0 as f32 / 255.0, rgba.1 as f32 / 255.0, rgba.2 as f32 / 255.0, rgba.3 as f32 / 255.0)
} }
#[allow(dead_code)]
pub fn get_color_linear(self) -> Color { pub fn get_color_linear(self) -> Color {
let standard_rgb = ColorPalette::get_color_srgb(self); let standard_rgb = ColorPalette::get_color_srgb(self);

View File

@ -41,7 +41,7 @@ impl GuiNode {
let texture = Texture::cached_load(device, queue, "textures/grid.png", texture_cache); let texture = Texture::cached_load(device, queue, "textures/grid.png", texture_cache);
// Build a staging buffer from the uniform resource data // Build a staging buffer from the uniform resource data
let binding_staging_buffer = Pipeline::build_binding_staging_buffer(device, self.form_factor); let binding_staging_buffer = Pipeline::build_binding_staging_buffer(device, &self.form_factor);
// Construct the bind group for this GUI node // Construct the bind group for this GUI node
let bind_group = Pipeline::build_bind_group(device, &pipeline.bind_group_layout, vec![ let bind_group = Pipeline::build_bind_group(device, &pipeline.bind_group_layout, vec![

View File

@ -10,7 +10,6 @@ mod gui_node;
mod gui_attributes; mod gui_attributes;
mod window_events; mod window_events;
mod window_uniform; mod window_uniform;
mod bind_group_resource;
use application::Application; use application::Application;
use winit::event_loop::EventLoop; use winit::event_loop::EventLoop;

View File

@ -71,10 +71,10 @@ impl Pipeline {
}) })
} }
pub fn build_binding_staging_buffer<T: bytemuck::Pod>(device: &wgpu::Device, resource: T) -> wgpu::Buffer { // TODO: Turn this into a borrow pub fn build_binding_staging_buffer<T: bytemuck::Pod>(device: &wgpu::Device, resource: &T) -> wgpu::Buffer {
// Construct a staging buffer with the binary uniform struct data // Construct a staging buffer with the binary uniform struct data
device.create_buffer_with_data( device.create_buffer_with_data(
bytemuck::cast_slice(&[resource]), bytemuck::cast_slice(&[*resource]),
wgpu::BufferUsage::UNIFORM | wgpu::BufferUsage::COPY_DST, wgpu::BufferUsage::UNIFORM | wgpu::BufferUsage::COPY_DST,
) )
} }