Cycles: Fallback to bottom-top tile order when rendering from the command line

In the worst case it'll do nothing, in the best case it might give some percent
of speedup because of better cache coherency.

Currently it's all handled as an override on blender_python level, don't really
see reason to penetrate the boolean flag further into sync code. This can always
be done later if needed.
This commit is contained in:
Sergey Sharybin 2015-02-11 01:02:36 +05:00
parent a3b7f83cb5
commit bb08502cf4
3 changed files with 14 additions and 5 deletions

View File

@ -59,7 +59,7 @@ class CyclesRender(bpy.types.RenderEngine):
None, None, None, use_osl)
else:
if not self.session:
engine.create(self, data, scene)
engine.create(self, data, scene, background=bpy.app.background)
else:
engine.reset(self, data, scene)

View File

@ -28,7 +28,7 @@ def init():
_cycles.init(path, user_path)
def create(engine, data, scene, region=None, v3d=None, rv3d=None, preview_osl=False):
def create(engine, data, scene, region=None, v3d=None, rv3d=None, preview_osl=False, background=False):
import bpy
import _cycles
@ -42,7 +42,7 @@ def create(engine, data, scene, region=None, v3d=None, rv3d=None, preview_osl=Fa
if rv3d:
rv3d = rv3d.as_pointer()
engine.session = _cycles.create(engine.as_pointer(), userpref, data, scene, region, v3d, rv3d, preview_osl)
engine.session = _cycles.create(engine.as_pointer(), userpref, data, scene, region, v3d, rv3d, preview_osl, background)
def free(engine):

View File

@ -90,10 +90,13 @@ static PyObject *init_func(PyObject *self, PyObject *args)
static PyObject *create_func(PyObject *self, PyObject *args)
{
PyObject *pyengine, *pyuserpref, *pydata, *pyscene, *pyregion, *pyv3d, *pyrv3d;
int preview_osl;
int preview_osl, background;
if(!PyArg_ParseTuple(args, "OOOOOOOi", &pyengine, &pyuserpref, &pydata, &pyscene, &pyregion, &pyv3d, &pyrv3d, &preview_osl))
if(!PyArg_ParseTuple(args, "OOOOOOOii", &pyengine, &pyuserpref, &pydata, &pyscene,
&pyregion, &pyv3d, &pyrv3d, &preview_osl, &background))
{
return NULL;
}
/* RNA */
PointerRNA engineptr;
@ -143,6 +146,12 @@ static PyObject *create_func(PyObject *self, PyObject *args)
RNA_boolean_set(&cscene, "use_progressive_refine", true);
}
/* Use more optimal tile order when rendering from the command line. */
if(background) {
PointerRNA cscene = RNA_pointer_get(&sceneptr, "cycles");
RNA_enum_set(&cscene, "tile_order", (int)TILE_BOTTOM_TO_TOP);
}
/* offline session or preview render */
session = new BlenderSession(engine, userpref, data, scene);
}