Fix: -renderbucket-size value not applied to GPU render (#256)

* Fix: -renderbucket-size option not applied if configuration file doesn't exist
This commit is contained in:
Luis Uguina
2020-06-21 19:21:23 +10:00
committed by GitHub
parent f3538eafde
commit 36c14b6ee1
7 changed files with 36 additions and 11 deletions

View File

@@ -20,6 +20,7 @@
package com.sheepit.client.hardware.cpu;
public class CPU {
final public static int MIN_RENDERBUCKET_SIZE = 32;
private String name;
private String model;
private String family;

View File

@@ -29,6 +29,7 @@ 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() {

View File

@@ -37,7 +37,7 @@ public class GPUDevice {
this.model = model;
this.memory = ram;
this.id = id;
this.renderBucketSize = 32;
this.renderBucketSize = GPU.MIN_RENDERBUCKET_SIZE;
}
public GPUDevice(String type, String model, long ram, String id, String oldId) {
@@ -88,9 +88,13 @@ public class GPUDevice {
public int getRenderbucketSize() {
return this.renderBucketSize;
}
public int getRecommendedBucketSize() {
this.setRenderbucketSize(null);
return this.renderBucketSize;
}
public void setRenderbucketSize(int proposedRenderbucketSize) {
int renderBucketSize = 32;
public void setRenderbucketSize(Integer proposedRenderbucketSize) {
GPULister gpu;
if (type.equals("CUDA")) {
@@ -104,11 +108,16 @@ public class GPUDevice {
// 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 = 32;
this.renderBucketSize = GPU.MIN_RENDERBUCKET_SIZE;
return;
}
if (proposedRenderbucketSize >= 32) {
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;
}