diff --git a/src/sprite_shader.wgsl b/src/sprite_shader.wgsl index e98d1b87..04c51ae6 100644 --- a/src/sprite_shader.wgsl +++ b/src/sprite_shader.wgsl @@ -7,12 +7,13 @@ struct ScreenUniform { var screen : ScreenUniform; struct VertexInput { - @location(0) position : vec3, @location(1) tex_coords : vec2, + @location(0) position : vec3, + @location(1) tex_coords : vec2, }; struct VertexOutput { @builtin(position) clip_position : vec4, - @location(0) tex_coords : vec2, + @location(0) tex_coords : vec2, }; const RES = vec2f(320.0, 240.0); // The logical resolution of the screen. @@ -55,24 +56,7 @@ const RES = vec2f(320.0, 240.0); // The logical resolution of the screen. @group(0) @binding(1) var s_diffuse : sampler; @fragment fn fs_main(in : VertexOutput)->@location(0) vec4 { - // The "screen" is centered in the window, so anything outside of the - // screen borders should be black. But *where are they*? - let RES_AR = RES.x / RES.y; // The aspect ratio of the logical screen. - let screen_ar = screen.resolution.x / screen.resolution.y; - var black_mod = 1.0; - if (screen_ar > RES_AR) { - // Wider than tall, bars are on the left and right. - let active_width = screen.resolution.y * RES_AR; - let half_delta = (screen.resolution.x - active_width) / 2.0; - if (in.clip_position.x < half_delta || - in.clip_position.x > half_delta + active_width) { - black_mod = 0.0; - } - } else { - // Taller than wide, bars are on top and bottom. - } - let dims = vec2f(textureDimensions(t_diffuse)); - return black_mod * textureSample(t_diffuse, s_diffuse, in.tex_coords / dims); + return textureSample(t_diffuse, s_diffuse, in.tex_coords / dims); } diff --git a/src/texture.rs b/src/texture.rs index ae0e20ef..db6017f6 100644 --- a/src/texture.rs +++ b/src/texture.rs @@ -35,7 +35,7 @@ impl Texture { address_mode_u: wgpu::AddressMode::ClampToEdge, address_mode_v: wgpu::AddressMode::ClampToEdge, address_mode_w: wgpu::AddressMode::ClampToEdge, - mag_filter: wgpu::FilterMode::Linear, + mag_filter: wgpu::FilterMode::Nearest, min_filter: wgpu::FilterMode::Nearest, mipmap_filter: wgpu::FilterMode::Nearest, ..Default::default()