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
// Window uniform bind group layout
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_binding_types = vec![wgpu::BindingType::UniformBuffer { dynamic: false }];
// let window_bind_group_layout = Pipeline::build_bind_group_layout(&device, &window_binding_types);
// Data structure maintaining the user interface
// let extra_layouts = vec![&window_bind_group_layout];
@ -112,7 +112,7 @@ impl Application {
// Handle custom-dispatched events
Event::UserEvent(_) => (),
// 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
Event::RedrawRequested(_) => self.render(),
// 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 }
}
#[allow(dead_code)]
pub const TRANSPARENT: Self = Color {
r: 0.0,
g: 0.0,
@ -19,6 +20,7 @@ impl Color {
a: 0.0,
};
#[allow(dead_code)]
pub const BLACK: Self = Color {
r: 0.0,
g: 0.0,
@ -26,6 +28,7 @@ impl Color {
a: 1.0,
};
#[allow(dead_code)]
pub const WHITE: Self = Color {
r: 1.0,
g: 1.0,
@ -33,6 +36,7 @@ impl Color {
a: 1.0,
};
#[allow(dead_code)]
pub const RED: Self = Color {
r: 1.0,
g: 0.0,
@ -40,6 +44,7 @@ impl Color {
a: 1.0,
};
#[allow(dead_code)]
pub const YELLOW: Self = Color {
r: 1.0,
g: 1.0,
@ -47,6 +52,7 @@ impl Color {
a: 1.0,
};
#[allow(dead_code)]
pub const GREEN: Self = Color {
r: 0.0,
g: 1.0,
@ -54,6 +60,7 @@ impl Color {
a: 1.0,
};
#[allow(dead_code)]
pub const CYAN: Self = Color {
r: 0.0,
g: 1.0,
@ -61,6 +68,7 @@ impl Color {
a: 1.0,
};
#[allow(dead_code)]
pub const BLUE: Self = Color {
r: 0.0,
g: 0.0,
@ -68,6 +76,7 @@ impl Color {
a: 1.0,
};
#[allow(dead_code)]
pub const MAGENTA: Self = Color {
r: 1.0,
g: 0.0,

View file

@ -22,6 +22,7 @@ pub enum ColorPalette {
}
impl ColorPalette {
#[allow(dead_code)]
pub fn get_color_srgb(self) -> Color {
let grayscale = match self {
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)
}
#[allow(dead_code)]
pub fn get_color_linear(self) -> Color {
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);
// 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
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 window_events;
mod window_uniform;
mod bind_group_resource;
use application::Application;
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
device.create_buffer_with_data(
bytemuck::cast_slice(&[resource]),
bytemuck::cast_slice(&[*resource]),
wgpu::BufferUsage::UNIFORM | wgpu::BufferUsage::COPY_DST,
)
}