diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-11-05 12:05:14 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-11-05 12:05:14 +0400 |
commit | 759ea4078782ace683a3e835166b7f324c8e3224 (patch) | |
tree | 80b50138b42f89a247612c9461d467391014683d /source/blender/render/intern | |
parent | 6eec49ed20fb3a8032718d5f4b9a3e774098df3f (diff) |
Render engines: replace number of x/y tiles with tile size
Now tile size is setting up explicitly instead of using number of tiles.
This allows better control over GPU performance, where having tiles aligned
to specific size makes lots of sense.
Still to come: need to update startup.blend to make tiles size 64x64.
Diffstat (limited to 'source/blender/render/intern')
5 files changed, 12 insertions, 25 deletions
diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index 1e62ab6d14d..825fe2ff4d0 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -145,8 +145,6 @@ struct Render /* final picture width and height (within disprect) */ int rectx, recty; - /* real maximum amount of xparts/yparts after correction for minimum */ - int xparts, yparts; /* real maximum size of parts after correction for minimum * partx*xparts can be larger than rectx, in that case last part is smaller */ int partx, party; diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index 558ba8fe062..28f70211a9c 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -148,7 +148,8 @@ static Render *envmap_render_copy(Render *re, EnvMap *env) envre->r.mode &= ~(R_BORDER | R_PANORAMA | R_ORTHO | R_MBLUR); envre->r.layers.first = envre->r.layers.last = NULL; envre->r.filtertype = 0; - envre->r.xparts = envre->r.yparts = 2; + envre->r.tilex = envre->r.xsch / 2; + envre->r.tiley = envre->r.ysch / 2; envre->r.size = 100; envre->r.yasp = envre->r.xasp = 1; diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c index 2b564a09024..b2cf8db7995 100644 --- a/source/blender/render/intern/source/initrender.c +++ b/source/blender/render/intern/source/initrender.c @@ -555,31 +555,17 @@ void initparts(Render *re, int do_crop) xmaxb = re->disprect.xmax; ymaxb = re->disprect.ymax; - xparts = re->r.xparts; - yparts = re->r.yparts; - - /* minimum part size */ - if (re->r.mode & R_PANORAMA) { - if (ceil(re->rectx / (float)xparts) < 8) - xparts = 1 + re->rectx / 8; - } - else { - if (ceil(re->rectx / (float)xparts) < 64) - xparts = 1 + re->rectx / 64; - } - - if (ceil(re->recty / (float)yparts) < 64) - yparts = 1 + re->recty / 64; - /* part size */ - partx = ceil(re->rectx / (float)xparts); - party = ceil(re->recty / (float)yparts); + partx = min_ii(re->r.tilex, re->rectx); + party = min_ii(re->r.tiley, re->recty); - re->xparts = xparts; - re->yparts = yparts; re->partx = partx; re->party = party; + /* part count */ + xparts = (re->rectx + partx - 1) / partx; + yparts = (re->recty + party - 1) / party; + /* calculate rotation factor of 1 pixel */ if (re->r.mode & R_PANORAMA) re->panophi = panorama_pixel_rot(re); diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index a3fb953e7b2..7ef3aecad08 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -677,6 +677,7 @@ float panorama_pixel_rot(Render *re) { float psize, phi, xfac; float borderfac = (float)BLI_rcti_size_x(&re->disprect) / (float)re->winx; + int xparts = (re->rectx + re->partx - 1) / re->partx; /* size of 1 pixel mapped to viewplane coords */ psize = BLI_rctf_size_x(&re->viewplane) / (float)re->winx; @@ -684,7 +685,7 @@ float panorama_pixel_rot(Render *re) phi = atan(psize / re->clipsta); /* correction factor for viewplane shifting, first calculate how much the viewplane angle is */ - xfac = borderfac * BLI_rctf_size_x(&re->viewplane) / (float)re->xparts; + xfac = borderfac * BLI_rctf_size_x(&re->viewplane) / (float)xparts; xfac = atan(0.5f * xfac / re->clipsta); /* and how much the same viewplane angle is wrapped */ psize = 0.5f * phi * ((float)re->partx); diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c index 886f266b22f..7a7602dcce2 100644 --- a/source/blender/render/intern/source/renderdatabase.c +++ b/source/blender/render/intern/source/renderdatabase.c @@ -1184,6 +1184,7 @@ static int panotestclip(Render *re, int do_pano, float *v) /* to be used for halos en infos */ float abs4; short c=0; + int xparts = (re->rectx + re->partx - 1) / re->partx; if (do_pano == FALSE) { return testclip(v); @@ -1197,7 +1198,7 @@ static int panotestclip(Render *re, int do_pano, float *v) if ( v[1]>abs4) c+=4; else if ( v[1]< -abs4) c+=8; - abs4*= re->xparts; + abs4*= xparts; if ( v[0]>abs4) c+=2; else if ( v[0]< -abs4) c+=1; |