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:
Diffstat (limited to 'intern/cycles/kernel/osl')
-rw-r--r--intern/cycles/kernel/osl/osl_services.cpp44
1 files changed, 34 insertions, 10 deletions
diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp
index aee1e3a244e..7d1d1ae20c1 100644
--- a/intern/cycles/kernel/osl/osl_services.cpp
+++ b/intern/cycles/kernel/osl/osl_services.cpp
@@ -675,26 +675,50 @@ static bool get_primitive_attribute(KernelGlobals *kg,
if (attr.type == TypeDesc::TypePoint || attr.type == TypeDesc::TypeVector ||
attr.type == TypeDesc::TypeNormal || attr.type == TypeDesc::TypeColor) {
float3 fval[3];
- fval[0] = primitive_attribute_float3(
- kg, sd, attr.desc, (derivatives) ? &fval[1] : NULL, (derivatives) ? &fval[2] : NULL);
+ if (primitive_is_volume_attribute(sd, attr.desc)) {
+ fval[0] = primitive_volume_attribute_float3(kg, sd, attr.desc);
+ }
+ else {
+ memset(fval, 0, sizeof(fval));
+ fval[0] = primitive_surface_attribute_float3(
+ kg, sd, attr.desc, (derivatives) ? &fval[1] : NULL, (derivatives) ? &fval[2] : NULL);
+ }
return set_attribute_float3(fval, type, derivatives, val);
}
else if (attr.type == TypeFloat2) {
- float2 fval[3];
- fval[0] = primitive_attribute_float2(
- kg, sd, attr.desc, (derivatives) ? &fval[1] : NULL, (derivatives) ? &fval[2] : NULL);
- return set_attribute_float2(fval, type, derivatives, val);
+ if (primitive_is_volume_attribute(sd, attr.desc)) {
+ assert(!"Float2 attribute not support for volumes");
+ return false;
+ }
+ else {
+ float2 fval[3];
+ fval[0] = primitive_surface_attribute_float2(
+ kg, sd, attr.desc, (derivatives) ? &fval[1] : NULL, (derivatives) ? &fval[2] : NULL);
+ return set_attribute_float2(fval, type, derivatives, val);
+ }
}
else if (attr.type == TypeDesc::TypeFloat) {
float fval[3];
- fval[0] = primitive_attribute_float(
- kg, sd, attr.desc, (derivatives) ? &fval[1] : NULL, (derivatives) ? &fval[2] : NULL);
+ if (primitive_is_volume_attribute(sd, attr.desc)) {
+ memset(fval, 0, sizeof(fval));
+ fval[0] = primitive_volume_attribute_float(kg, sd, attr.desc);
+ }
+ else {
+ fval[0] = primitive_surface_attribute_float(
+ kg, sd, attr.desc, (derivatives) ? &fval[1] : NULL, (derivatives) ? &fval[2] : NULL);
+ }
return set_attribute_float(fval, type, derivatives, val);
}
else if (attr.type == TypeRGBA) {
float4 fval[3];
- fval[0] = primitive_attribute_float4(
- kg, sd, attr.desc, (derivatives) ? &fval[1] : NULL, (derivatives) ? &fval[2] : NULL);
+ if (primitive_is_volume_attribute(sd, attr.desc)) {
+ memset(fval, 0, sizeof(fval));
+ fval[0] = primitive_volume_attribute_float4(kg, sd, attr.desc);
+ }
+ else {
+ fval[0] = primitive_surface_attribute_float4(
+ kg, sd, attr.desc, (derivatives) ? &fval[1] : NULL, (derivatives) ? &fval[2] : NULL);
+ }
return set_attribute_float4(fval, type, derivatives, val);
}
else {