[Bf-blender-cvs] [083fe7e] cycles_split_kernel: Cycles: Keep consistent memory management style

Mai Lavelle noreply at git.blender.org
Wed Dec 7 10:53:59 CET 2016


Commit: 083fe7eb46e65d94eb5dd7ebc2a43a495b3d88ea
Author: Mai Lavelle
Date:   Wed Dec 7 04:45:05 2016 -0500
Branches: cycles_split_kernel
https://developer.blender.org/rB083fe7eb46e65d94eb5dd7ebc2a43a495b3d88ea

Cycles: Keep consistent memory management style

`unique_ptr` avoids some issues but we aren't using it anywhere else so
to keep things consistent just using plain `delete` for now.

===================================================================

M	intern/cycles/device/device_split_kernel.cpp
M	intern/cycles/device/device_split_kernel.h
M	intern/cycles/util/CMakeLists.txt
D	intern/cycles/util/util_memory.h

===================================================================

diff --git a/intern/cycles/device/device_split_kernel.cpp b/intern/cycles/device/device_split_kernel.cpp
index 65e7872..872e21c 100644
--- a/intern/cycles/device/device_split_kernel.cpp
+++ b/intern/cycles/device/device_split_kernel.cpp
@@ -36,12 +36,23 @@ DeviceSplitKernel::~DeviceSplitKernel()
 	device->mem_free(use_queues_flag);
 	device->mem_free(queue_index);
 	device->mem_free(work_pool_wgs);
+
+	delete kernel_scene_intersect;
+	delete kernel_lamp_emission;
+	delete kernel_queue_enqueue;
+	delete kernel_background_buffer_update;
+	delete kernel_shader_eval;
+	delete kernel_holdout_emission_blurring_pathtermination_ao;
+	delete kernel_direct_lighting;
+	delete kernel_shadow_blocked;
+	delete kernel_next_iteration_setup;
+	delete kernel_sum_all_radiance;
 }
 
 bool DeviceSplitKernel::load_kernels(const DeviceRequestedFeatures& requested_features)
 {
 #define LOAD_KERNEL(name) \
-		kernel_##name = unique_ptr<SplitKernelFunction>(device->get_split_kernel_function(#name, requested_features)); \
+		kernel_##name = device->get_split_kernel_function(#name, requested_features); \
 		if(!kernel_##name) { \
 			return false; \
 		}
diff --git a/intern/cycles/device/device_split_kernel.h b/intern/cycles/device/device_split_kernel.h
index 619702c..78bbfc7 100644
--- a/intern/cycles/device/device_split_kernel.h
+++ b/intern/cycles/device/device_split_kernel.h
@@ -19,7 +19,6 @@
 
 #include "device.h"
 #include "buffers.h"
-#include "util_memory.h"
 
 CCL_NAMESPACE_BEGIN
 
@@ -41,16 +40,16 @@ class DeviceSplitKernel {
 private:
 	Device *device;
 
-	unique_ptr<SplitKernelFunction> kernel_scene_intersect;
-	unique_ptr<SplitKernelFunction> kernel_lamp_emission;
-	unique_ptr<SplitKernelFunction> kernel_queue_enqueue;
-	unique_ptr<SplitKernelFunction> kernel_background_buffer_update;
-	unique_ptr<SplitKernelFunction> kernel_shader_eval;
-	unique_ptr<SplitKernelFunction> kernel_holdout_emission_blurring_pathtermination_ao;
-	unique_ptr<SplitKernelFunction> kernel_direct_lighting;
-	unique_ptr<SplitKernelFunction> kernel_shadow_blocked;
-	unique_ptr<SplitKernelFunction> kernel_next_iteration_setup;
-	unique_ptr<SplitKernelFunction> kernel_sum_all_radiance;
+	SplitKernelFunction *kernel_scene_intersect;
+	SplitKernelFunction *kernel_lamp_emission;
+	SplitKernelFunction *kernel_queue_enqueue;
+	SplitKernelFunction *kernel_background_buffer_update;
+	SplitKernelFunction *kernel_shader_eval;
+	SplitKernelFunction *kernel_holdout_emission_blurring_pathtermination_ao;
+	SplitKernelFunction *kernel_direct_lighting;
+	SplitKernelFunction *kernel_shadow_blocked;
+	SplitKernelFunction *kernel_next_iteration_setup;
+	SplitKernelFunction *kernel_sum_all_radiance;
 
 	/* Global memory variables [porting]; These memory is used for
 	 * co-operation between different kernels; Data written by one
diff --git a/intern/cycles/util/CMakeLists.txt b/intern/cycles/util/CMakeLists.txt
index 8d7e9a7..02ee4cd 100644
--- a/intern/cycles/util/CMakeLists.txt
+++ b/intern/cycles/util/CMakeLists.txt
@@ -52,7 +52,6 @@ set(SRC_HEADERS
 	util_math_cdf.h
 	util_math_fast.h
 	util_md5.h
-	util_memory.h
 	util_opengl.h
 	util_optimization.h
 	util_param.h
diff --git a/intern/cycles/util/util_memory.h b/intern/cycles/util/util_memory.h
deleted file mode 100644
index e56e939..0000000
--- a/intern/cycles/util/util_memory.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2011-2016 Blender Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __UTIL_MEMORY_H__
-#define __UTIL_MEMORY_H__
-
-#include <memory>
-
-CCL_NAMESPACE_BEGIN
-
-using std::unique_ptr;
-
-CCL_NAMESPACE_END
-
-#endif /* __UTIL_MEMORY_H__ */
-




More information about the Bf-blender-cvs mailing list