Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/geom/geom_primitive.h
| Show First 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | if (sd->type & PRIMITIVE_ALL_TRIANGLE) { | ||||
| else | else | ||||
| return subd_triangle_attribute_float4(kg, sd, desc, dx, dy); | return subd_triangle_attribute_float4(kg, sd, desc, dx, dy); | ||||
| } | } | ||||
| #ifdef __HAIR__ | #ifdef __HAIR__ | ||||
| else if (sd->type & PRIMITIVE_ALL_CURVE) { | else if (sd->type & PRIMITIVE_ALL_CURVE) { | ||||
| return curve_attribute_float4(kg, sd, desc, dx, dy); | return curve_attribute_float4(kg, sd, desc, dx, dy); | ||||
| } | } | ||||
| #endif | #endif | ||||
| else { | else { | ||||
| if (dx) | if (dx) | ||||
| *dx = make_float4(0.0f, 0.0f, 0.0f, 0.0f); | *dx = make_float4(0.0f, 0.0f, 0.0f, 0.0f); | ||||
| if (dy) | if (dy) | ||||
| *dy = make_float4(0.0f, 0.0f, 0.0f, 0.0f); | *dy = make_float4(0.0f, 0.0f, 0.0f, 0.0f); | ||||
| return make_float4(0.0f, 0.0f, 0.0f, 0.0f); | return make_float4(0.0f, 0.0f, 0.0f, 0.0f); | ||||
| } | } | ||||
| } | } | ||||
| #ifdef __VOLUME__ | #ifdef __VOLUME__ | ||||
| /* Volume Attributes | /* Volume Attributes | ||||
brecht: Adding this should be avoided, on the GPU having multiple such calls to volume attribute lookup… | |||||
Done Inline ActionsI added this because it wasn't handled through the code path taken when primitive_is_volume_attribute is true. But making primitive_is_volume_attribute return true with sd->type == PRIMITIVE_VOLUME will handle it. kevindietrich: I added this because it wasn't handled through the code path taken when… | |||||
| * | * | ||||
| * Read geometry attributes for volume shading. This is distinct from surface | * Read geometry attributes for volume shading. This is distinct from surface | ||||
| * attributes for performance, mainly for GPU performance to avoid bringing in | * attributes for performance, mainly for GPU performance to avoid bringing in | ||||
| * heavy volume interpolation code. */ | * heavy volume interpolation code. */ | ||||
| ccl_device_inline bool primitive_is_volume_attribute(const ShaderData *sd, | ccl_device_inline bool primitive_is_volume_attribute(const ShaderData *sd, | ||||
| const AttributeDescriptor desc) | const AttributeDescriptor desc) | ||||
| { | { | ||||
| return (sd->object != OBJECT_NONE && desc.element == ATTR_ELEMENT_VOXEL); | return sd->type == PRIMITIVE_VOLUME; | ||||
Done Inline ActionsCan we change this to return sd->prim == PRIMITIVE_VOLUME now? Since all potential attributes are handled by volume_attribute_float4, so no need to check desc.element here. brecht: Can we change this to `return sd->prim == PRIMITIVE_VOLUME` now?
Since all potential… | |||||
| } | } | ||||
| ccl_device_inline float primitive_volume_attribute_float(KernelGlobals *kg, | ccl_device_inline float primitive_volume_attribute_float(KernelGlobals *kg, | ||||
| const ShaderData *sd, | const ShaderData *sd, | ||||
| const AttributeDescriptor desc) | const AttributeDescriptor desc) | ||||
| { | { | ||||
| if (primitive_is_volume_attribute(sd, desc)) { | if (primitive_is_volume_attribute(sd, desc)) { | ||||
| return volume_attribute_value_to_float(volume_attribute_float4(kg, sd, desc)); | return volume_attribute_value_to_float(volume_attribute_float4(kg, sd, desc)); | ||||
| ▲ Show 20 Lines • Show All 191 Lines • Show Last 20 Lines | |||||
Adding this should be avoided, on the GPU having multiple such calls to volume attribute lookup leads to poor performance. Not sure why it's needed anyway.