diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-04-27 06:54:24 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-04-27 06:54:24 +0400 |
commit | ac849f98f5262a0776f2b7df152675608b109d03 (patch) | |
tree | 5bb2ad0562a66c3d3a7c663b9dfdd63cd33c3142 /intern/cycles/render | |
parent | 2b640a2519a3d4fd822415b8be6d2efdc469b4f1 (diff) |
Fix #35102: crash with experimental cycles displacement feature due to
uninitialized memory usage.
Diffstat (limited to 'intern/cycles/render')
-rw-r--r-- | intern/cycles/render/mesh.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/render/mesh.h | 2 | ||||
-rw-r--r-- | intern/cycles/render/mesh_displace.cpp | 5 |
3 files changed, 6 insertions, 3 deletions
diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp index ddb4a1ee2cf..4a2a64bb0f3 100644 --- a/intern/cycles/render/mesh.cpp +++ b/intern/cycles/render/mesh.cpp @@ -889,7 +889,7 @@ void MeshManager::device_update(Device *device, DeviceScene *dscene, Scene *scen bool displacement_done = false; foreach(Mesh *mesh, scene->meshes) - if(mesh->need_update && displace(device, scene, mesh, progress)) + if(mesh->need_update && displace(device, dscene, scene, mesh, progress)) displacement_done = true; /* todo: properly handle cancel halfway displacement */ diff --git a/intern/cycles/render/mesh.h b/intern/cycles/render/mesh.h index 63d6b50ffca..b74c41f6453 100644 --- a/intern/cycles/render/mesh.h +++ b/intern/cycles/render/mesh.h @@ -140,7 +140,7 @@ public: MeshManager(); ~MeshManager(); - bool displace(Device *device, Scene *scene, Mesh *mesh, Progress& progress); + bool displace(Device *device, DeviceScene *dscene, Scene *scene, Mesh *mesh, Progress& progress); /* attributes */ void update_osl_attributes(Device *device, Scene *scene, vector<AttributeRequestSet>& mesh_attributes); diff --git a/intern/cycles/render/mesh_displace.cpp b/intern/cycles/render/mesh_displace.cpp index 04267697b29..f20bc73a542 100644 --- a/intern/cycles/render/mesh_displace.cpp +++ b/intern/cycles/render/mesh_displace.cpp @@ -28,7 +28,7 @@ CCL_NAMESPACE_BEGIN -bool MeshManager::displace(Device *device, Scene *scene, Mesh *mesh, Progress& progress) +bool MeshManager::displace(Device *device, DeviceScene *dscene, Scene *scene, Mesh *mesh, Progress& progress) { /* verify if we have a displacement shader */ bool has_displacement = false; @@ -106,6 +106,9 @@ bool MeshManager::displace(Device *device, Scene *scene, Mesh *mesh, Progress& p device_vector<float4> d_output; d_output.resize(d_input_size); + /* needs to be up to data for attribute access */ + device->const_copy_to("__data", &dscene->data, sizeof(dscene->data)); + device->mem_alloc(d_input, MEM_READ_ONLY); device->mem_copy_to(d_input); device->mem_alloc(d_output, MEM_WRITE_ONLY); |