diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-10-13 20:13:35 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-10-15 16:42:44 +0300 |
commit | 2ba7c3aa650c3c795d903a24998204f67c75b017 (patch) | |
tree | ef80c7cadbe59d1062dd75818baad4d8ad594bcb /intern/cycles/render/light.cpp | |
parent | 70376154a0b09dc05fcc5bd79c33fdf7c6acbd9a (diff) |
Cleanup: refactor to make number of channels for shader evaluation variable
Diffstat (limited to 'intern/cycles/render/light.cpp')
-rw-r--r-- | intern/cycles/render/light.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index ae1150fc07b..400ed0802a6 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -50,6 +50,7 @@ static void shade_background_pixels(Device *device, device->const_copy_to("__data", &dscene->data, sizeof(dscene->data)); const int size = width * height; + const int num_channels = 3; pixels.resize(size); /* Evaluate shader on device. */ @@ -57,6 +58,7 @@ static void shade_background_pixels(Device *device, shader_eval.eval( SHADER_EVAL_BACKGROUND, size, + num_channels, [&](device_vector<KernelShaderEvalInput> &d_input) { /* Fill coordinates for shading. */ KernelShaderEvalInput *d_input_data = d_input.data(); @@ -77,15 +79,15 @@ static void shade_background_pixels(Device *device, return size; }, - [&](device_vector<float4> &d_output) { + [&](device_vector<float> &d_output) { /* Copy output to pixel buffer. */ - float4 *d_output_data = d_output.data(); + float *d_output_data = d_output.data(); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { - pixels[y * width + x].x = d_output_data[y * width + x].x; - pixels[y * width + x].y = d_output_data[y * width + x].y; - pixels[y * width + x].z = d_output_data[y * width + x].z; + pixels[y * width + x].x = d_output_data[(y * width + x) * num_channels + 0]; + pixels[y * width + x].y = d_output_data[(y * width + x) * num_channels + 1]; + pixels[y * width + x].z = d_output_data[(y * width + x) * num_channels + 2]; } } }); |