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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2014-03-29 16:03:48 +0400
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2014-03-29 16:03:48 +0400
commita2e4ebd36a319dc18f362b1f75863b8ee93eed7d (patch)
treebcf041e53375766661de3d0a199930369b3d1466 /intern/cycles/device
parent07d1fba3676c950b0cc3ab1dfb1f2de614c62697 (diff)
Cycles code internals: add CPU kernel support for 3D image textures.
Diffstat (limited to 'intern/cycles/device')
-rw-r--r--intern/cycles/device/device_cpu.cpp2
-rw-r--r--intern/cycles/device/device_cuda.cpp2
-rw-r--r--intern/cycles/device/device_memory.h17
-rw-r--r--intern/cycles/device/device_network.h4
4 files changed, 16 insertions, 9 deletions
diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp
index de44feb2deb..e14e403d82b 100644
--- a/intern/cycles/device/device_cpu.cpp
+++ b/intern/cycles/device/device_cpu.cpp
@@ -105,7 +105,7 @@ public:
void tex_alloc(const char *name, device_memory& mem, InterpolationType interpolation, bool periodic)
{
- kernel_tex_copy(&kernel_globals, name, mem.data_pointer, mem.data_width, mem.data_height, interpolation);
+ kernel_tex_copy(&kernel_globals, name, mem.data_pointer, mem.data_width, mem.data_height, mem.data_depth, interpolation);
mem.device_pointer = mem.data_pointer;
stats.mem_alloc(mem.memory_size());
diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp
index a8a3134328f..26d356af458 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -461,6 +461,8 @@ public:
void tex_alloc(const char *name, device_memory& mem, InterpolationType interpolation, bool periodic)
{
+ /* todo: support 3D textures, only CPU for now */
+
/* determine format */
CUarray_format_enum format;
size_t dsize = datatype_size(mem.data_type);
diff --git a/intern/cycles/device/device_memory.h b/intern/cycles/device/device_memory.h
index 1427d12cba2..8d6f4a49a9c 100644
--- a/intern/cycles/device/device_memory.h
+++ b/intern/cycles/device/device_memory.h
@@ -169,6 +169,7 @@ public:
size_t data_size;
size_t data_width;
size_t data_height;
+ size_t data_depth;
/* device pointer */
device_ptr device_pointer;
@@ -195,6 +196,7 @@ public:
data_size = 0;
data_width = 0;
data_height = 0;
+ data_depth = 0;
assert(data_elements > 0);
@@ -204,20 +206,21 @@ public:
virtual ~device_vector() {}
/* vector functions */
- T *resize(size_t width, size_t height = 0)
+ T *resize(size_t width, size_t height = 0, size_t depth = 0)
{
- data_size = (height == 0)? width: width*height;
+ data_size = width * ((height == 0)? 1: height) * ((depth == 0)? 1: depth);
data.resize(data_size);
data_pointer = (device_ptr)&data[0];
data_width = width;
data_height = height;
+ data_depth = depth;
return &data[0];
}
- T *copy(T *ptr, size_t width, size_t height = 0)
+ T *copy(T *ptr, size_t width, size_t height = 0, size_t depth = 0)
{
- T *mem = resize(width, height);
+ T *mem = resize(width, height, depth);
memcpy(mem, ptr, memory_size());
return mem;
}
@@ -230,13 +233,14 @@ public:
}
}
- void reference(T *ptr, size_t width, size_t height = 0)
+ void reference(T *ptr, size_t width, size_t height = 0, size_t depth = 0)
{
data.clear();
- data_size = (height == 0)? width: width*height;
+ data_size = width * ((height == 0)? 1: height) * ((depth == 0)? 1: depth);
data_pointer = (device_ptr)ptr;
data_width = width;
data_height = height;
+ data_depth = depth;
}
void clear()
@@ -245,6 +249,7 @@ public:
data_pointer = 0;
data_width = 0;
data_height = 0;
+ data_depth = 0;
data_size = 0;
}
diff --git a/intern/cycles/device/device_network.h b/intern/cycles/device/device_network.h
index bf8f3c70c49..8596b61b179 100644
--- a/intern/cycles/device/device_network.h
+++ b/intern/cycles/device/device_network.h
@@ -118,7 +118,7 @@ public:
void add(const device_memory& mem)
{
archive & mem.data_type & mem.data_elements & mem.data_size;
- archive & mem.data_width & mem.data_height & mem.device_pointer;
+ archive & mem.data_width & mem.data_height & mem.data_depth & mem.device_pointer;
}
template<typename T> void add(const T& data)
@@ -261,7 +261,7 @@ public:
void read(network_device_memory& mem)
{
*archive & mem.data_type & mem.data_elements & mem.data_size;
- *archive & mem.data_width & mem.data_height & mem.device_pointer;
+ *archive & mem.data_width & mem.data_height & mem.data_depth & mem.device_pointer;
mem.data_pointer = 0;
}