Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Stockner <lukas.stockner@freenet.de>2016-11-03 05:08:14 +0300
committerLukas Stockner <lukas.stockner@freenet.de>2016-11-03 05:08:14 +0300
commit9847ad977a29685d3400ec222213dfb484ec01f5 (patch)
treefe3b531f2a4e7a9d5dcb1cff1fb0f6c8c7db6d85 /intern/cycles/kernel/geom
parent643c5a24d56f00c45d03b52f4b1211c05a78bf0f (diff)
Cycles: Fix T49901: OpenCL build error after recent light texture coordinate commit
Basically, the problem here was that the transform that's used to bring texture coordinates to world space is either fetched while setting up the shader (with Object Motion is enabled) or fetched when needed (otherwise). That helps to save ShaderData memory on OpenCL when Object Motion isn't needed. Now, if OM is enabled, the Lamp transform can just be stored inside the ShaderData as well. The original commit just assumed it is. However, when it's not (on OpenCL by default, for example), there is no easy way to fetch it when needed, since the ShaderData doesn't store the Lamp index. So, for now the lamps just don't support local texture coordinates anymore when Object Motion is disabled. To fix and support this properly, one of the following could be done: - Just always pre-fetch the transform. Downside: Memory Usage increases when not using OM on OpenCL - Add a variable to ShaderData that stores the Lamp ID to allow fetching it when needed - Store the Lamp ID inside prim or object. Problem: Cycles currently checks these for whether an object was hit - these checks would need to be changed. - Enable OM whenever a Texture Coordinate's Normal output is used. Downside: Might not actually be needed.
Diffstat (limited to 'intern/cycles/kernel/geom')
-rw-r--r--intern/cycles/kernel/geom/geom_object.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/intern/cycles/kernel/geom/geom_object.h b/intern/cycles/kernel/geom/geom_object.h
index 6b42f66b0d5..73dc5a0a726 100644
--- a/intern/cycles/kernel/geom/geom_object.h
+++ b/intern/cycles/kernel/geom/geom_object.h
@@ -161,11 +161,15 @@ ccl_device_inline void object_inverse_position_transform(KernelGlobals *kg, cons
ccl_device_inline void object_inverse_normal_transform(KernelGlobals *kg, const ShaderData *sd, float3 *N)
{
-#ifdef __OBJECT_MOTION__
- *N = normalize(transform_direction_transposed_auto(&ccl_fetch(sd, ob_tfm), *N));
+#ifdef __OBJECT_MOTION_
+ if((ccl_fetch(sd, object) != OBJECT_NONE) || (ccl_fetch(sd, type) == PRIMITIVE_LAMP)) {
+ *N = normalize(transform_direction_transposed_auto(&ccl_fetch(sd, ob_tfm), *N));
+ }
#else
- Transform tfm = object_fetch_transform(kg, ccl_fetch(sd, object), OBJECT_TRANSFORM);
- *N = normalize(transform_direction_transposed(&tfm, *N));
+ if(ccl_fetch(sd, object) != OBJECT_NONE) {
+ Transform tfm = object_fetch_transform(kg, ccl_fetch(sd, object), OBJECT_TRANSFORM);
+ *N = normalize(transform_direction_transposed(&tfm, *N));
+ }
#endif
}