Cleanup: remove unused render buffers

This commit is contained in:
2019-06-18 12:36:42 +02:00
parent 8c40bbb15f
commit 96f0d22e3b
7 changed files with 12 additions and 103 deletions

View File

@@ -4135,7 +4135,6 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **r_loc
ImBuf *ibuf;
int from_render = (ima->render_slot == ima->last_render_slot);
int actview;
bool byte_buffer_in_display_space = false;
if (!(iuser && iuser->scene)) {
return NULL;
@@ -4221,16 +4220,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **r_loc
RenderPass *rpass = image_render_pass_get(rl, pass, actview, NULL);
if (rpass) {
rectf = rpass->rect;
if (pass == 0) {
if (rectf == NULL) {
/* Happens when Save Buffers is enabled.
* Use display buffer stored in the render layer.
*/
rect = (unsigned int *)rl->display_buffer;
byte_buffer_in_display_space = true;
}
}
else {
if (pass != 0) {
channels = rpass->channels;
dither = 0.0f; /* don't dither passes */
}
@@ -4261,16 +4251,8 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **r_loc
* For other cases we need to be sure it stays to default byte buffer space.
*/
if (ibuf->rect != rect) {
if (byte_buffer_in_display_space) {
const char *colorspace = IMB_colormanagement_get_display_colorspace_name(
&iuser->scene->view_settings, &iuser->scene->display_settings);
IMB_colormanagement_assign_rect_colorspace(ibuf, colorspace);
}
else {
const char *colorspace = IMB_colormanagement_role_colorspace_name_get(
COLOR_ROLE_DEFAULT_BYTE);
IMB_colormanagement_assign_rect_colorspace(ibuf, colorspace);
}
const char *colorspace = IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_DEFAULT_BYTE);
IMB_colormanagement_assign_rect_colorspace(ibuf, colorspace);
}
/* invalidate color managed buffers if render result changed */

View File

@@ -190,8 +190,7 @@ void ViewerOperation::updateImage(rcti *rect)
rect->xmin,
rect->ymin,
rect->xmax,
rect->ymax,
false);
rect->ymax);
this->updateDraw();
}

View File

@@ -248,17 +248,8 @@ static void image_buffer_rect_update(RenderJob *rj,
linear_offset_y = 0;
}
if (rr->do_exr_tile) {
/* We don't support changing color management settings during rendering
* when using Save Buffers option.
*/
view_settings = &rj->view_settings;
display_settings = &rj->display_settings;
}
else {
view_settings = &scene->view_settings;
display_settings = &scene->display_settings;
}
view_settings = &scene->view_settings;
display_settings = &scene->display_settings;
IMB_partial_display_buffer_update(ibuf,
rectf,
@@ -271,8 +262,7 @@ static void image_buffer_rect_update(RenderJob *rj,
rxmin,
rymin,
rxmin + xmax,
rymin + ymax,
rr->do_exr_tile);
rymin + ymax);
}
/* ****************************** render invoking ***************** */

View File

@@ -269,8 +269,7 @@ void IMB_partial_display_buffer_update(struct ImBuf *ibuf,
int xmin,
int ymin,
int xmax,
int ymax,
bool copy_display_to_byte_buffer);
int ymax);
void IMB_partial_display_buffer_update_threaded(
struct ImBuf *ibuf,
@@ -284,8 +283,7 @@ void IMB_partial_display_buffer_update_threaded(
int xmin,
int ymin,
int xmax,
int ymax,
bool copy_display_to_byte_buffer);
int ymax);
void IMB_partial_display_buffer_update_delayed(
struct ImBuf *ibuf, int xmin, int ymin, int xmax, int ymax);

View File

@@ -2667,8 +2667,7 @@ unsigned char *IMB_display_buffer_acquire(ImBuf *ibuf,
ibuf->invalid_rect.xmin,
ibuf->invalid_rect.ymin,
ibuf->invalid_rect.xmax,
ibuf->invalid_rect.ymax,
false);
ibuf->invalid_rect.ymax);
}
BLI_rcti_init(&ibuf->invalid_rect, 0, 0, 0, 0);
@@ -3526,7 +3525,6 @@ static void imb_partial_display_buffer_update_ex(
int ymin,
int xmax,
int ymax,
bool copy_display_to_byte_buffer,
bool do_threads)
{
ColormanageCacheViewSettings cache_view_settings;
@@ -3564,12 +3562,6 @@ static void imb_partial_display_buffer_update_ex(
BLI_thread_unlock(LOCK_COLORMANAGE);
}
if (display_buffer == NULL) {
if (copy_display_to_byte_buffer) {
display_buffer = (unsigned char *)ibuf->rect;
}
}
if (display_buffer) {
ColormanageProcessor *cm_processor = NULL;
bool skip_transform = false;
@@ -3628,15 +3620,6 @@ static void imb_partial_display_buffer_update_ex(
IMB_display_buffer_release(cache_handle);
}
if (copy_display_to_byte_buffer && (unsigned char *)ibuf->rect != display_buffer) {
int y;
for (y = ymin; y < ymax; y++) {
size_t index = (size_t)y * buffer_width * 4;
memcpy(
(unsigned char *)ibuf->rect + index, display_buffer + index, (size_t)(xmax - xmin) * 4);
}
}
}
void IMB_partial_display_buffer_update(ImBuf *ibuf,
@@ -3650,8 +3633,7 @@ void IMB_partial_display_buffer_update(ImBuf *ibuf,
int xmin,
int ymin,
int xmax,
int ymax,
bool copy_display_to_byte_buffer)
int ymax)
{
imb_partial_display_buffer_update_ex(ibuf,
linear_buffer,
@@ -3665,7 +3647,6 @@ void IMB_partial_display_buffer_update(ImBuf *ibuf,
ymin,
xmax,
ymax,
copy_display_to_byte_buffer,
false);
}
@@ -3681,8 +3662,7 @@ void IMB_partial_display_buffer_update_threaded(
int xmin,
int ymin,
int xmax,
int ymax,
bool copy_display_to_byte_buffer)
int ymax)
{
int width = xmax - xmin;
int height = ymax - ymin;
@@ -3699,7 +3679,6 @@ void IMB_partial_display_buffer_update_threaded(
ymin,
xmax,
ymax,
copy_display_to_byte_buffer,
do_threads);
}

View File

@@ -100,16 +100,6 @@ typedef struct RenderLayer {
char name[RE_MAXNAME];
int layflag, passflag, pass_xor;
/* MULTIVIEW_TODO: acolrect and scolrect are not supported by multiview at the moment.
* If they are really required they should be in RenderView instead */
/** 4 float, optional transparent buffer, needs storage for display updates */
float *acolrect;
/** 4 float, optional strand buffer, needs storage for display updates */
float *scolrect;
/** 4 char, optional color managed display buffer which is used when
* Save Buffer is enabled to display combined pass of the screen. */
int *display_buffer;
int rectx, recty;
/** Optional saved endresult on disk. */

View File

@@ -90,18 +90,6 @@ void render_result_free(RenderResult *res)
while (res->layers.first) {
RenderLayer *rl = res->layers.first;
/* acolrect and scolrect are optionally allocated in shade_tile,
* only free here since it can be used for drawing. */
if (rl->acolrect) {
MEM_freeN(rl->acolrect);
}
if (rl->scolrect) {
MEM_freeN(rl->scolrect);
}
if (rl->display_buffer) {
MEM_freeN(rl->display_buffer);
}
while (rl->passes.first) {
RenderPass *rpass = rl->passes.first;
if (rpass->rect) {
@@ -350,12 +338,6 @@ RenderResult *render_result_new(Render *re,
rl->recty = recty;
if (rr->do_exr_tile) {
rl->display_buffer = MEM_mapallocN((size_t)rectx * recty * sizeof(unsigned int),
"Combined display space rgba");
if (rl->display_buffer == NULL) {
render_result_free(rr);
return NULL;
}
rl->exrhandle = IMB_exr_get_handle();
}
@@ -470,8 +452,6 @@ RenderResult *render_result_new(Render *re,
/* duplicate code... */
if (rr->do_exr_tile) {
rl->display_buffer = MEM_mapallocN(rectx * recty * sizeof(unsigned int),
"Combined display space rgba");
rl->exrhandle = IMB_exr_get_handle();
}
@@ -1653,15 +1633,6 @@ static RenderLayer *duplicate_render_layer(RenderLayer *rl)
new_rl->next = new_rl->prev = NULL;
new_rl->passes.first = new_rl->passes.last = NULL;
new_rl->exrhandle = NULL;
if (new_rl->acolrect != NULL) {
new_rl->acolrect = MEM_dupallocN(new_rl->acolrect);
}
if (new_rl->scolrect != NULL) {
new_rl->scolrect = MEM_dupallocN(new_rl->scolrect);
}
if (new_rl->display_buffer != NULL) {
new_rl->display_buffer = MEM_dupallocN(new_rl->display_buffer);
}
for (RenderPass *rpass = rl->passes.first; rpass != NULL; rpass = rpass->next) {
RenderPass *new_rpass = duplicate_render_pass(rpass);
BLI_addtail(&new_rl->passes, new_rpass);