fixed pong

pull/242/head
Ben Hansen 3 years ago
parent a36b005287
commit 4adea9e790

652
Cargo.lock generated

File diff suppressed because it is too large Load Diff

@ -1,16 +1,16 @@
[workspace]
resolver = "2"
members = [
# # beginner tutorials
# beginner tutorials
"code/beginner/*",
# # intermediate tutorials
# intermediate tutorials
"code/intermediate/*",
# # showcase
# showcase
"code/showcase/*",
]
exclude = [
"code/showcase/imgui-demo",
"code/showcase/pong",
# "code/showcase/pong",
]

@ -11,8 +11,8 @@ anyhow = "1.0"
bytemuck = { version = "1.4", features = [ "derive" ] }
cgmath = "0.18"
pollster = "0.2"
wgpu = "0.10"
wgpu_glyph = "0.12"
wgpu = { version = "0.10", features = ["spirv"]}
wgpu_glyph = "0.14"
rand = "0.8"
rodio = "0.14"

@ -13,13 +13,12 @@ use crate::state;
const FONT_BYTES: &[u8] = include_bytes!("../../res/fonts/PressStart2P-Regular.ttf");
pub struct Render {
#[allow(dead_code)]
surface: wgpu::Surface,
config: wgpu::SurfaceConfiguration,
#[allow(dead_code)]
adapter: wgpu::Adapter,
device: wgpu::Device,
queue: wgpu::Queue,
config: wgpu::SurfaceConfiguration,
pipeline: wgpu::RenderPipeline,
vertex_buffer: wgpu::Buffer,
index_buffer: wgpu::Buffer,
@ -137,12 +136,13 @@ impl Render {
0
};
match self.swap_chain.get_current_frame() {
match self.surface.get_current_frame() {
Ok(frame) => {
let view = frame.output.texture.create_view(&Default::default());
let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Main Render Pass"),
color_attachments: &[wgpu::RenderPassColorAttachment {
view: &frame.output.view,
view: &view,
resolve_target: None,
ops: wgpu::Operations::default(),
}],
@ -183,7 +183,7 @@ impl Render {
&self.device,
&mut self.staging_belt,
&mut encoder,
&frame.output.view,
&view,
self.config.width,
self.config.height,
)

@ -1,5 +1,9 @@
# News
## Pong is fixed for 0.10
It wasn't actually that hard of a fix. I only really use the swapchain directly in the render module, and the only other change required me to include the `spirv` feature to wgpu in Cargo.toml.
## 0.10 SwapChain is dead, long live the Surface!
`SwapChain` and all related code has been removed from wgpu. All code pertaining to obtaining textures to draw to from the window will be available from the `Surface` instead. That means configuring `SurfaceTexture`s will look something like this:

Loading…
Cancel
Save