From f12513a21ccef5133baa4144074a8a20db2cc5b4 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 13 Oct 2021 10:34:17 +0200 Subject: Fix Cycles backing issues when using multiple devices The pixel accessor was not aware of possible offset in the pixel padding causing some slices of the result not being properly padded. --- intern/cycles/integrator/pass_accessor.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'intern/cycles/integrator/pass_accessor.cpp') diff --git a/intern/cycles/integrator/pass_accessor.cpp b/intern/cycles/integrator/pass_accessor.cpp index 4a0b1ed6ece..4ef9ce7ef42 100644 --- a/intern/cycles/integrator/pass_accessor.cpp +++ b/intern/cycles/integrator/pass_accessor.cpp @@ -98,7 +98,10 @@ static void pad_pixels(const BufferParams &buffer_params, const size_t size = static_cast(buffer_params.width) * buffer_params.height; if (destination.pixels) { - float *pixel = destination.pixels; + const size_t pixel_stride = destination.pixel_stride ? destination.pixel_stride : + destination.num_components; + + float *pixel = destination.pixels + pixel_stride * destination.offset; for (size_t i = 0; i < size; i++, pixel += dest_num_components) { if (dest_num_components >= 3 && src_num_components == 1) { @@ -113,7 +116,7 @@ static void pad_pixels(const BufferParams &buffer_params, if (destination.pixels_half_rgba) { const half one = float_to_half(1.0f); - half4 *pixel = destination.pixels_half_rgba; + half4 *pixel = destination.pixels_half_rgba + destination.offset; for (size_t i = 0; i < size; i++, pixel++) { if (dest_num_components >= 3 && src_num_components == 1) { -- cgit v1.2.3