Example #1
0
        public void Visit(Pass p)
        {
            if (!p.Begin(this))
            {
                return;
            }

            var oldFunction = p.Function;

            p.Function = this;
            _optionalBody?.Visit(p);

            var shaderFunc = this as ShaderFunction;

            if (shaderFunc != null)
            {
                if (shaderFunc.Shader.Entrypoint == this)
                {
                    if (shaderFunc.Shader is VertexShader)
                    {
                        shaderFunc.Shader.State.VisitVaryings(shaderFunc.Shader.Entrypoint.Body, p);
                    }

                    shaderFunc.Shader.VisitTerminals(shaderFunc.Shader.Entrypoint.Body, p);
                }
            }

            var method = this as Method;

            if (method != null)
            {
                foreach (var db in method.DrawBlocks)
                {
                    db.Visit(p);
                }
            }

            p.Function = oldFunction;
            p.End(this);
        }
Example #2
0
        public void Visit(Pass p)
        {
            if (!p.Begin(this))
            {
                return;
            }

            var old = p.Namespace;

            p.Namespace = this;

            foreach (var child in Namespaces)
            {
                child.Visit(p);
            }

            for (int i = 0; i < Types.Count; i++)
            {
                Types[i].Visit(p);
            }

            p.Namespace = old;
            p.End(this);
        }
Example #3
0
        public void Visit(Pass p, bool recursive = true)
        {
            if (!p.Begin(this))
            {
                return;
            }

            var old = p.Type;

            p.Type = this;

            if (recursive)
            {
                for (int i = 0; i < NestedTypes.Count; i++)
                {
                    NestedTypes[i].Visit(p);
                }
            }

            p.Function = DummyMethod;

            Initializer?.Visit(p);
            Finalizer?.Visit(p);

            for (int i = 0; i < Methods.Count; i++)
            {
                Methods[i].Visit(p);
            }
            for (int i = 0; i < Constructors.Count; i++)
            {
                Constructors[i].Visit(p);
            }

            for (int i = 0; i < Properties.Count; i++)
            {
                var m = Properties[i];
                m.GetMethod?.Visit(p);
                m.SetMethod?.Visit(p);
            }

            for (int i = 0; i < Events.Count; i++)
            {
                var m = Events[i];
                m.AddMethod?.Visit(p);
                m.RemoveMethod?.Visit(p);
            }

            for (int i = 0; i < Operators.Count; i++)
            {
                Operators[i].Visit(p);
            }
            for (int i = 0; i < Casts.Count; i++)
            {
                Casts[i].Visit(p);
            }

            p.Function = null;

            Block?.Visit(p);

            p.Type = old;
            p.End(this);
        }