Skip to content

Commit

Permalink
Set skip render default value explicitly due to Thrift quirk. (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulthomson authored Oct 18, 2018
1 parent 2134852 commit e5822cd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ public ImageJobResult getImage(ImageJob imageJob)
// For running shaders locally, we write the necessary files to a temp directory,
// run the get_image tool, and then collect the results in an ImageJobResult.

// Due to strange Thrift behaviour, we set this default value explicitly
// otherwise "isSetSkipRender()" is false.
if (!imageJob.isSetSkipRender()) {
imageJob.setSkipRender(false);
}

File localTempShaderJobFile =
new File(
tempDir,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,17 @@ public ImageJobResult getImage(ImageJob imageJob) throws ShaderDispatchException

LOGGER.info("Get image (via server) job: {}", imageJob.getName());

// Due to strange Thrift behaviour, we set this default value explicitly
// otherwise "isSetSkipRender()" is false.
if (!imageJob.isSetSkipRender()) {
imageJob.setSkipRender(false);
}

// Optimisation: no need to actually use HTTP if we are on the server.
if (fuzzerServiceManager != null) {
try {
return getImageHelper(imageJob, fuzzerServiceManager);
} catch (IOException | TException exception) {
} catch (TException exception) {
throw new ShaderDispatchException(exception);
}
} else {
Expand All @@ -95,7 +101,7 @@ public ImageJobResult getImage(ImageJob imageJob) throws ShaderDispatchException

private ImageJobResult getImageHelper(
ImageJob imageJob,
FuzzerServiceManager.Iface fuzzerServiceManagerProxy) throws IOException, TException {
FuzzerServiceManager.Iface fuzzerServiceManagerProxy) throws TException {

final Job job = new Job()
.setJobId(jobCounter.incrementAndGet())
Expand Down

0 comments on commit e5822cd

Please sign in to comment.