From ec0d97d9611e33cd229a1102ff11335daebbae4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Capucho?= Date: Mon, 2 Aug 2021 23:57:24 +0100 Subject: [PATCH] [glsl-in] Respect user defined interpolation --- src/front/glsl/variables.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/front/glsl/variables.rs b/src/front/glsl/variables.rs index 857c8c0d47..13182ca530 100644 --- a/src/front/glsl/variables.rs +++ b/src/front/glsl/variables.rs @@ -419,12 +419,12 @@ impl Program { if let Some(location) = location { let input = storage == StorageQualifier::Input; - let interpolation = self.module.types[ty].inner.scalar_kind().map(|kind| { - if let ScalarKind::Float = kind { - Interpolation::Perspective - } else { - Interpolation::Flat - } + let interpolation = interpolation.or_else(|| { + let kind = self.module.types[ty].inner.scalar_kind()?; + Some(match kind { + ScalarKind::Float => Interpolation::Perspective, + _ => Interpolation::Flat, + }) }); let handle = self.module.global_variables.append(GlobalVariable {