[Bf-blender-cvs] [7b3d66c6deb] cycles-x: Fix bad memory access in OIDN when sample count pass present in Cycles X

Sergey Sharybin noreply at git.blender.org
Tue Aug 31 16:20:04 CEST 2021


Commit: 7b3d66c6deb9033ac6e85d3e5b2c7016eb883226
Author: Sergey Sharybin
Date:   Tue Aug 31 16:04:37 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB7b3d66c6deb9033ac6e85d3e5b2c7016eb883226

Fix bad memory access in OIDN when sample count pass present in Cycles X

Such configuration reads combined pass into RGB array. The alpha channel
was not properly ignored in the pass accessor in this case.

Test file: F10357795

Differential Revision: https://developer.blender.org/D12358

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

M	intern/cycles/integrator/pass_accessor.cpp
M	intern/cycles/kernel/kernel_film.h

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

diff --git a/intern/cycles/integrator/pass_accessor.cpp b/intern/cycles/integrator/pass_accessor.cpp
index 60737af1871..e07b76403ee 100644
--- a/intern/cycles/integrator/pass_accessor.cpp
+++ b/intern/cycles/integrator/pass_accessor.cpp
@@ -213,8 +213,12 @@ bool PassAccessor::get_render_tile_pixels(const RenderBuffers *render_buffers,
         get_pass_float3(render_buffers, buffer_params, destination);
       }
       else if (pass_info.num_components == 4) {
-        if (type == PASS_COMBINED || type == PASS_SHADOW_CATCHER ||
-            type == PASS_SHADOW_CATCHER_MATTE) {
+        if (type == PASS_COMBINED && destination.num_components == 3) {
+          /* Special case for combined pass access ignoring alpha channel. */
+          get_pass_float3(render_buffers, buffer_params, destination);
+        }
+        else if (type == PASS_COMBINED || type == PASS_SHADOW_CATCHER ||
+                 type == PASS_SHADOW_CATCHER_MATTE) {
           /* Passes with transparency as 4th component. */
           get_pass_combined(render_buffers, buffer_params, destination);
         }
diff --git a/intern/cycles/kernel/kernel_film.h b/intern/cycles/kernel/kernel_film.h
index 61b7216850a..db963db26bb 100644
--- a/intern/cycles/kernel/kernel_film.h
+++ b/intern/cycles/kernel/kernel_film.h
@@ -294,6 +294,7 @@ ccl_device_inline void film_get_pass_pixel_float4(const KernelFilmConvert *ccl_r
   pixel[2] = color.z;
   pixel[3] = alpha;
 }
+
 ccl_device_inline void film_get_pass_pixel_combined(const KernelFilmConvert *ccl_restrict
                                                         kfilm_convert,
                                                     ccl_global const float *ccl_restrict buffer,



More information about the Bf-blender-cvs mailing list