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:
authorPatrick Mours <pmours@nvidia.com>2021-12-06 16:58:35 +0300
committerPatrick Mours <pmours@nvidia.com>2021-12-07 20:50:10 +0300
commite14f8c2dd765a5f20d652899434174daa039804b (patch)
tree3e37b27e8100a353c9dfecbe43bebb840bd3a791 /intern/cycles/device/cpu
parenta37dac0a884ff9acd36eb887e8cd36df501c337b (diff)
Cycles: Reintroduce device-only memory handling that got lost in Cycles X merge
Somehow only a part of rBf4f8b6dde32b0438e0b97a6d8ebeb89802987127 ended up in Cycles X, causing the issue that commit fixed, "OPTIX_ERROR_INVALID_VALUE" when the system is out of memory, to show up again. This adds the missing changes to fix that problem. Maniphest Tasks: T93620 Differential Revision: https://developer.blender.org/D13488
Diffstat (limited to 'intern/cycles/device/cpu')
-rw-r--r--intern/cycles/device/cpu/device_impl.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/intern/cycles/device/cpu/device_impl.cpp b/intern/cycles/device/cpu/device_impl.cpp
index 62b9cc93dae..6f3c8b42124 100644
--- a/intern/cycles/device/cpu/device_impl.cpp
+++ b/intern/cycles/device/cpu/device_impl.cpp
@@ -129,8 +129,7 @@ void CPUDevice::mem_alloc(device_memory &mem)
<< string_human_readable_size(mem.memory_size()) << ")";
}
- if (mem.type == MEM_DEVICE_ONLY) {
- assert(!mem.host_pointer);
+ if (mem.type == MEM_DEVICE_ONLY || !mem.host_pointer) {
size_t alignment = MIN_ALIGNMENT_CPU_DATA_TYPES;
void *data = util_aligned_malloc(mem.memory_size(), alignment);
mem.device_pointer = (device_ptr)data;
@@ -189,7 +188,7 @@ void CPUDevice::mem_free(device_memory &mem)
tex_free((device_texture &)mem);
}
else if (mem.device_pointer) {
- if (mem.type == MEM_DEVICE_ONLY) {
+ if (mem.type == MEM_DEVICE_ONLY || !mem.host_pointer) {
util_aligned_free((void *)mem.device_pointer);
}
mem.device_pointer = 0;