[Bf-blender-cvs] [30a0f1a2bfe] blender2.8: Workbench: Use int to fix compilation issues on certain platform

Clément Foucault noreply at git.blender.org
Mon Dec 17 08:37:03 CET 2018


Commit: 30a0f1a2bfe29a62b3cea70cead0200ad4e7234a
Author: Clément Foucault
Date:   Mon Dec 17 08:47:37 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB30a0f1a2bfe29a62b3cea70cead0200ad4e7234a

Workbench: Use int to fix compilation issues on certain platform

===================================================================

M	source/blender/draw/engines/workbench/shaders/workbench_common_lib.glsl

===================================================================

diff --git a/source/blender/draw/engines/workbench/shaders/workbench_common_lib.glsl b/source/blender/draw/engines/workbench/shaders/workbench_common_lib.glsl
index 5ce85dcd00d..76b00469f15 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_common_lib.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_common_lib.glsl
@@ -65,11 +65,11 @@ float workbench_float_pair_encode(float v1, float v2)
 	// const uint v1_mask = ~(0xFFFFFFFFu << ROUGHNESS_BITS);
 	// const uint v2_mask = ~(0xFFFFFFFFu << METALLIC_BITS);
 	/* Same as above because some compiler are dumb af. and think we use mediump int.  */
-	const uint total_mask = 0xFFu;
-	const uint v1_mask = 0x1Fu;
-	const uint v2_mask = 0x7u;
+	const int total_mask = 0xFF;
+	const int v1_mask = 0x1F;
+	const int v2_mask = 0x7;
 	int iv1 = int(v1 * float(v1_mask));
-	int iv2 = int(v2 * float(v2_mask)) << ROUGHNESS_BITS;
+	int iv2 = int(v2 * float(v2_mask)) << int(ROUGHNESS_BITS);
 	return float(iv1 | iv2) * (1.0 / float(total_mask));
 }
 
@@ -79,12 +79,12 @@ void workbench_float_pair_decode(float data, out float v1, out float v2)
 	// const uint v1_mask = ~(0xFFFFFFFFu << ROUGHNESS_BITS);
 	// const uint v2_mask = ~(0xFFFFFFFFu << METALLIC_BITS);
 	/* Same as above because some compiler are dumb af. and think we use mediump int.  */
-	const uint total_mask = 0xFFu;
-	const uint v1_mask = 0x1Fu;
-	const uint v2_mask = 0x7u;
-	uint idata = uint(data * float(total_mask));
+	const int total_mask = 0xFF;
+	const int v1_mask = 0x1F;
+	const int v2_mask = 0x7;
+	int idata = int(data * float(total_mask));
 	v1 = float(idata & v1_mask) * (1.0 / float(v1_mask));
-	v2 = float(idata >> ROUGHNESS_BITS) * (1.0 / float(v2_mask));
+	v2 = float(idata >> int(ROUGHNESS_BITS)) * (1.0 / float(v2_mask));
 }
 
 float calculate_transparent_weight(float z, float alpha)



More information about the Bf-blender-cvs mailing list