[Bf-blender-cvs] [7d850d7] soc-2016-cycles_denoising: Cycles: Add CPU overhead dneoising as a debug option

Lukas Stockner noreply at git.blender.org
Mon Jun 20 22:51:50 CEST 2016


Commit: 7d850d790e71f0c16c0b03c8822755791e2e2fcd
Author: Lukas Stockner
Date:   Mon Jun 20 22:49:37 2016 +0200
Branches: soc-2016-cycles_denoising
https://developer.blender.org/rB7d850d790e71f0c16c0b03c8822755791e2e2fcd

Cycles: Add CPU overhead dneoising as a debug option

In order to allow easier debugging of memory-related bugs in the GPU code,
this commit adds the option to also use overscan denoising on CPUs.

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

M	intern/cycles/device/device_cpu.cpp

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

diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp
index 0ea6973..980291f 100644
--- a/intern/cycles/device/device_cpu.cpp
+++ b/intern/cycles/device/device_cpu.cpp
@@ -296,6 +296,28 @@ public:
 
 					task.update_progress(&tile);
 				}
+
+				if(tile.buffers->params.overscan) {
+					int tile_x[4] = {tile.x, tile.x, tile.x+tile.w, tile.x+tile.w};
+					int tile_y[4] = {tile.y, tile.y, tile.y+tile.h, tile.y+tile.h};
+					int offsets[9] = {0, 0, 0, 0, tile.offset, 0, 0, 0, 0};
+					int strides[9] = {0, 0, 0, 0, tile.stride, 0, 0, 0, 0};
+					float *buffers[9] = {NULL, NULL, NULL, NULL, (float*) tile.buffer, NULL, NULL, NULL, NULL};
+					FilterStorage *storages = new FilterStorage[tile.buffers->params.final_width*tile.buffers->params.final_height];
+
+					int overscan = tile.buffers->params.overscan;
+					int4 filter_rect = make_int4(tile.x + overscan, tile.y + overscan, tile.x + tile.w - overscan, tile.y + tile.h - overscan);
+					for(int y = filter_rect.y; y < filter_rect.w; y++) {
+						for(int x = filter_rect.x; x < filter_rect.z; x++) {
+							filter_estimate_params_kernel(&kg, end_sample, buffers, x, y, tile_x, tile_y, offsets, strides, storages, filter_rect);
+						}
+					}
+					for(int y = filter_rect.y; y < filter_rect.w; y++) {
+						for(int x = filter_rect.x; x < filter_rect.z; x++) {
+							filter_final_pass_kernel(&kg, end_sample, buffers, x, y, tile_x, tile_y, offsets, strides, storages, filter_rect);
+						}
+					}
+				}
 			}
 			else if(tile.task == RenderTile::DENOISE) {
 				int sample = tile.start_sample + tile.num_samples;




More information about the Bf-blender-cvs mailing list