Feat: Renderbucket size is now sent by the server
This commit is contained in:
@@ -60,7 +60,6 @@ import lombok.Data;
|
||||
private int priority;
|
||||
private ComputeType computeMethod;
|
||||
private GPUDevice GPUDevice;
|
||||
private int renderbucketSize;
|
||||
private boolean detectGPUs;
|
||||
private boolean printLog;
|
||||
private List<Pair<Calendar, Calendar>> requestTime;
|
||||
@@ -88,7 +87,6 @@ import lombok.Data;
|
||||
this.priority = 19; // default lowest
|
||||
this.computeMethod = null;
|
||||
this.GPUDevice = null;
|
||||
this.renderbucketSize = -1;
|
||||
this.userHasSpecifiedACacheDir = false;
|
||||
this.detectGPUs = true;
|
||||
this.workingDirectory = null;
|
||||
@@ -110,7 +108,7 @@ import lombok.Data;
|
||||
public Configuration(Configuration config) {
|
||||
this(config.configFilePath, config.workingDirectory, config.sharedDownloadsDirectory, config.storageDirectory, config.userHasSpecifiedACacheDir,
|
||||
config.static_exeDirName, config.login, config.password, config.proxy, config.maxUploadingJob, config.nbCores, config.maxAllowedMemory, config.maxRenderTime,
|
||||
config.priority, config.computeMethod, config.GPUDevice, config.renderbucketSize, config.detectGPUs, config.printLog, config.requestTime, config.shutdownTime,
|
||||
config.priority, config.computeMethod, config.GPUDevice, config.detectGPUs, config.printLog, config.requestTime, config.shutdownTime,
|
||||
config.shutdownMode, config.extras, config.autoSignIn, config.useSysTray, config.headless, config.UIType, config.hostname, config.theme);
|
||||
}
|
||||
|
||||
|
||||
@@ -209,20 +209,13 @@ import java.util.regex.Pattern;
|
||||
// This script causes the renderer to ignore Ctrl+C.
|
||||
String ignore_signal_script = "import signal\n" + "def hndl(signum, frame):\n" + " 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", CPU.MIN_RENDERBUCKET_SIZE);
|
||||
gui.setComputeMethod("CPU");
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,6 @@ public class SettingsLoader {
|
||||
CACHE_DIR("cache-dir"),
|
||||
COMPUTE_METHOD("compute-method"),
|
||||
GPU("compute-gpu"),
|
||||
RENDERBUCKET_SIZE("renderbucket-size"),
|
||||
CORES("cores"),
|
||||
CORES_BACKWARDS_COMPAT("cpu-cores"),
|
||||
RAM("ram"),
|
||||
@@ -102,7 +101,6 @@ public class SettingsLoader {
|
||||
public static final String ARG_PRIORITY = "-priority";
|
||||
public static final String ARG_TITLE = "-title";
|
||||
public static final String ARG_THEME = "-theme";
|
||||
public static final String ARG_RENDERBUCKET_SIZE = "-renderbucket-size";
|
||||
public static final String ARG_HOSTNAME = "-hostname";
|
||||
public static final String ARG_HEADLESS = "--headless";
|
||||
|
||||
@@ -117,7 +115,6 @@ public class SettingsLoader {
|
||||
private Option<String> hostname;
|
||||
private Option<String> computeMethod;
|
||||
private Option<String> gpu;
|
||||
private Option<String> renderbucketSize;
|
||||
private Option<String> cores;
|
||||
private Option<String> ram;
|
||||
private Option<String> renderTime;
|
||||
@@ -139,7 +136,7 @@ public class SettingsLoader {
|
||||
}
|
||||
|
||||
public void setSettings(String path_, String login_, String password_, String proxy_, String hostname_,
|
||||
ComputeType computeMethod_, GPUDevice gpu_, Integer renderbucketSize_, Integer cores_, Long maxRam_,
|
||||
ComputeType computeMethod_, GPUDevice gpu_, Integer cores_, Long maxRam_,
|
||||
Integer maxRenderTime_, String cacheDir_, Boolean autoSignIn_, Boolean useSysTray_, Boolean isHeadless,
|
||||
String ui_, String theme_, Integer priority_) {
|
||||
if (path_ == null) {
|
||||
@@ -160,8 +157,6 @@ public class SettingsLoader {
|
||||
priority = setValue(priority_, priority, ARG_PRIORITY);
|
||||
theme = setValue(theme_, theme, ARG_THEME);
|
||||
|
||||
renderbucketSize = setValue(renderbucketSize_.toString(), renderbucketSize, ARG_RENDERBUCKET_SIZE);
|
||||
|
||||
if (cores_ > 0) {
|
||||
cores = setValue(cores_.toString(), cores, ARG_CORES);
|
||||
}
|
||||
@@ -182,10 +177,6 @@ public class SettingsLoader {
|
||||
if (gpu_ != null) {
|
||||
gpu = setValue(gpu_.getId(), gpu, ARG_GPU);
|
||||
}
|
||||
|
||||
if (renderbucketSize_ != null && renderbucketSize_ >= GPU.MIN_RENDERBUCKET_SIZE) {
|
||||
renderbucketSize = setValue(renderbucketSize_.toString(), renderbucketSize, ARG_RENDERBUCKET_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -220,7 +211,7 @@ public class SettingsLoader {
|
||||
* @param argsList a list of the launch arguments
|
||||
*/
|
||||
public void markLaunchSettings(List<String> argsList) {
|
||||
Option options[] = { login, password, proxy, hostname, computeMethod, gpu, renderbucketSize, cores, ram, renderTime, cacheDir, autoSignIn,
|
||||
Option options[] = { login, password, proxy, hostname, computeMethod, gpu, cores, ram, renderTime, cacheDir, autoSignIn,
|
||||
useSysTray, headless, ui, theme, priority };
|
||||
|
||||
for (Option option : options) {
|
||||
@@ -275,7 +266,6 @@ public class SettingsLoader {
|
||||
setProperty(prop, configFileProp, PropertyNames.CACHE_DIR, cacheDir);
|
||||
setProperty(prop, configFileProp, PropertyNames.COMPUTE_METHOD, computeMethod);
|
||||
setProperty(prop, configFileProp, PropertyNames.GPU, gpu);
|
||||
setProperty(prop, configFileProp, PropertyNames.RENDERBUCKET_SIZE, renderbucketSize);
|
||||
setProperty(prop, configFileProp, PropertyNames.CORES, cores);
|
||||
setProperty(prop, configFileProp, PropertyNames.RAM, ram);
|
||||
setProperty(prop, configFileProp, PropertyNames.RENDER_TIME, renderTime);
|
||||
@@ -362,8 +352,6 @@ public class SettingsLoader {
|
||||
|
||||
gpu = loadConfigOption(prop, PropertyNames.GPU, gpu, ARG_GPU);
|
||||
|
||||
renderbucketSize = loadConfigOption(prop, PropertyNames.RENDERBUCKET_SIZE, renderbucketSize, ARG_RENDERBUCKET_SIZE);
|
||||
|
||||
cores = loadConfigOption(prop, PropertyNames.CORES_BACKWARDS_COMPAT, cores, ARG_CORES);
|
||||
|
||||
cores = loadConfigOption(prop, PropertyNames.CORES, cores, ARG_CORES);
|
||||
@@ -482,43 +470,12 @@ public class SettingsLoader {
|
||||
GPUDevice device = GPU.getGPUDevice(gpu.getValue());
|
||||
if (device != null) {
|
||||
config.setGPUDevice(device);
|
||||
|
||||
// If the user has indicated a render bucket size at least 32x32 px, overwrite the config file value
|
||||
if (config.getRenderbucketSize() >= GPU.MIN_RENDERBUCKET_SIZE) {
|
||||
config.getGPUDevice().setRenderbucketSize(config.getRenderbucketSize()); // Update size
|
||||
}
|
||||
else {
|
||||
// If the configuration file does have any value
|
||||
if (renderbucketSize != null) {
|
||||
config.getGPUDevice().setRenderbucketSize(Integer.valueOf(renderbucketSize.getValue()));
|
||||
}
|
||||
else {
|
||||
// Don't do anything here as the GPU get's a default value when it's initialised
|
||||
// The configuration will take the default GPU value
|
||||
}
|
||||
}
|
||||
|
||||
// And now update the client configuration with the new value
|
||||
config.setRenderbucketSize(config.getGPUDevice().getRenderbucketSize());
|
||||
}
|
||||
else if (config.getUIType() != null && (config.getUIType().equals(GuiText.type) || config.getUIType().equals(GuiTextOneLine.type))) {
|
||||
System.err.println("SettingsLoader::merge could not find specified GPU");
|
||||
System.exit(2);
|
||||
}
|
||||
}
|
||||
else if (config.getGPUDevice() != null) {
|
||||
// The order of conditions is important to ensure the priority or app arguments, then the config file and finally the recommended size (if none
|
||||
// specified or already in config file).
|
||||
if (config.getRenderbucketSize() >= GPU.MIN_RENDERBUCKET_SIZE) {
|
||||
config.getGPUDevice().setRenderbucketSize(config.getRenderbucketSize());
|
||||
}
|
||||
else if (renderbucketSize != null) {
|
||||
config.getGPUDevice().setRenderbucketSize(Integer.parseInt(renderbucketSize.getValue()));
|
||||
}
|
||||
else {
|
||||
config.getGPUDevice().setRenderbucketSize(config.getGPUDevice().getRecommendedBucketSize());
|
||||
}
|
||||
}
|
||||
|
||||
if (config.getNbCores() == -1 && cores != null) {
|
||||
config.setNbCores(Integer.parseInt(cores.getValue()));
|
||||
@@ -568,7 +525,6 @@ public class SettingsLoader {
|
||||
this.hostname = null;
|
||||
this.computeMethod = null;
|
||||
this.gpu = null;
|
||||
this.renderbucketSize = null;
|
||||
this.cacheDir = null;
|
||||
this.autoSignIn = null;
|
||||
this.useSysTray = new Option<>(String.valueOf(defaultConfigValues.isUseSysTray()), ARG_NO_SYSTRAY);
|
||||
@@ -585,7 +541,7 @@ public class SettingsLoader {
|
||||
|
||||
@Override public String toString() {
|
||||
return String.format(
|
||||
"SettingsLoader [path=%s, login=%s, password=%s, computeMethod=%s, gpu=%s, renderbucket-size=%s, cacheDir=%s, theme=%s, priority=%d, autosign=%s, usetray=%s, headless=%s]",
|
||||
path, login, password, computeMethod, gpu, renderbucketSize, cacheDir, theme, priority, autoSignIn, useSysTray, headless);
|
||||
"SettingsLoader [path=%s, login=%s, password=%s, computeMethod=%s, gpu=%s, cacheDir=%s, theme=%s, priority=%d, autosign=%s, usetray=%s, headless=%s]",
|
||||
path, login, password, computeMethod, gpu, cacheDir, theme, priority, autoSignIn, useSysTray, headless);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
package com.sheepit.client.hardware.cpu;
|
||||
|
||||
public class CPU {
|
||||
public static final int MIN_RENDERBUCKET_SIZE = 32;
|
||||
public static final int MIN_CORES = Runtime.getRuntime().availableProcessors() > 1 ? 2 : 1;
|
||||
private String name;
|
||||
private String model;
|
||||
|
||||
@@ -29,7 +29,6 @@ import com.sheepit.client.os.OS;
|
||||
import com.sheepit.client.os.Windows;
|
||||
|
||||
public class GPU {
|
||||
final public static int MIN_RENDERBUCKET_SIZE = 32;
|
||||
public static List<GPUDevice> devices = null;
|
||||
|
||||
public static boolean generate() {
|
||||
|
||||
@@ -26,7 +26,6 @@ public class GPUDevice {
|
||||
private String type;
|
||||
private String model;
|
||||
private long memory; // in B
|
||||
private int renderBucketSize;
|
||||
|
||||
private String id;
|
||||
|
||||
@@ -37,7 +36,6 @@ public class GPUDevice {
|
||||
this.model = model;
|
||||
this.memory = ram;
|
||||
this.id = id;
|
||||
this.renderBucketSize = GPU.MIN_RENDERBUCKET_SIZE;
|
||||
}
|
||||
|
||||
public GPUDevice(String type, String model, long ram, String id, String oldId) {
|
||||
@@ -85,51 +83,7 @@ public class GPUDevice {
|
||||
this.oldId = id;
|
||||
}
|
||||
|
||||
public int getRenderbucketSize() {
|
||||
return this.renderBucketSize;
|
||||
}
|
||||
|
||||
public int getRecommendedBucketSize() {
|
||||
this.setRenderbucketSize(null);
|
||||
return this.renderBucketSize;
|
||||
}
|
||||
|
||||
public void setRenderbucketSize(Integer proposedRenderbucketSize) {
|
||||
GPULister gpu;
|
||||
|
||||
if (type.equals("CUDA")) {
|
||||
gpu = new Nvidia();
|
||||
}
|
||||
else if (type.equals("OPENCL")) {
|
||||
gpu = new OpenCL();
|
||||
}
|
||||
else {
|
||||
// If execution takes this branch is because we weren't able to detect the proper GPU technology or
|
||||
// because is a new one (different from CUDA and OPENCL). In that case, move into the safest position
|
||||
// of 32x32 pixel tile sizes
|
||||
System.out.println("GPUDevice::setRenderbucketSize Unable to detect GPU technology. Render bucket size set to 32x32 pixels");
|
||||
this.renderBucketSize = GPU.MIN_RENDERBUCKET_SIZE;
|
||||
return;
|
||||
}
|
||||
|
||||
int renderBucketSize = GPU.MIN_RENDERBUCKET_SIZE;
|
||||
|
||||
if (proposedRenderbucketSize == null) {
|
||||
renderBucketSize = gpu.getRecommendedRenderBucketSize(getMemory());
|
||||
}
|
||||
else if (proposedRenderbucketSize >= GPU.MIN_RENDERBUCKET_SIZE) {
|
||||
if (proposedRenderbucketSize <= gpu.getMaximumRenderBucketSize(getMemory())) {
|
||||
renderBucketSize = proposedRenderbucketSize;
|
||||
}
|
||||
else {
|
||||
renderBucketSize = gpu.getRecommendedRenderBucketSize(getMemory());
|
||||
}
|
||||
}
|
||||
|
||||
this.renderBucketSize = renderBucketSize;
|
||||
}
|
||||
|
||||
@Override public String toString() {
|
||||
return "GPUDevice [type=" + type + ", model='" + model + "', memory=" + memory + ", id=" + id + ", renderbucketSize=" + renderBucketSize + "]";
|
||||
return "GPUDevice [type=" + type + ", model='" + model + "', memory=" + memory + ", id=" + id + "]";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,4 @@ import java.util.List;
|
||||
|
||||
public interface GPULister {
|
||||
public abstract List<GPUDevice> getGpus();
|
||||
|
||||
public abstract int getRecommendedRenderBucketSize(long memory);
|
||||
|
||||
public abstract int getMaximumRenderBucketSize(long memory);
|
||||
}
|
||||
|
||||
@@ -124,13 +124,4 @@ public class Nvidia implements GPULister {
|
||||
|
||||
return devices;
|
||||
}
|
||||
|
||||
@Override public int getRecommendedRenderBucketSize(long memory) {
|
||||
// Optimal CUDA-based GPUs Renderbucket algorithm
|
||||
return (memory > 1073741824L) ? 256 : 128;
|
||||
}
|
||||
|
||||
@Override public int getMaximumRenderBucketSize(long memory) {
|
||||
return (memory > 1073741824L) ? 512 : 128;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,15 +122,6 @@ public class OpenCL implements GPULister {
|
||||
return available_devices;
|
||||
}
|
||||
|
||||
@Override public int getRecommendedRenderBucketSize(long memory) {
|
||||
// Optimal CUDA-based GPUs Renderbucket algorithm
|
||||
return (memory > 1073741824L) ? 256 : 128;
|
||||
}
|
||||
|
||||
@Override public int getMaximumRenderBucketSize(long memory) {
|
||||
return (memory > 1073741824L) ? 2048 : 128;
|
||||
}
|
||||
|
||||
private static String getInfodeviceString(OpenCLLib lib, CLDeviceId.ByReference device, int type) {
|
||||
byte name[] = new byte[256];
|
||||
|
||||
|
||||
@@ -107,8 +107,6 @@ public class Worker {
|
||||
|
||||
@Option(name = SettingsLoader.ARG_THEME, usage = "Specify the theme to use for the graphical client, default 'light', available 'light', 'dark'", required = false) private String theme = null;
|
||||
|
||||
@Option(name = SettingsLoader.ARG_RENDERBUCKET_SIZE, usage = "Set a custom GPU renderbucket size (32 for 32x32px, 64 for 64x64px, and so on). NVIDIA GPUs support a maximum renderbucket size of 512x512 pixel, while AMD GPUs support a maximum 2048x2048 pixel renderbucket size. Minimum renderbucket size is 32 pixels for all GPUs", required = false) private int renderbucketSize = -1;
|
||||
|
||||
@Option(name = SettingsLoader.ARG_HOSTNAME, usage = "Set a custom hostname name (name change will be lost when client is closed)", required = false) private String hostname = null;
|
||||
|
||||
@Option(name = SettingsLoader.ARG_HEADLESS, usage = "Mark your client manually as headless to block Eevee projects", required = false) private boolean headless = java.awt.GraphicsEnvironment.isHeadless();
|
||||
@@ -314,12 +312,6 @@ public class Worker {
|
||||
|
||||
config.setComputeMethod(compute_method);
|
||||
|
||||
// Change the default configuration if the user has specified a minimum renderbucket size of 32
|
||||
if (renderbucketSize >= GPU.MIN_RENDERBUCKET_SIZE) {
|
||||
// Send the proposed renderbucket size and check if viable
|
||||
config.setRenderbucketSize(renderbucketSize);
|
||||
}
|
||||
|
||||
if (ui_type != null) {
|
||||
config.setUIType(ui_type);
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@ public enum SwingTooltips {
|
||||
+ "GPU so your CPU takes a break, sometimes it's the other way around. The only way to always use 100% of your system \n"
|
||||
+ "is to setup 2 clients, but for that you need to use the command line to give them different configs."),
|
||||
|
||||
RENDERBUCKET_SIZE("Basically the size of the orange squares you see in blender when you render. Blender calls it tile size. Unless you know better, the default is fine."),
|
||||
|
||||
CPU_CORES("How many (logical) cores of your CPU, often called threads, Sheepit may use. This doesn't apply to GPU-jobs.\n"
|
||||
+ "(Note that GPU jobs will also use CPU cores for scene building and feeding the GPU)\n"),
|
||||
|
||||
|
||||
@@ -91,8 +91,6 @@ public class Settings implements Activity {
|
||||
private List<JCheckBoxGPU> useGPUs;
|
||||
private JCheckBox useSysTray;
|
||||
private JCheckBox headlessCheckbox;
|
||||
private JLabel renderbucketSizeLabel;
|
||||
private JSlider renderbucketSize;
|
||||
private JSlider cpuCores;
|
||||
private JSlider ram;
|
||||
private JSpinner renderTime;
|
||||
@@ -293,18 +291,6 @@ public class Settings implements Activity {
|
||||
compute_devices_panel.add(useCPU);
|
||||
|
||||
if (gpus.size() > 0) {
|
||||
renderbucketSizeLabel = new JLabel("Renderbucket size:");
|
||||
renderbucketSize = new JSlider();
|
||||
renderbucketSize.setMajorTickSpacing(1);
|
||||
renderbucketSize.setMinorTickSpacing(1);
|
||||
renderbucketSize.setPaintTicks(true);
|
||||
renderbucketSize.setSnapToTicks(true);
|
||||
renderbucketSize.setPaintLabels(true);
|
||||
renderbucketSizeLabel.setToolTipText(SwingTooltips.RENDERBUCKET_SIZE.getText());
|
||||
|
||||
renderbucketSizeLabel.setVisible(false);
|
||||
renderbucketSize.setVisible(false);
|
||||
|
||||
for (GPUDevice gpu : gpus) {
|
||||
JCheckBoxGPU gpuCheckBox = new JCheckBoxGPU(gpu);
|
||||
gpuCheckBox.setToolTipText(gpu.getId());
|
||||
@@ -312,8 +298,6 @@ public class Settings implements Activity {
|
||||
GPUDevice config_gpu = config.getGPUDevice();
|
||||
if (config_gpu != null && config_gpu.getId().equals(gpu.getId())) {
|
||||
gpuCheckBox.setSelected(gpuChecked);
|
||||
renderbucketSizeLabel.setVisible(true);
|
||||
renderbucketSize.setVisible(true);
|
||||
}
|
||||
}
|
||||
gpuCheckBox.addActionListener(new GpuChangeAction());
|
||||
@@ -324,12 +308,6 @@ public class Settings implements Activity {
|
||||
useGPUs.add(gpuCheckBox);
|
||||
}
|
||||
|
||||
// Initialisation values will apply if we are not able to detect the proper GPU technology or
|
||||
// because is a new one (different from CUDA and OPENCL). In that case, move into a safe position
|
||||
// of 32x32 pixel render bucket and a maximum of 128x128 pixel for the "unknown GPU"
|
||||
int maxRenderbucketSize = 128;
|
||||
int recommendedBucketSize = GPU.MIN_RENDERBUCKET_SIZE;
|
||||
|
||||
//When replacing gpus it can happen that the client can't find the one specified in the config anymore in which case config.getGPUDevice()
|
||||
//returns null
|
||||
if ((config.getComputeMethod() == ComputeType.GPU || config.getComputeMethod() == ComputeType.CPU_GPU) && config.getGPUDevice() != null) {
|
||||
@@ -337,33 +315,16 @@ public class Settings implements Activity {
|
||||
|
||||
if (config.getGPUDevice().getType().equals("CUDA")) {
|
||||
gpu = new Nvidia();
|
||||
maxRenderbucketSize = gpu.getMaximumRenderBucketSize(config.getGPUDevice().getMemory());
|
||||
recommendedBucketSize = gpu.getRecommendedRenderBucketSize(config.getGPUDevice().getMemory());
|
||||
}
|
||||
else if (config.getGPUDevice().getType().equals("OPENCL")) {
|
||||
gpu = new OpenCL();
|
||||
maxRenderbucketSize = gpu.getMaximumRenderBucketSize(config.getGPUDevice().getMemory());
|
||||
recommendedBucketSize = gpu.getRecommendedRenderBucketSize(config.getGPUDevice().getMemory());
|
||||
}
|
||||
}
|
||||
|
||||
buildRenderBucketSizeSlider(maxRenderbucketSize, config.getRenderbucketSize() != -1 ?
|
||||
((int) (Math.log(config.getRenderbucketSize()) / Math.log(2))) - 5 :
|
||||
((int) (Math.log(recommendedBucketSize) / Math.log(2))) - 5);
|
||||
|
||||
compute_devices_constraints.weightx = 1.0 / gpus.size();
|
||||
compute_devices_constraints.gridx = 0;
|
||||
compute_devices_constraints.gridy++;
|
||||
|
||||
gridbag.setConstraints(renderbucketSizeLabel, compute_devices_constraints);
|
||||
compute_devices_panel.add(renderbucketSizeLabel);
|
||||
|
||||
compute_devices_constraints.gridx = 1;
|
||||
compute_devices_constraints.weightx = 1.0;
|
||||
|
||||
gridbag.setConstraints(renderbucketSize, compute_devices_constraints);
|
||||
compute_devices_panel.add(new JLabel(" "), compute_devices_constraints); // Add a space between lines
|
||||
compute_devices_panel.add(renderbucketSize);
|
||||
}
|
||||
|
||||
CPU cpu = new CPU();
|
||||
@@ -601,29 +562,6 @@ public class Settings implements Activity {
|
||||
|
||||
public void resizeWindow() {}
|
||||
|
||||
private void buildRenderBucketSizeSlider(int maxRenderbucketSize, int selectedBucketSize) {
|
||||
Hashtable<Integer, JLabel> renderbucketSizeTable = new Hashtable<Integer, JLabel>();
|
||||
|
||||
// We "take logs" to calculate the exponent to fill the slider. The logarithm, or log, of a number reflects
|
||||
// what power you need to raise a certain base to in order to get that number. In this case, as we are
|
||||
// offering increments of 2^n, the formula will be:
|
||||
//
|
||||
// log(tile size in px)
|
||||
// exponent = --------------------
|
||||
// log(2)
|
||||
//
|
||||
int steps = (int) (Math.log(maxRenderbucketSize) / Math.log(2));
|
||||
|
||||
for (int i = 5; i <= steps; i++) {
|
||||
renderbucketSizeTable.put((i - 5), new JLabel(String.format("%.0f", Math.pow(2, i))));
|
||||
}
|
||||
|
||||
renderbucketSize.setMinimum(0);
|
||||
renderbucketSize.setMaximum(renderbucketSizeTable.size() - 1);
|
||||
renderbucketSize.setLabelTable(renderbucketSizeTable);
|
||||
renderbucketSize.setValue(selectedBucketSize);
|
||||
}
|
||||
|
||||
public boolean checkDisplaySaveButton() {
|
||||
boolean selected = useCPU.isSelected();
|
||||
for (JCheckBoxGPU box : useGPUs) {
|
||||
@@ -681,9 +619,6 @@ public class Settings implements Activity {
|
||||
class GpuChangeAction implements ActionListener {
|
||||
|
||||
@Override public void actionPerformed(ActionEvent e) {
|
||||
renderbucketSizeLabel.setVisible(false);
|
||||
renderbucketSize.setVisible(false);
|
||||
|
||||
int counter = 0;
|
||||
for (JCheckBox box : useGPUs) {
|
||||
if (!box.isSelected()) {
|
||||
@@ -691,24 +626,12 @@ public class Settings implements Activity {
|
||||
}
|
||||
else {
|
||||
GPULister gpu;
|
||||
int maxRenderbucketSize = 128; // Max default render bucket size
|
||||
int recommendedBucketSize = GPU.MIN_RENDERBUCKET_SIZE; // Default recommended render bucket size
|
||||
|
||||
if (useGPUs.get(counter).getGPUDevice().getType().equals("CUDA")) {
|
||||
gpu = new Nvidia();
|
||||
maxRenderbucketSize = gpu.getMaximumRenderBucketSize(useGPUs.get(counter).getGPUDevice().getMemory());
|
||||
recommendedBucketSize = gpu.getRecommendedRenderBucketSize(useGPUs.get(counter).getGPUDevice().getMemory());
|
||||
}
|
||||
else if (useGPUs.get(counter).getGPUDevice().getType().equals("OPENCL")) {
|
||||
gpu = new OpenCL();
|
||||
maxRenderbucketSize = gpu.getMaximumRenderBucketSize(useGPUs.get(counter).getGPUDevice().getMemory());
|
||||
recommendedBucketSize = gpu.getRecommendedRenderBucketSize(useGPUs.get(counter).getGPUDevice().getMemory());
|
||||
}
|
||||
|
||||
buildRenderBucketSizeSlider(maxRenderbucketSize, ((int) (Math.log(recommendedBucketSize) / Math.log(2))) - 5);
|
||||
|
||||
renderbucketSizeLabel.setVisible(true);
|
||||
renderbucketSize.setVisible(true);
|
||||
}
|
||||
|
||||
// Simulate a radio button behavior with check buttons while only 1 GPU
|
||||
@@ -777,12 +700,6 @@ public class Settings implements Activity {
|
||||
config.setGPUDevice(selected_gpu);
|
||||
}
|
||||
|
||||
int renderbucket_size = -1;
|
||||
if (renderbucketSize != null) {
|
||||
renderbucket_size = (int) Math.pow(2, (renderbucketSize.getValue() + 5));
|
||||
}
|
||||
config.setRenderbucketSize(renderbucket_size);
|
||||
|
||||
int cpu_cores = -1;
|
||||
if (cpuCores != null) {
|
||||
cpu_cores = cpuCores.getValue();
|
||||
@@ -851,7 +768,7 @@ public class Settings implements Activity {
|
||||
if (saveFile.isSelected()) {
|
||||
parent.getSettingsLoader()
|
||||
.setSettings(config.getConfigFilePath(), login.getText(), new String(password.getPassword()), proxyText, hostnameText, method,
|
||||
selected_gpu, renderbucket_size, cpu_cores, max_ram, max_rendertime, getCachePath(config), autoSignIn.isSelected(), useSysTray.isSelected(),
|
||||
selected_gpu, cpu_cores, max_ram, max_rendertime, getCachePath(config), autoSignIn.isSelected(), useSysTray.isSelected(),
|
||||
headlessCheckbox.isSelected(), GuiSwing.type, themeOptionsGroup.getSelection().getActionCommand(), config.getPriority());
|
||||
|
||||
// wait for successful authentication (to store the public key)
|
||||
|
||||
Reference in New Issue
Block a user