[Bf-blender-cvs] [7fdf520d993] cycles-x: Cycles X: Localize handling of sample count pass
Sergey Sharybin
noreply at git.blender.org
Tue Jun 1 10:31:54 CEST 2021
Commit: 7fdf520d9934aaf5d60bc5f6e133346254d52aa0
Author: Sergey Sharybin
Date: Tue Jun 1 10:27:57 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB7fdf520d9934aaf5d60bc5f6e133346254d52aa0
Cycles X: Localize handling of sample count pass
Avoid having an exception in a generic code path.
===================================================================
M intern/cycles/render/pass_accessor.cpp
===================================================================
diff --git a/intern/cycles/render/pass_accessor.cpp b/intern/cycles/render/pass_accessor.cpp
index 9ff8ca6ddff..c5d300b964b 100644
--- a/intern/cycles/render/pass_accessor.cpp
+++ b/intern/cycles/render/pass_accessor.cpp
@@ -29,7 +29,6 @@ class Scaler {
public:
Scaler(RenderBuffers *render_buffers,
const Pass *pass,
- const float *pass_buffer,
const int num_samples,
const float exposure)
: pass_(pass),
@@ -38,12 +37,6 @@ class Scaler {
exposure_(exposure),
sample_count_pass_(get_sample_count_pass(render_buffers))
{
- /* Special trick to only scale the samples count pass with the sample scale. Otherwise the pass
- * becomes a uniform 1.0. */
- if (sample_count_pass_ == reinterpret_cast<const uint *>(pass_buffer)) {
- sample_count_pass_ = nullptr;
- }
-
/* Pre-calculate values when adaptive sampling is not used. */
if (!sample_count_pass_) {
scale_ = pass->filter ? num_samples_inv_ : 1.0f;
@@ -191,7 +184,7 @@ bool PassAccessor::get_render_tile_pixels(RenderBuffers *render_buffers, float *
const int size = params.width * params.height;
const PassType type = pass_->type;
- const Scaler scaler(render_buffers, pass_, in, num_samples_, exposure_);
+ const Scaler scaler(render_buffers, pass_, num_samples_, exposure_);
if (num_components_ == 1 && type == PASS_RENDER_TIME) {
#if 0
@@ -226,9 +219,10 @@ bool PassAccessor::get_render_tile_pixels(RenderBuffers *render_buffers, float *
* meaningful value when adaptive sampler stopped rendering image way before the maximum
* number of samples was reached (for examples when number of samples is set to 0 in
* viewport). */
+ const float scale = 1.0f / num_samples_;
for (int i = 0; i < size; i++, in += pass_stride, pixels++) {
const float f = *in;
- pixels[0] = __float_as_uint(f) * scaler.scale(i);
+ pixels[0] = __float_as_uint(f) * scale;
}
}
else {
More information about the Bf-blender-cvs
mailing list