Skip to content
This repository has been archived by the owner on Apr 22, 2021. It is now read-only.

Commit

Permalink
Fix: -renderbucket-size option not applied if configuration file does…
Browse files Browse the repository at this point in the history
…n't exist
  • Loading branch information
luguina committed Jun 14, 2020
1 parent 324f773 commit 542c41c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
13 changes: 13 additions & 0 deletions src/com/sheepit/client/SettingsLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,19 @@ public void merge(Configuration config) {
config.setRenderbucketSize(config.getGPUDevice().getRenderbucketSize());
}
}
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() >= 32) {
config.getGPUDevice().setRenderbucketSize(config.getRenderbucketSize());
}
else if (renderbucketSize != null) {
config.getGPUDevice().setRenderbucketSize(Integer.parseInt(renderbucketSize));
}
else {
config.getGPUDevice().setRenderbucketSize(config.getGPUDevice().getRecommendedBucketSize());
}
}

if (config.getNbCores() == -1 && cores != null) {
config.setNbCores(Integer.valueOf(cores));
Expand Down
12 changes: 10 additions & 2 deletions src/com/sheepit/client/hardware/gpu/GPUDevice.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,13 @@ public void setOldId(String id) {
public int getRenderbucketSize() {
return this.renderBucketSize;
}

public int getRecommendedBucketSize() {
this.setRenderbucketSize(null);
return this.renderBucketSize;
}

public void setRenderbucketSize(int proposedRenderbucketSize) {
public void setRenderbucketSize(Integer proposedRenderbucketSize) {
int renderBucketSize = 32;
GPULister gpu;

Expand All @@ -108,7 +113,10 @@ else if (type.equals("OPENCL")) {
return;
}

if (proposedRenderbucketSize >= 32) {
if (proposedRenderbucketSize == null) {
renderBucketSize = gpu.getRecommendedRenderBucketSize(getMemory());
}
else if (proposedRenderbucketSize >= 32) {
if (proposedRenderbucketSize <= gpu.getMaximumRenderBucketSize(getMemory())) {
renderBucketSize = proposedRenderbucketSize;
}
Expand Down

0 comments on commit 542c41c

Please sign in to comment.