fix output format
This commit is contained in:
parent
5a6b10965d
commit
c40ff3e324
11
src/lib.rs
11
src/lib.rs
|
|
@ -8,7 +8,10 @@ use rand_distr::Distribution as _;
|
|||
use crate::{
|
||||
camera::OrbitalCamera,
|
||||
ray::Ray,
|
||||
render::lines::{LookParams, Mesh, Pipeline, Vertex},
|
||||
render::{
|
||||
OUTPUT_FORMAT,
|
||||
lines::{LookParams, Mesh, Pipeline, Vertex},
|
||||
},
|
||||
trace::{Hit, Lambertian, Reflector, Scene, Source, Sphere},
|
||||
};
|
||||
|
||||
|
|
@ -18,8 +21,6 @@ mod render;
|
|||
mod shape;
|
||||
mod trace;
|
||||
|
||||
const OUTPUT_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Bgra8UnormSrgb;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct SphericalPosition {
|
||||
|
|
@ -130,8 +131,8 @@ impl Core {
|
|||
surface,
|
||||
} = gpu;
|
||||
|
||||
let pipeline = Pipeline::new(&device, OUTPUT_FORMAT);
|
||||
let mesh_pipe = render::faces::Pipeline::new(&device, OUTPUT_FORMAT);
|
||||
let pipeline = Pipeline::new(&device);
|
||||
let mesh_pipe = render::faces::Pipeline::new(&device);
|
||||
let tripod = new_tripod(&device);
|
||||
queue.submit([]); // flush buffer updates
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ use bytemuck::{Pod, Zeroable, bytes_of, cast_slice};
|
|||
use glam::{Mat4, Vec3};
|
||||
use wgpu::util::DeviceExt as _;
|
||||
|
||||
use crate::render::OUTPUT_FORMAT;
|
||||
|
||||
#[derive(Debug, Clone, Copy, Pod, Zeroable)]
|
||||
#[repr(C)]
|
||||
pub struct LookParams {
|
||||
|
|
@ -67,7 +69,7 @@ pub struct Pipeline {
|
|||
}
|
||||
|
||||
impl Pipeline {
|
||||
pub fn new(device: &wgpu::Device, format: wgpu::TextureFormat) -> Self {
|
||||
pub fn new(device: &wgpu::Device) -> Self {
|
||||
let look_buf = device.create_buffer(&wgpu::BufferDescriptor {
|
||||
label: None,
|
||||
size: size_of::<LookParams>() as u64,
|
||||
|
|
@ -118,7 +120,7 @@ impl Pipeline {
|
|||
entry_point: None,
|
||||
compilation_options: wgpu::PipelineCompilationOptions::default(),
|
||||
targets: &[Some(wgpu::ColorTargetState {
|
||||
format,
|
||||
format: OUTPUT_FORMAT,
|
||||
blend: Some(wgpu::BlendState::REPLACE),
|
||||
write_mask: wgpu::ColorWrites::ALL,
|
||||
})],
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ use bytemuck::{Pod, Zeroable, bytes_of, cast_slice};
|
|||
use glam::{Mat4, Vec3};
|
||||
use wgpu::util::DeviceExt as _;
|
||||
|
||||
use crate::render::OUTPUT_FORMAT;
|
||||
|
||||
#[derive(Debug, Clone, Copy, Pod, Zeroable)]
|
||||
#[repr(C)]
|
||||
pub struct LookParams {
|
||||
|
|
@ -49,7 +51,7 @@ pub struct Pipeline {
|
|||
}
|
||||
|
||||
impl Pipeline {
|
||||
pub fn new(device: &wgpu::Device, format: wgpu::TextureFormat) -> Self {
|
||||
pub fn new(device: &wgpu::Device) -> Self {
|
||||
let look_buf = device.create_buffer(&wgpu::BufferDescriptor {
|
||||
label: None,
|
||||
size: size_of::<LookParams>() as u64,
|
||||
|
|
@ -100,7 +102,7 @@ impl Pipeline {
|
|||
entry_point: None,
|
||||
compilation_options: wgpu::PipelineCompilationOptions::default(),
|
||||
targets: &[Some(wgpu::ColorTargetState {
|
||||
format,
|
||||
format: OUTPUT_FORMAT,
|
||||
blend: Some(wgpu::BlendState::REPLACE),
|
||||
write_mask: wgpu::ColorWrites::ALL,
|
||||
})],
|
||||
|
|
|
|||
|
|
@ -2,3 +2,5 @@ pub mod faces;
|
|||
pub mod lines;
|
||||
|
||||
static SIMPLE_SHADER: &str = include_str!("simple.wgsl");
|
||||
|
||||
pub const OUTPUT_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Bgra8UnormSrgb;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user