From abd238bff3013de654e992c47b6e7678405f397e Mon Sep 17 00:00:00 2001 From: msiglreith Date: Tue, 5 May 2020 18:13:07 +0200 Subject: [PATCH] Address review comments --- piet-gpu-hal/src/vulkan.rs | 4 ++-- piet-gpu/shader/kernel4.comp | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/piet-gpu-hal/src/vulkan.rs b/piet-gpu-hal/src/vulkan.rs index cd44ec7..ff4587e 100644 --- a/piet-gpu-hal/src/vulkan.rs +++ b/piet-gpu-hal/src/vulkan.rs @@ -208,7 +208,7 @@ impl VkInstance { None, )?; - let (_dbg_loader, _dbg_callbk) = if false { + let (_dbg_loader, _dbg_callbk) = if cfg!(debug_assertions) { let dbg_info = vk::DebugUtilsMessengerCreateInfoEXT::builder() .message_severity( vk::DebugUtilsMessageSeverityFlagsEXT::ERROR @@ -504,7 +504,7 @@ impl crate::Device for VkDevice { /// This creates a pipeline that runs over the buffer. /// - /// The descriptor set layout is just some number of buffers (this will change). + /// The descriptor set layout is just some number of storage buffers and storage images (this might change). unsafe fn create_simple_compute_pipeline( &self, code: &[u8], diff --git a/piet-gpu/shader/kernel4.comp b/piet-gpu/shader/kernel4.comp index 2a0b7f7..d6f33b7 100644 --- a/piet-gpu/shader/kernel4.comp +++ b/piet-gpu/shader/kernel4.comp @@ -63,11 +63,11 @@ void main() { SegChunk seg_chunk = SegChunk_read(seg_chunk_ref); for (int i = 0; i < seg_chunk.n; i++) { Segment seg = Segment_read(SegmentRef(seg_chunk_ref.offset + SegChunk_size + Segment_size * i)); - vec2 line_vec = seg.end - seg.start; - vec2 dpos = xy + vec2(0.5, 0.5) - seg.start; - float t = clamp(dot(line_vec, dpos) / dot(line_vec, line_vec), 0.0, 1.0); - df = min(df, length(line_vec * t - dpos)); - } + vec2 line_vec = seg.end - seg.start; + vec2 dpos = xy + vec2(0.5, 0.5) - seg.start; + float t = clamp(dot(line_vec, dpos) / dot(line_vec, line_vec), 0.0, 1.0); + df = min(df, length(line_vec * t - dpos)); + } seg_chunk_ref = seg_chunk.next; } while (seg_chunk_ref.offset != 0); fg_rgba = unpackUnorm4x8(stroke.rgba_color).wzyx;