From ab93ea1f2230fcfaece83bb1782d4000ad915242 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Tue, 29 Jan 2019 11:27:25 -0800 Subject: [PATCH] Fix bogus thin culling that was causing artefacts --- demo3/shaders/fill.vs.glsl | 5 +---- geometry/src/simd.rs | 40 -------------------------------------- renderer/src/gpu_data.rs | 14 ++++++------- 3 files changed, 7 insertions(+), 52 deletions(-) diff --git a/demo3/shaders/fill.vs.glsl b/demo3/shaders/fill.vs.glsl index b841116d..dbe46795 100644 --- a/demo3/shaders/fill.vs.glsl +++ b/demo3/shaders/fill.vs.glsl @@ -50,8 +50,5 @@ void main() { vFrom = from - position; vTo = to - position; - if (!(abs(from.x - to.x) > 0.1) || !(abs(uTileSize.y - min(from.y, to.y)) > 0.1)) - gl_Position = vec4(0.0); - else - gl_Position = vec4((tileOrigin + position) / uFramebufferSize * 2.0 - 1.0, 0.0, 1.0); + gl_Position = vec4((tileOrigin + position) / uFramebufferSize * 2.0 - 1.0, 0.0, 1.0); } diff --git a/geometry/src/simd.rs b/geometry/src/simd.rs index f98c73d9..5895609f 100644 --- a/geometry/src/simd.rs +++ b/geometry/src/simd.rs @@ -645,46 +645,6 @@ mod x86 { } } - /* - // Two pairs of 32-bit floats - - #[derive(Clone, Copy)] - pub struct F64x2x2(pub __m128d); - - impl F64x2 { - // Shuffles - - #[inline] - pub fn interleave(self, other: F64x2) -> (F64x2, F64x2) { - unsafe { - ( - F64x2(x86_64::_mm_unpacklo_pd(self.0, other.0)), - F64x2(x86_64::_mm_unpackhi_pd(self.0, other.0)), - ) - } - } - - // Creates ``. - #[inline] - pub fn combine_low_high(self, other: F64x2) -> F64x2 { - unsafe { - F64x2(x86_64::_mm_shuffle_pd(self.0, other.0, 0b10)) - } - } - - // Casts these packed floats to 32-bit floats. - // - // NB: This is a pure bitcast and does no actual conversion; only use this if you know what - // you're doing. - #[inline] - pub fn as_f32x4(self) -> F32x4 { - unsafe { - F32x4(x86_64::_mm_castpd_ps(self.0)) - } - } - } - */ - // 32-bit signed integers #[derive(Clone, Copy)] diff --git a/renderer/src/gpu_data.rs b/renderer/src/gpu_data.rs index 01e92119..23cb34fa 100644 --- a/renderer/src/gpu_data.rs +++ b/renderer/src/gpu_data.rs @@ -136,19 +136,17 @@ impl BuiltObject { .shuffle(shuffle_mask.as_u8x16()) .as_i32x4(); + // Unpack whole and fractional pixels. let px = LineSegmentU4((segment[1] | (segment[1] >> 12)) as u16); let subpx = LineSegmentU8(segment[0] as u32); - let tile_index = self.tile_coords_to_index(tile_x, tile_y); - - /* - // TODO(pcwalton): Cull degenerate fills again. // Cull degenerate fills. - let (from_px, to_px) = (from.to_u8(), to.to_u8()); - if from_px.x == to_px.x && from_subpx.x == to_subpx.x { - return + if (px.0 & 0xf) as u8 == ((px.0 >> 8) & 0xf) as u8 && + (subpx.0 & 0xff) as u8 == ((subpx.0 >> 16) & 0xff) as u8 { + return; } - */ + + let tile_index = self.tile_coords_to_index(tile_x, tile_y); self.fills.push(FillObjectPrimitive { px,