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:
authorMai Lavelle <mai.lavelle@gmail.com>2017-08-09 11:24:26 +0300
committerMai Lavelle <mai.lavelle@gmail.com>2017-08-09 11:27:39 +0300
commit55d28e604e7cd8bcac0ebb8dc8e27e07b58862a3 (patch)
treee2b07ae53622cbd362def2ce1aada43835b1cbcf
parent06bf34227be1aeb27662395b6bfb76f12213e3be (diff)
Cycles: Proper fix for recent OpenCL image crash
Problem was that some code checks to see if device_pointer is null or not and the new allocator wasn't even setting the pointer to anything as it tracks memory location separately. Setting the pointer to non null keeps all users of device_pointer happy.
-rw-r--r--intern/cycles/device/opencl/opencl_base.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/intern/cycles/device/opencl/opencl_base.cpp b/intern/cycles/device/opencl/opencl_base.cpp
index aa22086be29..7bdf81462b8 100644
--- a/intern/cycles/device/opencl/opencl_base.cpp
+++ b/intern/cycles/device/opencl/opencl_base.cpp
@@ -519,20 +519,26 @@ void OpenCLDeviceBase::tex_alloc(const char *name,
<< string_human_readable_size(mem.memory_size()) << ")";
memory_manager.alloc(name, mem);
+ /* Set the pointer to non-null to keep code that inspects its value from thinking its unallocated. */
+ mem.device_pointer = 1;
textures[name] = Texture(&mem, interpolation, extension);
textures_need_update = true;
}
void OpenCLDeviceBase::tex_free(device_memory& mem)
{
- if(memory_manager.free(mem)) {
- textures_need_update = true;
- }
+ if(mem.device_pointer) {
+ mem.device_pointer = 0;
- foreach(TexturesMap::value_type& value, textures) {
- if(value.second.mem == &mem) {
- textures.erase(value.first);
- break;
+ if(memory_manager.free(mem)) {
+ textures_need_update = true;
+ }
+
+ foreach(TexturesMap::value_type& value, textures) {
+ if(value.second.mem == &mem) {
+ textures.erase(value.first);
+ break;
+ }
}
}
}