Allow for multi-gigapixel renders

This patch fixes a 32-bit overflow that occurs on 64-bit systems due to a numeric literal being treated as 32-bit.

This patch allows for the generation of images that occupy more than 4GB of RAM, which previously caused a crash.

Reviewers: sergey

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D2975
This commit is contained in:
Karl Semich 2018-01-15 12:53:17 +01:00 committed by Sergey Sharybin
parent 2c2203d82a
commit 75e2ae72c7
Notes: blender-bot 2023-02-14 07:08:26 +01:00
Referenced by issue #53786, Proportional Size edit box and display/useage in viewport
1 changed files with 2 additions and 2 deletions

View File

@ -1028,13 +1028,13 @@ void IMB_exr_write_channels(void *handle)
for (size_t i = 0; i < num_pixels; ++i, ++cur) {
*cur = rect[i * echan->xstride];
}
half *rect_to_write = current_rect_half + (data->height - 1) * data->width;
half *rect_to_write = current_rect_half + (data->height - 1L) * data->width;
frameBuffer.insert(echan->name, Slice(Imf::HALF, (char *)rect_to_write,
sizeof(half), -data->width * sizeof(half)));
current_rect_half += num_pixels;
}
else {
float *rect = echan->rect + echan->xstride * (data->height - 1) * data->width;
float *rect = echan->rect + echan->xstride * (data->height - 1L) * data->width;
frameBuffer.insert(echan->name, Slice(Imf::FLOAT, (char *)rect,
echan->xstride * sizeof(float), -echan->ystride * sizeof(float)));
}