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>2017-10-21 02:09:59 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2017-10-24 02:25:19 +0300
commit070a668d04844610059aaedc80c49e9038fd1779 (patch)
treecad5c64972e45b4ee19cc8e11cdd9adedd7a2f08 /intern/cycles/device/device_split_kernel.cpp
parentaa8b4c5d8124c0379eeee9eacd1a0887a573d7d7 (diff)
Code refactor: move more memory allocation logic into device API.
* Remove tex_* and pixels_* functions, replace by mem_*. * Add MEM_TEXTURE and MEM_PIXELS as memory types recognized by devices. * No longer create device_memory and call mem_* directly, always go through device_only_memory, device_vector and device_pixels.
Diffstat (limited to 'intern/cycles/device/device_split_kernel.cpp')
-rw-r--r--intern/cycles/device/device_split_kernel.cpp37
1 files changed, 14 insertions, 23 deletions
diff --git a/intern/cycles/device/device_split_kernel.cpp b/intern/cycles/device/device_split_kernel.cpp
index 6c8befa89be..f2839a8b1b9 100644
--- a/intern/cycles/device/device_split_kernel.cpp
+++ b/intern/cycles/device/device_split_kernel.cpp
@@ -61,11 +61,11 @@ DeviceSplitKernel::DeviceSplitKernel(Device *device)
DeviceSplitKernel::~DeviceSplitKernel()
{
- device->mem_free(split_data);
- device->mem_free(ray_state);
- device->mem_free(use_queues_flag);
- device->mem_free(queue_index);
- device->mem_free(work_pool_wgs);
+ split_data.free();
+ ray_state.free();
+ use_queues_flag.free();
+ queue_index.free();
+ work_pool_wgs.free();
delete kernel_path_init;
delete kernel_scene_intersect;
@@ -175,20 +175,11 @@ bool DeviceSplitKernel::path_trace(DeviceTask *task,
unsigned int max_work_groups = num_global_elements / work_pool_size + 1;
/* Allocate work_pool_wgs memory. */
- work_pool_wgs.resize(max_work_groups);
- device->mem_alloc(work_pool_wgs);
-
- queue_index.resize(NUM_QUEUES);
- device->mem_alloc(queue_index);
-
- use_queues_flag.resize(1);
- device->mem_alloc(use_queues_flag);
-
- ray_state.resize(num_global_elements);
- device->mem_alloc(ray_state);
-
- split_data.resize(state_buffer_size(kgbuffer, kernel_data, num_global_elements));
- device->mem_alloc(split_data);
+ work_pool_wgs.alloc_to_device(max_work_groups);
+ queue_index.alloc_to_device(NUM_QUEUES);
+ use_queues_flag.alloc_to_device(1);
+ split_data.alloc_to_device(state_buffer_size(kgbuffer, kernel_data, num_global_elements));
+ ray_state.alloc(num_global_elements);
}
#define ENQUEUE_SPLIT_KERNEL(name, global_size, local_size) \
@@ -225,9 +216,9 @@ bool DeviceSplitKernel::path_trace(DeviceTask *task,
/* reset state memory here as global size for data_init
* kernel might not be large enough to do in kernel
*/
- device->mem_zero(work_pool_wgs);
- device->mem_zero(split_data);
- device->mem_zero(ray_state);
+ work_pool_wgs.zero_to_device();
+ split_data.zero_to_device();
+ ray_state.zero_to_device();
if(!enqueue_split_kernel_data_init(KernelDimensions(global_size, local_size),
subtile,
@@ -284,7 +275,7 @@ bool DeviceSplitKernel::path_trace(DeviceTask *task,
}
/* Decide if we should exit path-iteration in host. */
- device->mem_copy_from(ray_state, 0, global_size[0] * global_size[1] * sizeof(char), 1, 1);
+ ray_state.copy_from_device(0, global_size[0] * global_size[1], 1);
activeRaysAvailable = false;