[Bf-blender-cvs] [1955754] master: Cycles: Cleanup: Swap order of the RNG-state-initializing for-loops

Lukas Stockner noreply at git.blender.org
Sun May 8 01:25:50 CEST 2016


Commit: 1955754934425de7a6c51fe71bf79e965035d28f
Author: Lukas Stockner
Date:   Sun May 8 01:22:28 2016 +0200
Branches: master
https://developer.blender.org/rB1955754934425de7a6c51fe71bf79e965035d28f

Cycles: Cleanup: Swap order of the RNG-state-initializing for-loops

Swap the for-loops in the RenderBuffer reset code to follow the convention
of looping over y in the outer loop.
The improved cache performance won't really be noticable here, but it's nicer
if it follows the usual style.

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

M	intern/cycles/render/buffers.cpp

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

diff --git a/intern/cycles/render/buffers.cpp b/intern/cycles/render/buffers.cpp
index fab3f70..0d62c1b 100644
--- a/intern/cycles/render/buffers.cpp
+++ b/intern/cycles/render/buffers.cpp
@@ -138,9 +138,9 @@ void RenderBuffers::reset(Device *device, BufferParams& params_)
 	uint *init_state = rng_state.resize(params.width, params.height);
 	int x, y, width = params.width, height = params.height;
 	
-	for(x = 0; x < width; x++)
-		for(y = 0; y < height; y++)
-			init_state[x + y*width] = hash_int_2d(params.full_x+x, params.full_y+y);
+	for(y = 0; y < height; y++)
+		for(x = 0; x < width; x++)
+			init_state[y*width + x] = hash_int_2d(params.full_x+x, params.full_y+y);
 
 	device->mem_alloc(rng_state, MEM_READ_WRITE);
 	device->mem_copy_to(rng_state);




More information about the Bf-blender-cvs mailing list