Improvement: check if the OS and the GPU are supported by the application

This commit is contained in:
Laurent Clouet
2014-12-17 21:47:31 +00:00
parent b4d64bb754
commit ea7997c625
4 changed files with 37 additions and 1 deletions

View File

@@ -93,6 +93,16 @@ public class Client {
}
public int run() {
if (this.config.checkOSisSupported() == false) {
this.gui.error(Error.humanString(Error.Type.OS_NOT_SUPPORTED));
return -3;
}
if (this.config.checkCPUisSUpported() == false) {
this.gui.error(Error.humanString(Error.Type.CPU_NOT_SUPPORTED));
return -4;
}
int step;
try {
step = this.log.newCheckPoint();

View File

@@ -29,7 +29,9 @@ import java.util.Calendar;
import java.util.LinkedList;
import java.util.List;
import com.sheepit.client.hardware.cpu.CPU;
import com.sheepit.client.hardware.gpu.GPUDevice;
import com.sheepit.client.os.OS;
public class Configuration {
public enum ComputeType {
@@ -277,4 +279,17 @@ public class Configuration {
return "";
}
}
public boolean checkOSisSupported() {
return OS.getOS() != null;
}
public boolean checkCPUisSUpported() {
OS os = OS.getOS();
if (os != null) {
CPU cpu = os.getCPU();
return cpu != null && cpu.haveData();
}
return false;
}
}

View File

@@ -35,6 +35,8 @@ public class Error {
RENDERER_KILLED,
RENDERER_MISSING_LIBRARIES,
FAILED_TO_EXECUTE,
OS_NOT_SUPPORTED,
CPU_NOT_SUPPORTED,
UNKNOWN
};
@@ -127,6 +129,10 @@ public class Error {
return "The renderer stopped because either you asked to stop or the server did (usually for a render time too high).";
case SESSION_DISABLED:
return "The server have disabled your session. Your client may have generated a broken frame (GPU not compatible, not enough RAM/VRAM, etc).";
case OS_NOT_SUPPORTED:
return "Operating System not supported.";
case CPU_NOT_SUPPORTED:
return "CPU not supported.";
default:
return in.toString();
}

View File

@@ -77,7 +77,12 @@ public class CPU {
this.arch = "64bit";
}
else {
this.arch = "xxbit";
this.arch = null;
}
}
public boolean haveData() {
return this.name != null && this.model != null && this.family != null && this.arch != null;
}
}