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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2017-11-05 19:40:36 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2017-11-05 20:00:48 +0300
commitcac3d4d16691d77e8e01f158be07d182e56e9755 (patch)
tree455a4d3669f48bfdd1064490082a7a51f9593090 /intern/cycles/kernel/geom
parent5801ef71e40bc932c69e67f06076cd8b41132e52 (diff)
Cycles: fix inefficient attribute map storage, saves 615MB in victor scene.
Diffstat (limited to 'intern/cycles/kernel/geom')
-rw-r--r--intern/cycles/kernel/geom/geom_attribute.h11
-rw-r--r--intern/cycles/kernel/geom/geom_motion_curve.h2
-rw-r--r--intern/cycles/kernel/geom/geom_motion_triangle.h2
3 files changed, 11 insertions, 4 deletions
diff --git a/intern/cycles/kernel/geom/geom_attribute.h b/intern/cycles/kernel/geom/geom_attribute.h
index cc62192ef21..18f5c813cc8 100644
--- a/intern/cycles/kernel/geom/geom_attribute.h
+++ b/intern/cycles/kernel/geom/geom_attribute.h
@@ -51,14 +51,21 @@ ccl_device_inline AttributeDescriptor attribute_not_found()
/* Find attribute based on ID */
+ccl_device_inline uint object_attribute_map_offset(KernelGlobals *kg, int object)
+{
+ int offset = object*OBJECT_SIZE + 11;
+ float4 f = kernel_tex_fetch(__objects, offset);
+ return __float_as_uint(f.y);
+}
+
ccl_device_inline AttributeDescriptor find_attribute(KernelGlobals *kg, const ShaderData *sd, uint id)
{
- if(sd->object == PRIM_NONE) {
+ if(sd->object == OBJECT_NONE) {
return attribute_not_found();
}
/* for SVM, find attribute by unique id */
- uint attr_offset = sd->object*kernel_data.bvh.attributes_map_stride;
+ uint attr_offset = object_attribute_map_offset(kg, sd->object);
attr_offset += attribute_primitive_type(kg, sd);
uint4 attr_map = kernel_tex_fetch(__attributes_map, attr_offset);
diff --git a/intern/cycles/kernel/geom/geom_motion_curve.h b/intern/cycles/kernel/geom/geom_motion_curve.h
index 119bdb2f15c..fad29e431ec 100644
--- a/intern/cycles/kernel/geom/geom_motion_curve.h
+++ b/intern/cycles/kernel/geom/geom_motion_curve.h
@@ -33,7 +33,7 @@ ccl_device_inline int find_attribute_curve_motion(KernelGlobals *kg, int object,
* zero iterations and rendering is really slow with motion curves. For until other
* areas are speed up it's probably not so crucial to optimize this out.
*/
- uint attr_offset = object*kernel_data.bvh.attributes_map_stride + ATTR_PRIM_CURVE;
+ uint attr_offset = object_attribute_map_offset(kg, object) + ATTR_PRIM_CURVE;
uint4 attr_map = kernel_tex_fetch(__attributes_map, attr_offset);
while(attr_map.x != id) {
diff --git a/intern/cycles/kernel/geom/geom_motion_triangle.h b/intern/cycles/kernel/geom/geom_motion_triangle.h
index 4e84aa97776..cd28b75c22c 100644
--- a/intern/cycles/kernel/geom/geom_motion_triangle.h
+++ b/intern/cycles/kernel/geom/geom_motion_triangle.h
@@ -32,7 +32,7 @@ CCL_NAMESPACE_BEGIN
ccl_device_inline int find_attribute_motion(KernelGlobals *kg, int object, uint id, AttributeElement *elem)
{
/* todo: find a better (faster) solution for this, maybe store offset per object */
- uint attr_offset = object*kernel_data.bvh.attributes_map_stride;
+ uint attr_offset = object_attribute_map_offset(kg, object);
uint4 attr_map = kernel_tex_fetch(__attributes_map, attr_offset);
while(attr_map.x != id) {