chore: update dependencies

This commit is contained in:
Rekai Nyangadzayi Musuka 2022-09-12 04:23:20 -03:00
parent 36e46d3780
commit 41bc4f7afe
4 changed files with 685 additions and 534 deletions

1158
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -8,14 +8,14 @@ edition = "2021"
[dependencies]
anyhow = "1.0"
bitfield = "0.13"
bitfield = "0.14"
clap = { version = "3.1", features = ["cargo"] }
gilrs = "0.8"
winit = "0.26"
egui = "0.15"
wgpu = "0.11"
egui_wgpu_backend = "0.14"
egui_winit_platform = "0.12"
gilrs = "0.9"
winit = "0.27"
egui = "0.19"
wgpu = "0.13"
egui_wgpu_backend = "0.19"
egui_winit_platform = "0.16"
pollster = "0.2"
rodio = "0.15"
rtrb = "0.2"

View File

@ -1,4 +1,4 @@
use egui::{ClippedMesh, CtxRef, TextureId};
use egui::{ClippedPrimitive, Context, TextureId};
use egui_wgpu_backend::{BackendError, RenderPass, ScreenDescriptor};
use egui_winit_platform::Platform;
use wgpu::{
@ -117,7 +117,7 @@ pub fn surface_config(window: &Window, format: TextureFormat) -> SurfaceConfigur
format,
width: size.width as u32,
height: size.height as u32,
present_mode: PresentMode::Immediate,
present_mode: PresentMode::Mailbox,
}
}
@ -187,9 +187,9 @@ pub fn write_to_texture(
pub fn expose_texture_to_egui(
render_pass: &mut RenderPass,
device: &Device,
texture: &Texture,
view: &TextureView,
) -> TextureId {
render_pass.egui_texture_from_wgpu_texture(device, texture, FILTER_MODE)
render_pass.egui_texture_from_wgpu_texture(device, view, FILTER_MODE)
}
#[inline]
@ -225,14 +225,14 @@ pub fn execute_render_pass(
render_pass: &mut RenderPass,
encoder: &mut CommandEncoder,
view: &TextureView,
jobs: Vec<ClippedMesh>,
jobs: Vec<ClippedPrimitive>,
descriptor: &ScreenDescriptor,
) -> Result<(), BackendError> {
render_pass.execute(encoder, view, &jobs, descriptor, Some(wgpu::Color::BLACK))
}
#[inline]
pub fn draw_egui(cpu: &Cpu, app: &mut GuiState, ctx: &CtxRef, texture_id: TextureId) {
pub fn draw_egui(cpu: &Cpu, app: &mut GuiState, ctx: &Context, texture_id: TextureId) {
use crate::{cpu, instruction, ppu};
fn selectable_text(ui: &mut egui::Ui, mut text: &str) -> egui::Response {
@ -240,7 +240,7 @@ pub fn draw_egui(cpu: &Cpu, app: &mut GuiState, ctx: &CtxRef, texture_id: Textur
}
egui::TopBottomPanel::top("top_panel").show(ctx, |ui| {
egui::menu::menu(ui, "File", |ui| {
ui.menu_button("File", |ui| {
if ui.button("Quit").clicked() {
app.quit = true;
}
@ -322,12 +322,13 @@ pub fn draw_egui(cpu: &Cpu, app: &mut GuiState, ctx: &CtxRef, texture_id: Textur
ui.horizontal(|ui| {
let ie = cpu.int_enable();
let r_len = ctx.fonts().glyph_width(egui::TextStyle::Body, 'R');
let e_len = ctx.fonts().glyph_width(egui::TextStyle::Body, 'E');
let q_len = ctx.fonts().glyph_width(egui::TextStyle::Body, 'Q');
// TODO: Reimplement this
// let r_len = ctx.fonts().glyph_width(egui::TextStyle::Body, 'R');
// let e_len = ctx.fonts().glyph_width(egui::TextStyle::Body, 'E');
// let q_len = ctx.fonts().glyph_width(egui::TextStyle::Body, 'Q');
ui.label("IE:");
ui.add_space(q_len - (e_len - r_len));
// ui.add_space(q_len - (e_len - r_len));
let _ = ui.selectable_label(ie & 0b01 == 0x01, "VBlank");
let _ = ui.selectable_label(ie >> 1 & 0x01 == 0x01, "LCD STAT");
let _ = ui.selectable_label(ie >> 2 & 0x01 == 0x01, "Timer");

View File

@ -8,8 +8,9 @@ use gilrs::Gilrs;
use gui::GuiState;
use rodio::{OutputStream, Sink};
use tracing_subscriber::EnvFilter;
use wgpu::TextureViewDescriptor;
use winit::event::{Event, WindowEvent};
use winit::event_loop::EventLoop;
use winit::event_loop::{EventLoop, EventLoopBuilder};
const AUDIO_ENABLED: bool = true;
@ -47,15 +48,13 @@ fn main() {
.init();
// --Here lies a lot of winit + wgpu Boilerplate--
let event_loop: EventLoop<Event<()>> = EventLoop::with_user_event();
let event_loop: EventLoop<Event<()>> = EventLoopBuilder::with_user_event().build();
let window = gui::build_window(&event_loop).expect("build window");
let (instance, surface) = gui::create_surface(&window);
let adapter = gui::request_adapter(&instance, &surface).expect("request adaptor");
let (device, queue) = gui::request_device(&adapter).expect("request device");
let format = surface
.get_preferred_format(&adapter)
.expect("get surface format");
let format = surface.get_supported_formats(&adapter)[0]; // First is preferred
let mut config = gui::surface_config(&window, format);
surface.configure(&device, &config);
@ -79,7 +78,9 @@ fn main() {
let texture_size = gui::texture_size();
let texture = gui::create_texture(&device, texture_size);
gui::write_to_texture(&queue, &texture, emu::pixel_buf(&cpu), texture_size);
let texture_id = gui::expose_texture_to_egui(&mut render_pass, &device, &texture);
let view = texture.create_view(&TextureViewDescriptor::default());
let texture_id = gui::expose_texture_to_egui(&mut render_pass, &device, &view);
// Load ROM if filepath was provided
if let Some(path) = m.value_of("rom") {
@ -165,15 +166,16 @@ fn main() {
platform.begin_frame();
gui::draw_egui(&cpu, &mut app, &platform.context(), texture_id);
// End the UI frame. We could now handle the output and draw the UI with the backend.
let (_, paint_commands) = platform.end_frame(Some(&window));
let paint_jobs = platform.context().tessellate(paint_commands);
let full_output = platform.end_frame(Some(&window));
let paint_jobs = platform.context().tessellate(full_output.shapes);
let mut encoder = gui::create_command_encoder(&device);
let screen_descriptor = gui::create_screen_descriptor(&window, &config);
let tdelta = full_output.textures_delta;
// Upload all resources for the GPU.
render_pass.update_texture(&device, &queue, &platform.context().texture());
render_pass.update_user_textures(&device, &queue);
render_pass
.add_textures(&device, &queue, &tdelta)
.expect("add texture ok");
render_pass.update_buffers(&device, &queue, &paint_jobs, &screen_descriptor);
// Record all render passes.