[Bf-blender-cvs] [660e8e59e7b] master: Fix T52645, T52645: AMD OpenCL compiler crash with recent drivers.

Brecht Van Lommel noreply at git.blender.org
Wed Oct 4 21:01:00 CEST 2017


Commit: 660e8e59e7b4265324a8fba7ae716f84a73c6c64
Author: Brecht Van Lommel
Date:   Wed Oct 4 20:45:20 2017 +0200
Branches: master
https://developer.blender.org/rB660e8e59e7b4265324a8fba7ae716f84a73c6c64

Fix T52645, T52645: AMD OpenCL compiler crash with recent drivers.

Work around the bug by reshuffling code.

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

M	intern/cycles/kernel/svm/svm_math_util.h

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

diff --git a/intern/cycles/kernel/svm/svm_math_util.h b/intern/cycles/kernel/svm/svm_math_util.h
index a7f15de7325..f8aeeba4a21 100644
--- a/intern/cycles/kernel/svm/svm_math_util.h
+++ b/intern/cycles/kernel/svm/svm_math_util.h
@@ -134,33 +134,20 @@ ccl_device float3 svm_math_blackbody_color(float t) {
 		{  6.72595954e-13f, -2.73059993e-08f,  4.24068546e-04f, -7.52204323e-01f },
 	};
 
-	int i;
 	if(t >= 12000.0f) {
 		return make_float3(0.826270103f, 0.994478524f, 1.56626022f);
 	}
-	else if(t >= 6365.0f) {
-		i = 5;
-	}
-	else if(t >= 3315.0f) {
-		i = 4;
-	}
-	else if(t >= 1902.0f) {
-		i = 3;
-	}
-	else if(t >= 1449.0f) {
-		i = 2;
-	}
-	else if(t >= 1167.0f) {
-		i = 1;
-	}
-	else if(t >= 965.0f) {
-		i = 0;
-	}
-	else {
+	else if(t < 965.0f) {
 		/* For 800 <= t < 965 color does not change in OSL implementation, so keep color the same */
 		return make_float3(4.70366907f, 0.0f, 0.0f);
 	}
 
+	int i = (t >= 6365.0f)? 5:
+		(t >= 3315.0f)? 4:
+		(t >= 1902.0f)? 3:
+		(t >= 1449.0f)? 2:
+		(t >= 1167.0f)? 1: 0;
+
 	const float t_inv = 1.0f / t;
 	return make_float3(rc[i][0] * t_inv + rc[i][1] * t + rc[i][2],
 	                   gc[i][0] * t_inv + gc[i][1] * t + gc[i][2],



More information about the Bf-blender-cvs mailing list