From 5b64c39b93b83a1b40e083ab448f4059bcbeea57 Mon Sep 17 00:00:00 2001 From: HampusM Date: Thu, 23 Nov 2023 20:21:03 +0100 Subject: fix(engine): prevent removing newlines when deleting GLSL #version --- engine/src/shader_preprocessor.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/engine/src/shader_preprocessor.rs b/engine/src/shader_preprocessor.rs index 479c5b1..70696ac 100644 --- a/engine/src/shader_preprocessor.rs +++ b/engine/src/shader_preprocessor.rs @@ -64,11 +64,12 @@ impl ShaderPreprocessor path: path.clone(), })?; - let mut included_lines = included.lines(); - - if let Some(first_line) = included_lines.next() { + if let Some(first_line) = included.lines().next() { if first_line.starts_with("#version") { - included = included_lines.collect(); + included = included + .chars() + .skip_while(|character| *character != '\n') + .collect(); } } -- cgit v1.2.3-18-g5258