From c6b6af668d8cdee02f7c65059141bcf4796f18f2 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Thu, 18 Nov 2021 08:04:14 +0100 Subject: [PATCH 1/2] Fix shader compilation on some GPUs Some GPUs (rightly) complain about the difference between a float and an int. Fixes #10837 --- plugins/SimulationView/layers3d.shader | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/SimulationView/layers3d.shader b/plugins/SimulationView/layers3d.shader index dc5aee2d1c..a3be25cf01 100644 --- a/plugins/SimulationView/layers3d.shader +++ b/plugins/SimulationView/layers3d.shader @@ -111,7 +111,7 @@ vertex41core = float clamp(float v) { - float t = v < 0 ? 0 : v; + float t = v < 0.0 ? 0.0 : v; return t > 1.0 ? 1.0 : t; } From ac8d5fc12cd48a8c79430a312931394c5ef3cd3c Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Tue, 23 Nov 2021 09:27:25 +0100 Subject: [PATCH 2/2] More explicit float's in shader just to be sure. CURA-8714 --- plugins/SimulationView/layers3d.shader | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/SimulationView/layers3d.shader b/plugins/SimulationView/layers3d.shader index a3be25cf01..a079fd887b 100644 --- a/plugins/SimulationView/layers3d.shader +++ b/plugins/SimulationView/layers3d.shader @@ -58,12 +58,12 @@ vertex41core = value = (abs_value - min_value) / (max_value - min_value); } float red = value; - float green = 1-abs(1-4*value); + float green = 1.0 - abs(1.0 - 4.0 * value); if (value > 0.375) { green = 0.5; } - float blue = max(1-4*value, 0); + float blue = max(1.0 - 4.0 * value, 0.0); return vec4(red, green, blue, 1.0); } @@ -78,7 +78,7 @@ vertex41core = { value = (abs_value - min_value) / (max_value - min_value); } - float red = min(max(4*value-2, 0), 1); + float red = min(max(4.0 * value - 2.0, 0.0), 1.0); float green = min(1.5*value, 0.75); if (value > 0.75) { @@ -100,12 +100,12 @@ vertex41core = value = (abs_value - min_value) / (max_value - min_value); } float red = value; - float green = 1 - abs(1 - 4 * value); + float green = 1.0 - abs(1.0 - 4.0 * value); if(value > 0.375) { green = 0.5; } - float blue = max(1 - 4 * value, 0); + float blue = max(1.0 - 4.0 * value, 0.0); return vec4(red, green, blue, 1.0); }