diff --git a/kubi-logging/src/lib.rs b/kubi-logging/src/lib.rs index bbc39c4..b83a159 100644 --- a/kubi-logging/src/lib.rs +++ b/kubi-logging/src/lib.rs @@ -9,7 +9,7 @@ pub fn init() { use env_logger::{fmt::Color, Builder, Env}; let env = Env::default() - .filter_or("RUST_LOG", "trace,gilrs=warn,rusty_xinput=warn"); + .filter_or("RUST_LOG", "trace,gilrs=warn,rusty_xinput=warn,wgpu=warn,wgpu_core=warn,wgpu_hal=error"); Builder::from_env(env) .format(|buf, record| { let mut level_style = buf.style(); diff --git a/kubi/shaders/world.wgsl b/kubi/shaders/world.wgsl index 38d45e2..0e1e335 100644 --- a/kubi/shaders/world.wgsl +++ b/kubi/shaders/world.wgsl @@ -1 +1,21 @@ -//TODO migrate +//TODO migrate, this is just some filler code to make the game compile + +struct VertexOutput { + @builtin(position) clip_position: vec4, +}; + +@vertex +fn vs_main( + @builtin(vertex_index) in_vertex_index: u32, +) -> VertexOutput { + var out: VertexOutput; + let x = f32(1 - i32(in_vertex_index)) * 0.5; + let y = f32(i32(in_vertex_index & 1u) * 2 - 1) * 0.5; + out.clip_position = vec4(x, y, 0.0, 1.0); + return out; +} + +@fragment +fn fs_main(in: VertexOutput) -> @location(0) vec4 { + return vec4(0.3, 0.2, 0.1, 1.0); +} diff --git a/kubi/src/rendering.rs b/kubi/src/rendering.rs index bf08a13..f739350 100644 --- a/kubi/src/rendering.rs +++ b/kubi/src/rendering.rs @@ -158,12 +158,36 @@ impl Renderer { pub fn begin(&self) -> RenderTarget { //Surface texture let output = self.surface.get_current_texture().unwrap(); + //View let view = output.texture.create_view(&wgpu::TextureViewDescriptor::default()); + //Encoder - let encoder = self.device.create_command_encoder(&wgpu::CommandEncoderDescriptor { + let mut encoder = self.device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: Some("RenderEncoder"), }); + + //Begin render pass + { + let _render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { + label: Some("RenderPass"), + color_attachments: &[Some(wgpu::RenderPassColorAttachment { + view: &view, + resolve_target: None, + ops: wgpu::Operations { + load: wgpu::LoadOp::Clear(wgpu::Color { + r: 0.1, + g: 0.2, + b: 0.3, + a: 1.0, + }), + store: true, + }, + })], + depth_stencil_attachment: None, + }); + } + RenderTarget { output, view, encoder } }