Skip to content
Snippets Groups Projects
Commit ccb2b096 authored by Noxim's avatar Noxim
Browse files

Disable sRGB

parent 9f9f8303
No related branches found
No related tags found
No related merge requests found
......@@ -73,17 +73,8 @@ pub async fn run() -> Result<()> {
} else {
TextureFormat::Rgba8Unorm
};
let view_formats = if adapter
.get_downlevel_capabilities()
.flags
.contains(DownlevelFlags::SURFACE_VIEW_FORMATS)
{
vec![format.add_srgb_suffix()]
} else {
vec![]
};
debug!("Using {format:?} with sRGB: {}", !view_formats.is_empty());
debug!("Using {format:?}");
let mut reconfigure = true;
let mut framebuffer = device.create_texture(&TextureDescriptor {
......@@ -125,7 +116,7 @@ pub async fn run() -> Result<()> {
height,
present_mode: PresentMode::AutoNoVsync,
alpha_mode: CompositeAlphaMode::Opaque,
view_formats: view_formats.clone(),
view_formats: vec![],
},
);
......@@ -141,7 +132,7 @@ pub async fn run() -> Result<()> {
dimension: framebuffer.dimension(),
format: framebuffer.format(),
usage: framebuffer.usage(),
view_formats: &view_formats,
view_formats: &[],
});
depthbuffer = device.create_texture(&TextureDescriptor {
......@@ -178,16 +169,8 @@ pub async fn run() -> Result<()> {
});
{
let fb_view = framebuffer.create_view(&TextureViewDescriptor {
label: Some("Antialias target"),
format: view_formats.get(0).copied(),
..Default::default()
});
let rs_view = swapchain.texture.create_view(&TextureViewDescriptor {
label: Some("Resolve target"),
format: view_formats.get(0).copied(),
..Default::default()
});
let fb_view = framebuffer.create_view(&Default::default());
let rs_view = swapchain.texture.create_view(&Default::default());
let db_view = depthbuffer.create_view(&Default::default());
let mut pass = enc.begin_render_pass(&RenderPassDescriptor {
......@@ -210,11 +193,9 @@ pub async fn run() -> Result<()> {
}),
});
let pipeline_fmt = view_formats.get(0).copied().unwrap_or(format);
let aspect =
window.inner_size().width as f32 / window.inner_size().height as f32;
state.update(&queue, &device, &mut pass, pipeline_fmt, aspect);
state.update(&queue, &device, &mut pass, format, aspect);
}
queue.submit([enc.finish()]);
......
......@@ -3,7 +3,6 @@ use wgpu::*;
pub struct Sprite {
layout: BindGroupLayout,
texture: Texture,
uniforms: Buffer,
bindgroup: BindGroup,
pub transforms: Mat4,
......@@ -109,7 +108,6 @@ impl Sprite {
Ok(Self {
layout,
texture,
uniforms,
bindgroup,
transforms,
......
......@@ -2,22 +2,26 @@ use wgpu::{RenderPass, TextureFormat};
use crate::prelude::*;
pub enum State {
Loading {
fg: Sprite,
bg: Sprite,
scale: Animation<f32>,
rot: Animation<f32>,
},
pub struct State {
splash: Splash,
}
pub struct Splash {
fg: Sprite,
bg: Sprite,
scale: Animation<f32>,
rot: Animation<f32>,
}
impl State {
pub async fn new(queue: &Queue, device: &Device) -> Result<State> {
Ok(State::Loading {
fg: Sprite::new("splash_fg.png", queue, device, true).await?,
bg: Sprite::new("splash_bg.png", queue, device, true).await?,
scale: Animation::new(vec![0.0, 0.1, 0.25], Duration::from_secs(1)),
rot: Animation::new(vec![PI, PI, 0.0], Duration::from_secs(3)),
Ok(State {
splash: Splash {
fg: Sprite::new("splash_fg.png", queue, device, true).await?,
bg: Sprite::new("splash_bg.png", queue, device, true).await?,
scale: Animation::new(vec![0.0, 0.1, 0.25], Duration::from_secs(1)),
rot: Animation::new(vec![PI, PI, 0.0], Duration::from_secs(3)),
},
})
}
......@@ -29,16 +33,17 @@ impl State {
format: TextureFormat,
aspect: f32,
) {
match self {
State::Loading { fg, bg, scale, rot } => {
bg.transforms = Mat4::from_2d(Vec2::ZERO, scale.get(), rot.get());
fg.transforms = Mat4::from_2d(Vec2::ZERO, 0.25, 0.0);
if !self.splash.rot.complete() {
self.splash.bg.transforms =
Mat4::from_2d(Vec2::ZERO, self.splash.scale.get(), self.splash.rot.get());
self.splash.fg.transforms = Mat4::from_2d(Vec2::ZERO, 0.25, 0.0);
bg.record(queue, device, pass, format, aspect);
if scale.complete() {
fg.record(queue, device, pass, format, aspect)
}
self.splash.bg.record(queue, device, pass, format, aspect);
if self.splash.scale.complete() {
self.splash.fg.record(queue, device, pass, format, aspect)
}
} else {
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment