Commit: 50fb0899ba650f438fe1262bc479b5e8754a2332
Author: Lukas Stockner
Date:   Sun Jul 24 02:04:08 2016 +0200
Branches: soc-2016-cycles_denoising
https://developer.blender.org/rB50fb0899ba650f438fe1262bc479b5e8754a2332

Cycles: Add temporary debugging environment variable, fix debug file extensions

As explained previously, CPUs currently get the out-of-tile pixels for denoising
from neighbor tiles, while GPUs just render bigger tiles internally.
However, implementation differences can make the GPU version (aka "overscan" 
rendering)
fail while the CPU code works.

Therefore, this commit adds a environment variable check for whether 
CPU_OVERSCAN is defined,
and enables the already-present CPU single-tile overscan mode for easier 
debugging.
Note that this has no benefits at all for regular use and will be removed later!

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

M       intern/cycles/blender/blender_session.cpp
M       intern/cycles/device/device_cpu.cpp
M       intern/cycles/render/session.cpp

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

diff --git a/intern/cycles/blender/blender_session.cpp 
b/intern/cycles/blender/blender_session.cpp
index 3be184d..8aa1975 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -448,7 +448,7 @@ void BlenderSession::render()
 
                buffer_params.passes = passes;
                buffer_params.denoising_passes = 
b_layer_iter->keep_denoise_data() || b_layer_iter->denoise_result();
-               session->tile_manager.schedule_denoising = 
b_layer_iter->denoise_result() && is_cpu;
+               session->tile_manager.schedule_denoising = 
(b_layer_iter->denoise_result() && is_cpu) && !getenv("CPU_OVERSCAN");
                session->params.denoise_result = b_layer_iter->denoise_result();
                scene->film->denoising_passes = buffer_params.denoising_passes;
                scene->film->denoise_flags = 0;
diff --git a/intern/cycles/device/device_cpu.cpp 
b/intern/cycles/device/device_cpu.cpp
index 5749f75..e03ccfe 100644
--- a/intern/cycles/device/device_cpu.cpp
+++ b/intern/cycles/device/device_cpu.cpp
@@ -315,6 +315,22 @@ public:
                                                }
                                        }
 
+#ifdef WITH_CYCLES_DEBUG_FILTER
+#define WRITE_DEBUG(name, var) 
debug_write_pfm(string_printf("debug_%dx%d_%s.pfm", tile.x, tile.y, 
name).c_str(), &storages[0].var, tile.buffers->params.final_width, 
tile.buffers->params.final_height, sizeof(FilterStorage)/sizeof(float), 
tile.buffers->params.final_width);
+                                       for(int i = 0; i < DENOISE_FEATURES; 
i++) {
+                                               
WRITE_DEBUG(string_printf("mean_%d", i).c_str(), means[i]);
+                                               
WRITE_DEBUG(string_printf("scale_%d", i).c_str(), scales[i]);
+                                               
WRITE_DEBUG(string_printf("singular_%d", i).c_str(), singular[i]);
+                                               
WRITE_DEBUG(string_printf("bandwidth_%d", i).c_str(), bandwidth[i]);
+                                       }
+                                       WRITE_DEBUG("singular_threshold", 
singular_threshold);
+                                       WRITE_DEBUG("feature_matrix_norm", 
feature_matrix_norm);
+                                       WRITE_DEBUG("global_bandwidth", 
global_bandwidth);
+                                       
WRITE_DEBUG("filtered_global_bandwidth", filtered_global_bandwidth);
+                                       WRITE_DEBUG("sum_weight", sum_weight);
+                                       WRITE_DEBUG("log_rmse_per_sample", 
log_rmse_per_sample);
+#undef WRITE_DEBUG
+#endif
                                        delete[] storages;
                                }
                        }
@@ -349,18 +365,17 @@ public:
 #ifdef WITH_CYCLES_DEBUG_FILTER
 #define WRITE_DEBUG(name, var) 
debug_write_pfm(string_printf("debug_%dx%d_%s.pfm", tile.x, tile.y, 
name).c_str(), &storages[0].var, tile.w, tile.h, 
sizeof(FilterStorage)/sizeof(float), tile.w);
                                for(int i = 0; i < DENOISE_FEATURES; i++) {
-                                       
WRITE_DEBUG(string_printf("mean_%d.pfm", i).c_str(), means[i]);
-                                       
WRITE_DEBUG(string_printf("scale_%d.pfm", i).c_str(), scales[i]);
-                                       
WRITE_DEBUG(string_printf("singular_%d.pfm", i).c_str(), singular[i]);
-                                       
WRITE_DEBUG(string_printf("bandwidth_%d.pfm", i).c_str(), bandwidth[i]);
+                                       WRITE_DEBUG(string_printf("mean_%d", 
i).c_str(), means[i]);
+                                       WRITE_DEBUG(string_printf("scale_%d", 
i).c_str(), scales[i]);
+                                       
WRITE_DEBUG(string_printf("singular_%d", i).c_str(), singular[i]);
+                                       
WRITE_DEBUG(string_printf("bandwidth_%d", i).c_str(), bandwidth[i]);
                                }
                                WRITE_DEBUG("singular_threshold", 
singular_threshold);
-                               WRITE_DEBUG("singular_threshold.pfm", 
singular_threshold);
-                               WRITE_DEBUG("feature_matrix_norm.pfm", 
feature_matrix_norm);
-                               WRITE_DEBUG("global_bandwidth.pfm", 
global_bandwidth);
-                               WRITE_DEBUG("filtered_global_bandwidth.pfm", 
filtered_global_bandwidth);
-                               WRITE_DEBUG("sum_weight.pfm", sum_weight);
-                               WRITE_DEBUG("log_rmse_per_sample.pfm", 
log_rmse_per_sample);
+                               WRITE_DEBUG("feature_matrix_norm", 
feature_matrix_norm);
+                               WRITE_DEBUG("global_bandwidth", 
global_bandwidth);
+                               WRITE_DEBUG("filtered_global_bandwidth", 
filtered_global_bandwidth);
+                               WRITE_DEBUG("sum_weight", sum_weight);
+                               WRITE_DEBUG("log_rmse_per_sample", 
log_rmse_per_sample);
 #undef WRITE_DEBUG
 #endif
                                delete[] storages;
diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp
index 401e35e..f266815 100644
--- a/intern/cycles/render/session.cpp
+++ b/intern/cycles/render/session.cpp
@@ -386,7 +386,7 @@ bool Session::acquire_tile(Device *tile_device, RenderTile& 
rtile)
        rtile.task = (tile->state == Tile::DENOISE)? RenderTile::DENOISE: 
RenderTile::PATH_TRACE;
 
        int overscan = 0;
-       const bool is_gpu = params.device.type == DEVICE_CUDA || 
params.device.type == DEVICE_OPENCL;
+       const bool is_gpu = params.device.type == DEVICE_CUDA || 
params.device.type == DEVICE_OPENCL || getenv("CPU_OVERSCAN");
        if(params.denoise_result && is_gpu) {
                overscan = scene->integrator->half_window;
                rtile.x -= overscan;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to