Update to wgpu 0.12

This commit is contained in:
Werner
2022-03-31 19:52:27 -03:00
parent b23bc27f55
commit 0a24096e90
7 changed files with 18 additions and 12 deletions

View File

@ -25,10 +25,10 @@ anyhow = "1.0"
bytemuck = { version = "1.4", features = [ "derive" ] }
cgmath = "0.18"
env_logger = "0.9"
image = "0.23"
image = "0.24.1"
log = "0.4"
pollster = "0.2"
serde = { version = "1.0", features = ["derive"] }
tobj = "3.0"
wgpu = "0.11"
winit = "0.25"
wgpu = "0.12.0"
winit = "0.26.1"

View File

@ -183,12 +183,12 @@ impl State for Cubes {
layout: Some(&render_pipeline_layout),
vertex: wgpu::VertexState {
module: &shader,
entry_point: "main",
entry_point: "vs_main",
buffers: &[ModelVertex::GetDescriptor(), InstanceRaw::GetDescriptor()],
},
fragment: Some(wgpu::FragmentState {
module: &shader,
entry_point: "main",
entry_point: "fs_main",
targets: &[wgpu::ColorTargetState {
format: display.config.format,
blend: Some(wgpu::BlendState {

View File

@ -99,7 +99,7 @@ impl State for Triangle {
layout: Some(&render_pipeline_layout),
vertex: wgpu::VertexState {
module: &shader_module,
entry_point: "main",
entry_point: "vs_main",
buffers: &[wgpu::VertexBufferLayout {
array_stride: std::mem::size_of::<TriangleVertex>()
as wgpu::BufferAddress,
@ -120,7 +120,7 @@ impl State for Triangle {
},
fragment: Some(wgpu::FragmentState {
module: &shader_module,
entry_point: "main",
entry_point: "fs_main",
targets: &[wgpu::ColorTargetState {
format: renderer.config.format,
blend: Some(wgpu::BlendState::REPLACE),
@ -133,7 +133,7 @@ impl State for Triangle {
front_face: wgpu::FrontFace::Ccw,
cull_mode: Some(wgpu::Face::Back),
polygon_mode: wgpu::PolygonMode::Fill,
clamp_depth: false,
unclipped_depth: false,
conservative: false,
},
depth_stencil: None,
@ -142,6 +142,7 @@ impl State for Triangle {
mask: !0,
alpha_to_coverage_enabled: false,
},
multiview: None,
})
};

View File

@ -11,7 +11,7 @@ struct VertexOutput {
};
[[stage(vertex)]]
fn main(
fn vs_main(
model: VertexInput,
) -> VertexOutput {
var out: VertexOutput;
@ -23,6 +23,6 @@ fn main(
// Fragment
[[stage(fragment)]]
fn main(in: VertexOutput) -> [[location(0)]] vec4<f32> {
fn fs_main(in: VertexOutput) -> [[location(0)]] vec4<f32> {
return vec4<f32>(in.color, 1.0);
}

View File

@ -16,7 +16,7 @@ impl Renderer {
pub async fn New(window: Window) -> Result<Self> {
let size = window.inner_size();
let instance = wgpu::Instance::new(wgpu::Backends::all());
let instance = wgpu::Instance::new(wgpu::Backends::DX12);
let surface = unsafe { instance.create_surface(&window) };
let adapter = instance

View File

@ -5,7 +5,8 @@ use std::time::Instant;
use winit::dpi::LogicalSize;
use winit::event::*;
use winit::event_loop::{ControlFlow, EventLoop};
use winit::window::WindowBuilder;
use winit::monitor::{MonitorHandle, VideoMode};
use winit::window::{Fullscreen, WindowBuilder};
/// Runtime state executor and event loop.
pub struct Runtime;
@ -16,8 +17,11 @@ impl Runtime {
let event_loop = EventLoop::new();
//let monitor = event_loop.available_monitors().nth(0);
let window = WindowBuilder::new()
.with_title("Graphics")
//.with_fullscreen(Some(Fullscreen::Borderless(monitor)))
.with_inner_size(LogicalSize::new(1280, 720))
.build(&event_loop)?;

View File

@ -1,4 +1,5 @@
#![allow(non_snake_case)]
#![allow(unused_imports)]
pub mod Camera;
pub mod Color;