[Bf-blender-cvs] [9b29f00] soc-2016-cycles_images: Half Floats: Fix CUDA rendering

Sergey Sharybin noreply at git.blender.org
Thu Aug 11 12:57:22 CEST 2016


Commit: 9b29f0095c030414029aa8872769ab2a59374279
Author: Sergey Sharybin
Date:   Thu Aug 11 12:54:12 2016 +0200
Branches: soc-2016-cycles_images
https://developer.blender.org/rB9b29f0095c030414029aa8872769ab2a59374279

Half Floats: Fix CUDA rendering

The issue was not in the kernel, but in the bindless mapping instead:
it was allocating space for 4096 slots only, causing writes past the
array boundaries to begin with and making kernel unable to fetch proper
bindless texture object to end with.

Using allocations based on the slot index plus some padding to avoid
too much re-allocations now. A bit weak and maybe allocating all slots
at once is the better alternative, but should let us to work fine for
the time being.

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

M	intern/cycles/device/device_cuda.cpp

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

diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp
index 331857a..44212d9 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -748,8 +748,12 @@ public:
 				}
 
 				/* Resize once */
-				if(flat_slot >= bindless_mapping.size())
-					bindless_mapping.resize(4096); /*TODO(dingto): Make this a variable */
+				if(flat_slot >= bindless_mapping.size()) {
+					/* Allocate some slots in advance, to reduce amount
+					 * of re-allocations.
+					 */
+					bindless_mapping.resize(flat_slot + 128);
+				}
 
 				/* Set Mapping and tag that we need to (re-)upload to device */
 				bindless_mapping.get_data()[flat_slot] = (uint)tex;




More information about the Bf-blender-cvs mailing list