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-09-14 19:53:35 +0300
committerLukas Stockner <lukas.stockner@freenet.de>2016-09-14 19:53:35 +0300
commitaae2cea28d0c6c970778674e0ba329b2208b8366 (patch)
treef2a83d7bdf56be8a9578fc37d554fc69f37b0e7c /intern/cycles/render
parent51e8c167f40c63c191ac9271fe02de78f2a49b22 (diff)
Cycles: Also support the constant emission speedup for mesh lights
Reviewers: brecht, sergey, dingto, juicyfruit Differential Revision: https://developer.blender.org/D2220
Diffstat (limited to 'intern/cycles/render')
-rw-r--r--intern/cycles/render/light.cpp7
-rw-r--r--intern/cycles/render/shader.cpp10
2 files changed, 10 insertions, 7 deletions
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp
index 3b7935803f4..93f6d7902f0 100644
--- a/intern/cycles/render/light.cpp
+++ b/intern/cycles/render/light.cpp
@@ -661,11 +661,6 @@ void LightManager::device_update_points(Device *device,
use_light_visibility = true;
}
- float3 fixed_emission = make_float3(0.0f, 0.0f, 0.0f);
- if(shader->is_constant_emission(&fixed_emission)) {
- shader_id |= SHADER_FIXED_EMISSION;
- }
-
if(light->type == LIGHT_POINT) {
shader_id &= ~SHADER_AREA_LIGHT;
@@ -765,7 +760,7 @@ void LightManager::device_update_points(Device *device,
light_data[light_index*LIGHT_SIZE + 3] = make_float4(samples, 0.0f, 0.0f, 0.0f);
}
- light_data[light_index*LIGHT_SIZE + 4] = make_float4(max_bounces, fixed_emission.x, fixed_emission.y, fixed_emission.z);
+ light_data[light_index*LIGHT_SIZE + 4] = make_float4(max_bounces, 0.0f, 0.0f, 0.0f);
light_index++;
}
diff --git a/intern/cycles/render/shader.cpp b/intern/cycles/render/shader.cpp
index 1849161ead9..06b6dd969d8 100644
--- a/intern/cycles/render/shader.cpp
+++ b/intern/cycles/render/shader.cpp
@@ -401,7 +401,7 @@ void ShaderManager::device_update_common(Device *device,
if(scene->shaders.size() == 0)
return;
- uint shader_flag_size = scene->shaders.size()*2;
+ uint shader_flag_size = scene->shaders.size()*SHADER_SIZE;
uint *shader_flag = dscene->shader_flag.resize(shader_flag_size);
uint i = 0;
bool has_volumes = false;
@@ -446,9 +446,17 @@ void ShaderManager::device_update_common(Device *device,
if(shader->displacement_method != DISPLACE_TRUE && shader->graph_bump)
flag |= SD_HAS_BSSRDF_BUMP;
+ /* constant emission check */
+ float3 constant_emission = make_float3(0.0f, 0.0f, 0.0f);
+ if(shader->is_constant_emission(&constant_emission))
+ flag |= SD_HAS_CONSTANT_EMISSION;
+
/* regular shader */
shader_flag[i++] = flag;
shader_flag[i++] = shader->pass_id;
+ shader_flag[i++] = __float_as_int(constant_emission.x);
+ shader_flag[i++] = __float_as_int(constant_emission.y);
+ shader_flag[i++] = __float_as_int(constant_emission.z);
has_transparent_shadow |= (flag & SD_HAS_TRANSPARENT_SHADOW) != 0;
}