Fix for attribute lookup in OSL. This uses a map in the OSL globals instead of the...
[blender.git] / intern / cycles / kernel / kernel_types.h
index 39e088583c47e9d0fdb5dd3ee574a7b68ae94c10..738d459df30eb1845a3f0e0bc48eadd15a320154 100644 (file)
@@ -22,6 +22,8 @@
 #include "kernel_math.h"
 #include "svm/svm_types.h"
 
+#include "util_param.h"
+
 #ifndef __KERNEL_GPU__
 #define __KERNEL_CPU__
 #endif
@@ -368,6 +370,30 @@ typedef enum AttributeStandard {
        ATTR_STD_NOT_FOUND = ~0
 } AttributeStandard;
 
+__device ustring attribute_standard_name(AttributeStandard std)
+{
+       if(std == ATTR_STD_VERTEX_NORMAL)
+               return ustring("N");
+       else if(std == ATTR_STD_FACE_NORMAL)
+               return ustring("Ng");
+       else if(std == ATTR_STD_UV)
+               return ustring("uv");
+       else if(std == ATTR_STD_GENERATED)
+               return ustring("generated");
+       else if(std == ATTR_STD_POSITION_UNDEFORMED)
+               return ustring("undeformed");
+       else if(std == ATTR_STD_POSITION_UNDISPLACED)
+               return ustring("undisplaced");
+       else if(std == ATTR_STD_MOTION_PRE)
+               return ustring("motion_pre");
+       else if(std == ATTR_STD_MOTION_POST)
+               return ustring("motion_post");
+       else if(std == ATTR_STD_PARTICLE)
+               return ustring("particle");
+       
+       return ustring();
+}
+
 /* Closure data */
 
 #define MAX_CLOSURE 8