diff options
Diffstat (limited to 'intern/cycles/kernel/geom/attribute.h')
-rw-r--r-- | intern/cycles/kernel/geom/attribute.h | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/intern/cycles/kernel/geom/attribute.h b/intern/cycles/kernel/geom/attribute.h index da620f69e2d..31a9e39d528 100644 --- a/intern/cycles/kernel/geom/attribute.h +++ b/intern/cycles/kernel/geom/attribute.h @@ -18,7 +18,7 @@ CCL_NAMESPACE_BEGIN ccl_device_inline uint subd_triangle_patch(KernelGlobals kg, ccl_private const ShaderData *sd) { - return (sd->prim != PRIM_NONE) ? kernel_tex_fetch(__tri_patch, sd->prim) : ~0; + return (sd->prim != PRIM_NONE) ? kernel_data_fetch(tri_patch, sd->prim) : ~0; } ccl_device_inline uint attribute_primitive_type(KernelGlobals kg, ccl_private const ShaderData *sd) @@ -42,7 +42,7 @@ ccl_device_inline AttributeDescriptor attribute_not_found() ccl_device_inline uint object_attribute_map_offset(KernelGlobals kg, int object) { - return kernel_tex_fetch(__objects, object).attribute_map_offset; + return kernel_data_fetch(objects, object).attribute_map_offset; } ccl_device_inline AttributeDescriptor find_attribute(KernelGlobals kg, @@ -56,26 +56,26 @@ ccl_device_inline AttributeDescriptor find_attribute(KernelGlobals kg, /* for SVM, find attribute by unique id */ 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); + AttributeMap attr_map = kernel_data_fetch(attributes_map, attr_offset); - while (attr_map.x != id) { - if (UNLIKELY(attr_map.x == ATTR_STD_NONE)) { - if (UNLIKELY(attr_map.y == 0)) { + while (attr_map.id != id) { + if (UNLIKELY(attr_map.id == ATTR_STD_NONE)) { + if (UNLIKELY(attr_map.element == 0)) { return attribute_not_found(); } else { /* Chain jump to a different part of the table. */ - attr_offset = attr_map.z; + attr_offset = attr_map.offset; } } else { attr_offset += ATTR_PRIM_TYPES; } - attr_map = kernel_tex_fetch(__attributes_map, attr_offset); + attr_map = kernel_data_fetch(attributes_map, attr_offset); } AttributeDescriptor desc; - desc.element = (AttributeElement)attr_map.y; + desc.element = (AttributeElement)attr_map.element; if (sd->prim == PRIM_NONE && desc.element != ATTR_ELEMENT_MESH && desc.element != ATTR_ELEMENT_VOXEL && desc.element != ATTR_ELEMENT_OBJECT) { @@ -83,9 +83,10 @@ ccl_device_inline AttributeDescriptor find_attribute(KernelGlobals kg, } /* return result */ - desc.offset = (attr_map.y == ATTR_ELEMENT_NONE) ? (int)ATTR_STD_NOT_FOUND : (int)attr_map.z; - desc.type = (NodeAttributeType)(attr_map.w & 0xff); - desc.flags = (AttributeFlag)(attr_map.w >> 8); + desc.offset = (attr_map.element == ATTR_ELEMENT_NONE) ? (int)ATTR_STD_NOT_FOUND : + (int)attr_map.offset; + desc.type = (NodeAttributeType)attr_map.type; + desc.flags = (AttributeFlag)attr_map.flags; return desc; } @@ -98,9 +99,9 @@ ccl_device Transform primitive_attribute_matrix(KernelGlobals kg, { Transform tfm; - tfm.x = kernel_tex_fetch(__attributes_float4, desc.offset + 0); - tfm.y = kernel_tex_fetch(__attributes_float4, desc.offset + 1); - tfm.z = kernel_tex_fetch(__attributes_float4, desc.offset + 2); + tfm.x = kernel_data_fetch(attributes_float4, desc.offset + 0); + tfm.y = kernel_data_fetch(attributes_float4, desc.offset + 1); + tfm.z = kernel_data_fetch(attributes_float4, desc.offset + 2); return tfm; } |