Feat: Renderbucket size is now sent by the server
This commit is contained in:
@@ -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