Ejemplo n.º 1
0
        public ShaderProgram Translate(
            out ShaderProgramInfo shaderProgramInfo,
            TranslatorContext nextStage = null,
            TranslatorContext other     = null)
        {
            if (nextStage != null)
            {
                _config.MergeOutputUserAttributes(nextStage._config.UsedInputAttributes);
            }

            FunctionCode[] code = EmitShader(_cfg, _config, initializeOutputs: other == null, out _);

            if (other != null)
            {
                other._config.MergeOutputUserAttributes(_config.UsedOutputAttributes);

                FunctionCode[] otherCode = EmitShader(other._cfg, other._config, initializeOutputs: true, out int aStart);

                code = Combine(otherCode, code, aStart);

                _config.InheritFrom(other._config);
            }

            return(Translator.Translate(code, _config, out shaderProgramInfo));
        }
Ejemplo n.º 2
0
        public ShaderProgram Translate(out ShaderProgramInfo shaderProgramInfo, TranslatorContext other = null)
        {
            FunctionCode[] code = EmitShader(_cfg, _config);

            if (other != null)
            {
                code = Combine(EmitShader(other._cfg, other._config), code);

                _config.InheritFrom(other._config);
            }

            return(Translator.Translate(code, _config, out shaderProgramInfo));
        }
Ejemplo n.º 3
0
        public ShaderProgram Translate(TranslatorContext other = null)
        {
            FunctionCode[] code = EmitShader(_program, _config, initializeOutputs: other == null, out _);

            if (other != null)
            {
                other._config.MergeOutputUserAttributes(_config.UsedOutputAttributes, 0);

                FunctionCode[] otherCode = EmitShader(other._program, other._config, initializeOutputs: true, out int aStart);

                code = Combine(otherCode, code, aStart);

                _config.InheritFrom(other._config);
            }

            return(Translator.Translate(code, _config));
        }