public static ExecResult runSwiftshaderOnShader( ExecHelper.RedirectType redirectType, File fragmentShader, File imageOutput, boolean skipRender, int width, int height) throws IOException, InterruptedException { List<String> command = new ArrayList<>(Arrays.asList( ToolPaths.getImageEglSwiftshader(), fragmentShader.toString(), "--output", imageOutput.toString(), "--resolution", String.valueOf(width), String.valueOf(height))); if (skipRender) { command.add("--exit-linking"); } return new ExecHelper().exec( redirectType, null, false, command.toArray(new String[]{})); }
private boolean shaderIsValid( File shaderFile, boolean throwExceptionOnValidationError) throws IOException, InterruptedException { return checkValidationResult(ToolHelper.runValidatorOnShader(ExecHelper.RedirectType.TO_BUFFER, shaderFile), shaderFile.getName(), throwExceptionOnValidationError); }
? ToolHelper.runSwiftshaderOnShader( ExecHelper.RedirectType.TO_BUFFER, fragShader, imageFile, skipRender) : ToolHelper.runGenerateImageOnShader( ExecHelper.RedirectType.TO_BUFFER, fragShader,
private boolean shaderIsValidShaderTranslator( File shaderFile, ShadingLanguageVersion shadingLanguageVersion, boolean throwExceptionOnValidationError) throws IOException, InterruptedException { if (!ShaderTranslatorShadingLanguageVersionSupport.isVersionSupported(shadingLanguageVersion)) { // Shader translator does not support this shading language version, so just say that the // shader is valid. return true; } final ExecResult shaderTranslatorResult = ToolHelper.runShaderTranslatorOnShader( ExecHelper.RedirectType.TO_BUFFER, shaderFile, ShaderTranslatorShadingLanguageVersionSupport .getShaderTranslatorArgument(shadingLanguageVersion)); if (isMemoryExhaustedError(shaderTranslatorResult)) { return true; } return checkValidationResult( shaderTranslatorResult, shaderFile.getName(), throwExceptionOnValidationError); }