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 <brecht@blender.org>2022-06-16 20:02:55 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-06-17 15:08:14 +0300
commit24246d98707096f16d5ab48f673f49354eac87a1 (patch)
tree4011651b36577ecac946c6f93cf011bf951e3dd5 /intern/cycles/kernel
parent838c4a97f1d6b993f4c866c474eb02d929f0ca1d (diff)
Cleanup: replace uint4 by AttributeMap struct
Diffstat (limited to 'intern/cycles/kernel')
-rw-r--r--intern/cycles/kernel/bvh/util.h12
-rw-r--r--intern/cycles/kernel/geom/attribute.h19
-rw-r--r--intern/cycles/kernel/textures.h2
-rw-r--r--intern/cycles/kernel/types.h10
4 files changed, 27 insertions, 16 deletions
diff --git a/intern/cycles/kernel/bvh/util.h b/intern/cycles/kernel/bvh/util.h
index 71045157372..d53198f97a3 100644
--- a/intern/cycles/kernel/bvh/util.h
+++ b/intern/cycles/kernel/bvh/util.h
@@ -111,16 +111,16 @@ ccl_device_inline int intersection_find_attribute(KernelGlobals kg,
const uint id)
{
uint attr_offset = kernel_tex_fetch(__objects, object).attribute_map_offset;
- uint4 attr_map = kernel_tex_fetch(__attributes_map, attr_offset);
+ AttributeMap attr_map = kernel_tex_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 (int)ATTR_STD_NOT_FOUND;
}
else {
/* Chain jump to a different part of the table. */
- attr_offset = attr_map.z;
+ attr_offset = attr_map.offset;
}
}
else {
@@ -130,7 +130,7 @@ ccl_device_inline int intersection_find_attribute(KernelGlobals kg,
}
/* return result */
- return (attr_map.y == ATTR_ELEMENT_NONE) ? (int)ATTR_STD_NOT_FOUND : (int)attr_map.z;
+ return (attr_map.element == ATTR_ELEMENT_NONE) ? (int)ATTR_STD_NOT_FOUND : (int)attr_map.offset;
}
/* Transparent Shadows */
diff --git a/intern/cycles/kernel/geom/attribute.h b/intern/cycles/kernel/geom/attribute.h
index da620f69e2d..774b25a76ff 100644
--- a/intern/cycles/kernel/geom/attribute.h
+++ b/intern/cycles/kernel/geom/attribute.h
@@ -56,16 +56,16 @@ 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_tex_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 {
@@ -75,7 +75,7 @@ ccl_device_inline AttributeDescriptor find_attribute(KernelGlobals kg,
}
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;
}
diff --git a/intern/cycles/kernel/textures.h b/intern/cycles/kernel/textures.h
index 7deb589a0a9..d8ac9cbe51f 100644
--- a/intern/cycles/kernel/textures.h
+++ b/intern/cycles/kernel/textures.h
@@ -47,7 +47,7 @@ KERNEL_TEX(float4, __points)
KERNEL_TEX(uint, __points_shader)
/* attributes */
-KERNEL_TEX(uint4, __attributes_map)
+KERNEL_TEX(AttributeMap, __attributes_map)
KERNEL_TEX(float, __attributes_float)
KERNEL_TEX(float2, __attributes_float2)
KERNEL_TEX(packed_float3, __attributes_float3)
diff --git a/intern/cycles/kernel/types.h b/intern/cycles/kernel/types.h
index b1ca379bab8..ad022716207 100644
--- a/intern/cycles/kernel/types.h
+++ b/intern/cycles/kernel/types.h
@@ -670,6 +670,16 @@ typedef struct AttributeDescriptor {
int offset;
} AttributeDescriptor;
+/* For looking up attributes on objects and geometry. */
+typedef struct AttributeMap {
+ uint id; /* Global unique identifier. */
+ uint element; /* AttributeElement. */
+ int offset; /* Offset into __attributes global arrays. */
+ uint8_t type; /* NodeAttributeType. */
+ uint8_t flags; /* AttributeFlag. */
+ uint8_t pad[2];
+} AttributeMap;
+
/* Closure data */
#ifndef __MAX_CLOSURE__