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:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-07-27 11:24:03 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-07-27 11:24:03 +0300
commitca359461a803808a832ff603e2d01468a252c90f (patch)
tree0ef2a4a34645e4126c7713a128bccd0787c9c851
parentde80b928a33bb753bec360e0d4cfeafd0bf23b0c (diff)
Cycles: Cleanup, move functions outside of class methods
There is no reason or justification to have helper functions as class methods: they do not depend on anything in the class itself. There are probably more cases like that.
-rw-r--r--intern/cycles/render/image.cpp78
-rw-r--r--intern/cycles/render/image.h4
2 files changed, 41 insertions, 41 deletions
diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp
index b8892a5329d..78451658764 100644
--- a/intern/cycles/render/image.cpp
+++ b/intern/cycles/render/image.cpp
@@ -30,20 +30,58 @@
CCL_NAMESPACE_BEGIN
+namespace {
+
/* Some helpers to silence warning in templated function. */
-static bool isfinite(uchar /*value*/)
+bool isfinite(uchar /*value*/)
{
return true;
}
-static bool isfinite(half /*value*/)
+bool isfinite(half /*value*/)
{
return true;
}
-static bool isfinite(uint16_t /*value*/)
+bool isfinite(uint16_t /*value*/)
{
return true;
}
+/* The lower three bits of a device texture slot number indicate its type.
+ * These functions convert the slot ids from ImageManager "images" ones
+ * to device ones and vice verse.
+ */
+int type_index_to_flattened_slot(int slot, ImageDataType type)
+{
+ return (slot << IMAGE_DATA_TYPE_SHIFT) | (type);
+}
+
+int flattened_slot_to_type_index(int flat_slot, ImageDataType *type)
+{
+ *type = (ImageDataType)(flat_slot & IMAGE_DATA_TYPE_MASK);
+ return flat_slot >> IMAGE_DATA_TYPE_SHIFT;
+}
+
+const char* name_from_type(ImageDataType type)
+{
+ switch(type) {
+ case IMAGE_DATA_TYPE_FLOAT4: return "float4";
+ case IMAGE_DATA_TYPE_BYTE4: return "byte4";
+ case IMAGE_DATA_TYPE_HALF4: return "half4";
+ case IMAGE_DATA_TYPE_FLOAT: return "float";
+ case IMAGE_DATA_TYPE_BYTE: return "byte";
+ case IMAGE_DATA_TYPE_HALF: return "half";
+ case IMAGE_DATA_TYPE_USHORT4: return "ushort4";
+ case IMAGE_DATA_TYPE_USHORT: return "ushort";
+ case IMAGE_DATA_NUM_TYPES:
+ assert(!"System enumerator type, should never be used");
+ return "";
+ }
+ assert(!"Unhandled image data type");
+ return "";
+}
+
+} // namespace
+
ImageManager::ImageManager(const DeviceInfo& info)
{
need_update = true;
@@ -229,40 +267,6 @@ bool ImageManager::get_image_metadata(const string& filename,
return true;
}
-/* The lower three bits of a device texture slot number indicate its type.
- * These functions convert the slot ids from ImageManager "images" ones
- * to device ones and vice verse.
- */
-int ImageManager::type_index_to_flattened_slot(int slot, ImageDataType type)
-{
- return (slot << IMAGE_DATA_TYPE_SHIFT) | (type);
-}
-
-int ImageManager::flattened_slot_to_type_index(int flat_slot, ImageDataType *type)
-{
- *type = (ImageDataType)(flat_slot & IMAGE_DATA_TYPE_MASK);
- return flat_slot >> IMAGE_DATA_TYPE_SHIFT;
-}
-
-const char* ImageManager::name_from_type(ImageDataType type)
-{
- switch(type) {
- case IMAGE_DATA_TYPE_FLOAT4: return "float4";
- case IMAGE_DATA_TYPE_BYTE4: return "byte4";
- case IMAGE_DATA_TYPE_HALF4: return "half4";
- case IMAGE_DATA_TYPE_FLOAT: return "float";
- case IMAGE_DATA_TYPE_BYTE: return "byte";
- case IMAGE_DATA_TYPE_HALF: return "half";
- case IMAGE_DATA_TYPE_USHORT4: return "ushort4";
- case IMAGE_DATA_TYPE_USHORT: return "ushort";
- case IMAGE_DATA_NUM_TYPES:
- assert(!"System enumerator type, should never be used");
- return "";
- }
- assert(!"Unhandled image data type");
- return "";
-}
-
static bool image_equals(ImageManager::Image *image,
const string& filename,
void *builtin_data,
diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h
index 40b8629d549..67af4ba886c 100644
--- a/intern/cycles/render/image.h
+++ b/intern/cycles/render/image.h
@@ -149,10 +149,6 @@ private:
int texture_limit,
device_vector<DeviceType>& tex_img);
- int type_index_to_flattened_slot(int slot, ImageDataType type);
- int flattened_slot_to_type_index(int flat_slot, ImageDataType *type);
- const char* name_from_type(ImageDataType type);
-
void device_load_image(Device *device,
Scene *scene,
ImageDataType type,