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:
authorLukas Toenne <lukas.toenne@googlemail.com>2012-09-07 15:06:45 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2012-09-07 15:06:45 +0400
commita9105a7deaccbd98c4e994d8f0f041bef4179bfa (patch)
treefc7fcebc23cdd2f580b32c7c629198497c6531ef /intern/cycles/util
parent8b6046cdad1325a82e0d161fdca0118e62f36b2d (diff)
Fix for Cycles (CUDA) compilation (again ...). Moved the AttributeStandard enum typedef and the attribute_standard_name mapping function to util_attribute/util_types headers, so they can properly be used by kernel and render files alike. This should avoid any std C includes which are not available in CUDA. Thanks to Sergey for help!
Diffstat (limited to 'intern/cycles/util')
-rw-r--r--intern/cycles/util/CMakeLists.txt2
-rw-r--r--intern/cycles/util/util_attribute.cpp47
-rw-r--r--intern/cycles/util/util_attribute.h31
-rw-r--r--intern/cycles/util/util_types.h16
4 files changed, 96 insertions, 0 deletions
diff --git a/intern/cycles/util/CMakeLists.txt b/intern/cycles/util/CMakeLists.txt
index 87bd84b4e0f..ae8403a14a8 100644
--- a/intern/cycles/util/CMakeLists.txt
+++ b/intern/cycles/util/CMakeLists.txt
@@ -6,6 +6,7 @@ set(INC
)
set(SRC
+ util_attribute.cpp
util_cache.cpp
util_cuda.cpp
util_dynlib.cpp
@@ -29,6 +30,7 @@ endif()
set(SRC_HEADERS
util_algorithm.h
util_args.h
+ util_attribute.h
util_boundbox.h
util_cache.h
util_cuda.h
diff --git a/intern/cycles/util/util_attribute.cpp b/intern/cycles/util/util_attribute.cpp
new file mode 100644
index 00000000000..3a1c2b6f332
--- /dev/null
+++ b/intern/cycles/util/util_attribute.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "util_attribute.h"
+
+CCL_NAMESPACE_BEGIN
+
+const char *attribute_standard_name(AttributeStandard std)
+{
+ if(std == ATTR_STD_VERTEX_NORMAL)
+ return "N";
+ else if(std == ATTR_STD_FACE_NORMAL)
+ return "Ng";
+ else if(std == ATTR_STD_UV)
+ return "uv";
+ else if(std == ATTR_STD_GENERATED)
+ return "generated";
+ else if(std == ATTR_STD_POSITION_UNDEFORMED)
+ return "undeformed";
+ else if(std == ATTR_STD_POSITION_UNDISPLACED)
+ return "undisplaced";
+ else if(std == ATTR_STD_MOTION_PRE)
+ return "motion_pre";
+ else if(std == ATTR_STD_MOTION_POST)
+ return "motion_post";
+ else if(std == ATTR_STD_PARTICLE)
+ return "particle";
+
+ return "";
+}
+
+CCL_NAMESPACE_END
diff --git a/intern/cycles/util/util_attribute.h b/intern/cycles/util/util_attribute.h
new file mode 100644
index 00000000000..334864c7f44
--- /dev/null
+++ b/intern/cycles/util/util_attribute.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __UTIL_ATTRIBUTE_H__
+#define __UTIL_ATTRIBUTE_H__
+
+#include "util_types.h"
+
+CCL_NAMESPACE_BEGIN
+
+const char *attribute_standard_name(AttributeStandard std);
+
+CCL_NAMESPACE_END
+
+#endif /* __UTIL_ATTRIBUTE_H__ */
+
diff --git a/intern/cycles/util/util_types.h b/intern/cycles/util/util_types.h
index 0451d877c45..5c6b9d5bb78 100644
--- a/intern/cycles/util/util_types.h
+++ b/intern/cycles/util/util_types.h
@@ -444,6 +444,22 @@ __device_inline int4 make_int4(const float3& f)
#endif
+typedef enum AttributeStandard {
+ ATTR_STD_NONE = 0,
+ ATTR_STD_VERTEX_NORMAL,
+ ATTR_STD_FACE_NORMAL,
+ ATTR_STD_UV,
+ ATTR_STD_GENERATED,
+ ATTR_STD_POSITION_UNDEFORMED,
+ ATTR_STD_POSITION_UNDISPLACED,
+ ATTR_STD_MOTION_PRE,
+ ATTR_STD_MOTION_POST,
+ ATTR_STD_PARTICLE,
+ ATTR_STD_NUM,
+
+ ATTR_STD_NOT_FOUND = ~0
+} AttributeStandard;
+
CCL_NAMESPACE_END
#endif /* __UTIL_TYPES_H__ */