Allow the user to configure the GPU render bucket size (#220)

* Feature: user defined render bucket size when using GPUs
This commit is contained in:
Luis Uguina
2020-05-16 18:20:38 +10:00
committed by GitHub
parent 36e32ab168
commit bd88b2e3dd
9 changed files with 255 additions and 15 deletions

View File

@@ -167,16 +167,24 @@ public class Job {
+ " pass\n"
+ "signal.signal(signal.SIGINT, hndl)\n";
if (isUseGPU() && configuration.getGPUDevice() != null && configuration.getComputeMethod() != ComputeType.CPU) {
// If using a GPU, check the proper tile size
int tileSize = configuration.getGPUDevice().getRenderbucketSize();
core_script = "sheepit_set_compute_device(\"" + configuration.getGPUDevice().getType() + "\", \"GPU\", \"" + configuration.getGPUDevice().getId() + "\")\n";
core_script += String.format("bpy.context.scene.render.tile_x = %1$d\nbpy.context.scene.render.tile_y = %1$d\n",
tileSize);
log.debug(String.format("Rendering bucket size set to %1$dx%1$d pixels", tileSize));
gui.setComputeMethod("GPU");
}
else {
// Otherwise (CPU), fix the tile size to 32x32px
core_script = "sheepit_set_compute_device(\"NONE\", \"CPU\", \"CPU\")\n";
core_script += String.format("bpy.context.scene.render.tile_x = %1$d\nbpy.context.scene.render.tile_y = %1$d\n", 32);
gui.setComputeMethod("CPU");
}
core_script += ignore_signal_script;
core_script += String.format("bpy.context.scene.render.tile_x = %1$d\nbpy.context.scene.render.tile_y = %1$d\n", 32);
File script_file = null;
String command1[] = getRendererCommand().split(" ");
int size_command = command1.length + 2; // + 2 for script