/// <summary>
        /// Returns the human readble SPIR-V representation of the shader
        /// </summary>
        public bool GetReadableSPIRV(ShaderFile shaderFile, out List <string> spirvOutput)
        {
            List <string> output = new List <string>();

            spirvOutput = output;
            string title = name;
            string msg;

            if (ReferenceCompiler.Locate() == null)
            {
                msg = "Could not locate the glslang reference compiler (glslangvalidator.exe) in system path!";
                VsShellUtilities.ShowMessageBox(ServiceProvider, msg, title, OLEMSGICON.OLEMSGICON_CRITICAL, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
                OutputWindow.Add(msg);
                return(false);
            }

            List <string> validatorOutput;
            bool          res = ReferenceCompiler.GetHumanReadableSPIRV(shaderFile.fileName, out validatorOutput);

            if (res)
            {
                spirvOutput = validatorOutput;
            }
            else
            {
                msg = string.Format(CultureInfo.CurrentCulture, "Could not get human readable SPIR-V for shader \"{0}\" ", shaderFile.fileName) + "\n";
                Debug.Write(msg);
                VsShellUtilities.ShowMessageBox(ServiceProvider, msg, title, OLEMSGICON.OLEMSGICON_CRITICAL, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
                ParseErrors(validatorOutput, shaderFile);
                msg += string.Join("\n", validatorOutput);
                OutputWindow.Add(msg);
            }

            return(res);
        }
        /// <summary>
        /// Compile the shader file using the given compilation function
        /// </summary>
        public void CompileShaders(List <ShaderFile> shaderFiles, CompileFunc compileFunc)
        {
            string title = name;
            string msg;

            if (ReferenceCompiler.Locate() == null)
            {
                msg = "Could not locate the glslang reference compiler (glslangvalidator.exe) in system path!";
                VsShellUtilities.ShowMessageBox(ServiceProvider, msg, title, OLEMSGICON.OLEMSGICON_CRITICAL, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
                OutputWindow.Add(msg);
                return;
            }

            ErrorList.Clear();

            bool success = true;

            msg = "";
            foreach (var shaderFile in shaderFiles)
            {
                List <string> validatorOutput;
                bool          compiled = compileFunc(shaderFile.fileName, out validatorOutput);
                if (compiled)
                {
                    OutputWindow.Add(string.Join("\n", validatorOutput));
                }
                else
                {
                    msg += string.Format(CultureInfo.CurrentCulture, "Shader \"{0}\" could not be compiled to SPIR-V!", shaderFile.fileName) + "\n";
                    Debug.Write(msg);
                    ParseErrors(validatorOutput, shaderFile);
                    OutputWindow.Add(shaderFile.fileName + "\n" + string.Join("\n", validatorOutput));
                    success = false;
                }
            }

            if (success)
            {
                if (shaderFiles.Count == 1)
                {
                    msg = string.Format(CultureInfo.CurrentCulture, "Shader successfully compiled to \"{0}\"", shaderFiles[0].fileName + ".spv");
                }
                else
                {
                    msg = "All shaders successfully compiled to SPIR-V";
                }
                VsShellUtilities.ShowMessageBox(ServiceProvider, msg, title, OLEMSGICON.OLEMSGICON_INFO, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
            }
            else
            {
                VsShellUtilities.ShowMessageBox(ServiceProvider, msg, title, OLEMSGICON.OLEMSGICON_CRITICAL, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
            }

            if (ErrorList.ErrorCount() > 0)
            {
                ErrorList.Show();
            }
        }