public void SetGLSL(string sourceText, ShaderStages stage, bool debug = true) { var bytes = Veldrid.SPIRV.SpirvCompilation.CompileGlslToSpirv(sourceText, "shader.spv", stage, new GlslCompileOptions(debug)); Script.Script = ShaderScriptConverter.Convert(new ShaderReflection(Shader.Parse(bytes.SpirvBytes))); }
public void SetGLSL(string vertexSource, string fragmentSource, bool debug = true) { var vertexBytes = Veldrid.SPIRV.SpirvCompilation.CompileGlslToSpirv(vertexSource, "shader.spv", ShaderStages.Vertex, new GlslCompileOptions(debug)); var vertexReflection = new ShaderReflection(Shader.Parse(vertexBytes.SpirvBytes)); var fragmentBytes = Veldrid.SPIRV.SpirvCompilation.CompileGlslToSpirv(fragmentSource, "shader.spv", ShaderStages.Fragment, new GlslCompileOptions(debug)); var fragmentReflection = new ShaderReflection(Shader.Parse(fragmentBytes.SpirvBytes)); Script.Script = ShaderScriptConverter.Convert(vertexReflection, fragmentReflection); }
private static Script TranslateShaderViaReflection(byte[] vertexShader, byte[] fragmentShader) { var vertexInstructions = Shader.Parse(vertexShader); var vertexReflection = new ShaderReflection(vertexInstructions); var fragmentInstructions = Shader.Parse(fragmentShader); var fragmentReflection = new ShaderReflection(fragmentInstructions); return(ShaderScriptConverter.Convert(vertexReflection, fragmentReflection)); }