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/device_memory.h
parent07d1fba3676c950b0cc3ab1dfb1f2de614c62697 (diff)
Cycles code internals: add CPU kernel support for 3D image textures.
Diffstat (limited to 'intern/cycles/device/device_memory.h')
-rw-r--r--intern/cycles/device/device_memory.h17
1 files changed, 11 insertions, 6 deletions
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;
}