Where does tile size get initialized to a value?

Hi there, I’m trying to trace where tile size for a render gets initialized in Blender. In BlenderSession::create_session(), the tile size for the current session gets set from some value in BlenderSync, and the tile_x and tile_y values seem to originate from the RenderEngine struct, but it’s unclear where they get set. Anyone have any pointers on where/how they get set? Thanks in advance.

Well, you can set title size manually in settings.

1 Like

I’m sorry, I should be more clear. Where in Blender’s source does it get initialized? In a blank scene, the default for CYCLES is 64, where does that value get set initially?

Conversion code from Blender to Cycles lives here:


The tile information specifically is synced here:


Hi there, thanks for this, I did find this, but it didn’t occur to me to suss out how:

get_int(cscene, “debug_tile_size”);

is resolved, so I’ll take a look. The thing is, cscene resolves eventually to be a type in RNA_blender_cpp.h, but I don’t see in that file where the tile size is initialized to 64. My goal is to change that default so the user sees a different value in the UI.

Also, it looks like that line isn’t the one hit when doing a cycles render, the entire block is like this:

---- SNIP ----
if (!is_cpu && !background) {
/* currently GPU could be much slower than CPU when using tiles,
* still need to be investigated, but meanwhile make it possible
* to work in viewport smoothly
int debug_tile_size = get_int(cscene, “debug_tile_size”);

params.tile_size = make_int2(debug_tile_size, debug_tile_size);

else {
int tile_x = b_engine.tile_x();
int tile_y = b_engine.tile_y();

params.tile_size = make_int2(tile_x, tile_y);

---- SNIP ----

The ‘else’ block is what gets hit, and that isn’t using cscene.

Yah, the line I linked to was the start of the section for you to read. Good you managed to comb through it. I hope it was a useful experience (:

This bit is in the function get_session_params. Look through the code where this is used and figure out what this b_engine is…

Further know that part of the UI is done in Python, like here


Thanks for that! It looks like the tile_x and tile_y properties are somewhere other than the cycles part of …\intern\cycles\blender\addon\properties.py, which is a little confusing to me. I can see the tile order in there, and can change that it looks like and it does affect the UI. The ‘Tiles X’ and ‘Y’ properties though don’t seem to be on there, which is odd. The ui.py file does have the UI widgets, and it looks like it’s reading it from the render module, but changing the C++ code doesn’t affect the UI, which seems to me to indicate that there’s an intermediate place changing it, something similar to properties.py, but where?

Question, where does startup.blend.c get generated?