Cleanup: Remove unused crop field from RenderResult.
The `crop` field was used by Blender Internal to do an overscan per tile and merge it back to the render result.
This commit is contained in:
parent
5c5550f7b8
commit
f3ab123e33
|
@ -150,31 +150,31 @@ static void image_buffer_rect_update(RenderJob *rj,
|
|||
}
|
||||
|
||||
/* xmin here is first subrect x coord, xmax defines subrect width */
|
||||
xmin = renrect->xmin + rr->crop;
|
||||
xmax = renrect->xmax - xmin + rr->crop;
|
||||
xmin = renrect->xmin;
|
||||
xmax = renrect->xmax - xmin;
|
||||
if (xmax < 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
ymin = renrect->ymin + rr->crop;
|
||||
ymax = renrect->ymax - ymin + rr->crop;
|
||||
ymin = renrect->ymin;
|
||||
ymax = renrect->ymax - ymin;
|
||||
if (ymax < 2) {
|
||||
return;
|
||||
}
|
||||
renrect->ymin = renrect->ymax;
|
||||
}
|
||||
else {
|
||||
xmin = ymin = rr->crop;
|
||||
xmax = rr->rectx - 2 * rr->crop;
|
||||
ymax = rr->recty - 2 * rr->crop;
|
||||
xmin = ymin = 0;
|
||||
xmax = rr->rectx;
|
||||
ymax = rr->recty;
|
||||
}
|
||||
|
||||
/* xmin ymin is in tile coords. transform to ibuf */
|
||||
rxmin = rr->tilerect.xmin + xmin;
|
||||
rxmin = rr->tilerect.xmin;
|
||||
if (rxmin >= ibuf->x) {
|
||||
return;
|
||||
}
|
||||
rymin = rr->tilerect.ymin + ymin;
|
||||
rymin = rr->tilerect.ymin;
|
||||
if (rymin >= ibuf->y) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ typedef struct RenderResult {
|
|||
|
||||
/* target image size */
|
||||
int rectx, recty;
|
||||
short crop, sample_nr;
|
||||
short sample_nr;
|
||||
|
||||
/* The following rect32, rectf and rectz buffers are for temporary storage only,
|
||||
* for RenderResult structs created in #RE_AcquireResultImage - which do not have RenderView */
|
||||
|
|
|
@ -288,7 +288,7 @@ RenderResult *RE_engine_begin_result(
|
|||
disprect.ymin = y;
|
||||
disprect.ymax = y + h;
|
||||
|
||||
result = render_result_new(re, &disprect, 0, RR_USE_MEM, layername, viewname);
|
||||
result = render_result_new(re, &disprect, RR_USE_MEM, layername, viewname);
|
||||
|
||||
/* todo: make this thread safe */
|
||||
|
||||
|
@ -846,7 +846,7 @@ int RE_engine_render(Render *re, int do_all)
|
|||
if ((type->flag & RE_USE_SAVE_BUFFERS) && (re->r.scemode & R_EXR_TILE_FILE)) {
|
||||
savebuffers = RR_USE_EXR;
|
||||
}
|
||||
re->result = render_result_new(re, &re->disprect, 0, savebuffers, RR_ALL_LAYERS, RR_ALL_VIEWS);
|
||||
re->result = render_result_new(re, &re->disprect, savebuffers, RR_ALL_LAYERS, RR_ALL_VIEWS);
|
||||
}
|
||||
BLI_rw_mutex_unlock(&re->resultmutex);
|
||||
|
||||
|
|
|
@ -905,7 +905,7 @@ static void render_result_rescale(Render *re)
|
|||
|
||||
if (src_rectf != NULL) {
|
||||
float *dst_rectf = NULL;
|
||||
re->result = render_result_new(re, &re->disprect, 0, RR_USE_MEM, RR_ALL_LAYERS, "");
|
||||
re->result = render_result_new(re, &re->disprect, RR_USE_MEM, RR_ALL_LAYERS, "");
|
||||
|
||||
if (re->result != NULL) {
|
||||
dst_rectf = RE_RenderViewGetById(re->result, 0)->rectf;
|
||||
|
@ -1162,7 +1162,7 @@ static void render_result_uncrop(Render *re)
|
|||
/* weak is: it chances disprect from border */
|
||||
render_result_disprect_to_full_resolution(re);
|
||||
|
||||
rres = render_result_new(re, &re->disprect, 0, RR_USE_MEM, RR_ALL_LAYERS, RR_ALL_VIEWS);
|
||||
rres = render_result_new(re, &re->disprect, RR_USE_MEM, RR_ALL_LAYERS, RR_ALL_VIEWS);
|
||||
rres->stamp_data = BKE_stamp_data_copy(re->result->stamp_data);
|
||||
|
||||
render_result_clone_passes(re, rres, NULL);
|
||||
|
@ -1358,7 +1358,7 @@ static void do_render_composite(Render *re)
|
|||
if ((re->r.mode & R_CROP) == 0) {
|
||||
render_result_disprect_to_full_resolution(re);
|
||||
}
|
||||
re->result = render_result_new(re, &re->disprect, 0, RR_USE_MEM, RR_ALL_LAYERS, RR_ALL_VIEWS);
|
||||
re->result = render_result_new(re, &re->disprect, RR_USE_MEM, RR_ALL_LAYERS, RR_ALL_VIEWS);
|
||||
|
||||
BLI_rw_mutex_unlock(&re->resultmutex);
|
||||
|
||||
|
|
|
@ -285,12 +285,8 @@ RenderPass *render_layer_add_pass(RenderResult *rr,
|
|||
/* will read info from Render *re to define layers */
|
||||
/* called in threads */
|
||||
/* re->winx,winy is coordinate space of entire image, partrct the part within */
|
||||
RenderResult *render_result_new(Render *re,
|
||||
rcti *partrct,
|
||||
int crop,
|
||||
int savebuffers,
|
||||
const char *layername,
|
||||
const char *viewname)
|
||||
RenderResult *render_result_new(
|
||||
Render *re, rcti *partrct, int savebuffers, const char *layername, const char *viewname)
|
||||
{
|
||||
RenderResult *rr;
|
||||
RenderLayer *rl;
|
||||
|
@ -308,9 +304,7 @@ RenderResult *render_result_new(Render *re,
|
|||
rr->rectx = rectx;
|
||||
rr->recty = recty;
|
||||
rr->renrect.xmin = 0;
|
||||
rr->renrect.xmax = rectx - 2 * crop;
|
||||
/* crop is one or two extra pixels rendered for filtering, is used for merging and display too */
|
||||
rr->crop = crop;
|
||||
rr->renrect.xmax = rectx;
|
||||
|
||||
/* tilerect is relative coordinates within render disprect. do not subtract crop yet */
|
||||
rr->tilerect.xmin = partrct->xmin - re->disprect.xmin;
|
||||
|
@ -827,20 +821,8 @@ static void do_merge_tile(
|
|||
copylen = tilex = rrpart->rectx;
|
||||
tiley = rrpart->recty;
|
||||
|
||||
if (rrpart->crop) { /* filters add pixel extra */
|
||||
tile += pixsize * (rrpart->crop + ((size_t)rrpart->crop) * tilex);
|
||||
|
||||
copylen = tilex - 2 * rrpart->crop;
|
||||
tiley -= 2 * rrpart->crop;
|
||||
|
||||
ofs = (((size_t)rrpart->tilerect.ymin) + rrpart->crop) * rr->rectx +
|
||||
(rrpart->tilerect.xmin + rrpart->crop);
|
||||
target += pixsize * ofs;
|
||||
}
|
||||
else {
|
||||
ofs = (((size_t)rrpart->tilerect.ymin) * rr->rectx + rrpart->tilerect.xmin);
|
||||
target += pixsize * ofs;
|
||||
}
|
||||
ofs = (((size_t)rrpart->tilerect.ymin) * rr->rectx + rrpart->tilerect.xmin);
|
||||
target += pixsize * ofs;
|
||||
|
||||
copylen *= sizeof(float) * pixsize;
|
||||
tilex *= pixsize;
|
||||
|
@ -1107,7 +1089,7 @@ static void save_render_result_tile(RenderResult *rr, RenderResult *rrpart, cons
|
|||
{
|
||||
RenderLayer *rlp, *rl;
|
||||
RenderPass *rpassp;
|
||||
int offs, partx, party;
|
||||
int partx, party;
|
||||
|
||||
BLI_thread_lock(LOCK_IMAGE);
|
||||
|
||||
|
@ -1120,13 +1102,6 @@ static void save_render_result_tile(RenderResult *rr, RenderResult *rrpart, cons
|
|||
continue;
|
||||
}
|
||||
|
||||
if (rrpart->crop) { /* filters add pixel extra */
|
||||
offs = (rrpart->crop + rrpart->crop * rrpart->rectx);
|
||||
}
|
||||
else {
|
||||
offs = 0;
|
||||
}
|
||||
|
||||
/* passes are allocated in sync */
|
||||
for (rpassp = rlp->passes.first; rpassp; rpassp = rpassp->next) {
|
||||
const int xstride = rpassp->channels;
|
||||
|
@ -1141,13 +1116,13 @@ static void save_render_result_tile(RenderResult *rr, RenderResult *rrpart, cons
|
|||
fullname,
|
||||
xstride,
|
||||
xstride * rrpart->rectx,
|
||||
rpassp->rect + a + xstride * offs);
|
||||
rpassp->rect + a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
party = rrpart->tilerect.ymin + rrpart->crop;
|
||||
partx = rrpart->tilerect.xmin + rrpart->crop;
|
||||
party = rrpart->tilerect.ymin;
|
||||
partx = rrpart->tilerect.xmin;
|
||||
|
||||
for (rlp = rrpart->layers.first; rlp; rlp = rlp->next) {
|
||||
rl = RE_GetRenderLayer(rr, rlp->name);
|
||||
|
@ -1267,7 +1242,7 @@ void render_result_exr_file_end(Render *re, RenderEngine *engine)
|
|||
/* Create new render result in memory instead of on disk. */
|
||||
BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
|
||||
render_result_free_list(&re->fullresult, re->result);
|
||||
re->result = render_result_new(re, &re->disprect, 0, RR_USE_MEM, RR_ALL_LAYERS, RR_ALL_VIEWS);
|
||||
re->result = render_result_new(re, &re->disprect, RR_USE_MEM, RR_ALL_LAYERS, RR_ALL_VIEWS);
|
||||
BLI_rw_mutex_unlock(&re->resultmutex);
|
||||
|
||||
LISTBASE_FOREACH (RenderLayer *, rl, &re->result->layers) {
|
||||
|
@ -1429,7 +1404,7 @@ bool render_result_exr_file_cache_read(Render *re)
|
|||
char *root = U.render_cachedir;
|
||||
|
||||
RE_FreeRenderResult(re->result);
|
||||
re->result = render_result_new(re, &re->disprect, 0, RR_USE_MEM, RR_ALL_LAYERS, RR_ALL_VIEWS);
|
||||
re->result = render_result_new(re, &re->disprect, RR_USE_MEM, RR_ALL_LAYERS, RR_ALL_VIEWS);
|
||||
|
||||
/* First try cache. */
|
||||
render_result_exr_file_cache_path(re->scene, root, str);
|
||||
|
|
|
@ -51,7 +51,6 @@ extern "C" {
|
|||
|
||||
struct RenderResult *render_result_new(struct Render *re,
|
||||
struct rcti *partrct,
|
||||
int crop,
|
||||
int savebuffers,
|
||||
const char *layername,
|
||||
const char *viewname);
|
||||
|
|
Loading…
Reference in New Issue