Example #1
0
        private static void ComparePass(EffectPass reflectionPass, Fx10.EffectPass pass)
        {
            EffectPassDescription desc = reflectionPass.Description;

            Assert.AreEqual(desc.Name, pass.Name);
            var annotations = reflectionPass.GetAnnotations();

            for (int i = 0; i < desc.AnnotationCount; i++)
            {
                CompareVariable(annotations[i], pass.Annotations[i]);
            }

            /*var pixelShader = pass.Shaders.FirstOrDefault(
             *      s => s.ShaderType == Fx10.EffectShaderType.PixelShader);
             * if(pixelShader != null)
             * {
             *      EffectPassShaderDescription shaderDesc = reflectionPass.PixelShaderDescription;
             *      CompareShader(shaderDesc, pixelShader);
             * }
             * var vertexShader = pass.Shaders.FirstOrDefault(
             *      s => s.ShaderType == Fx10.EffectShaderType.VertexShader);
             * if (vertexShader != null)
             * {
             *      EffectPassShaderDescription shaderDesc = reflectionPass.VertexShaderDescription;
             *      CompareShader(shaderDesc, vertexShader);
             * }
             * var geometryShader = pass.Shaders.FirstOrDefault(
             *      s => s.ShaderType == Fx10.EffectShaderType.GeometryShader);
             * if (geometryShader != null)
             * {
             *      EffectPassShaderDescription shaderDesc = reflectionPass.GeometryShaderDescription;
             *      CompareShader(shaderDesc, geometryShader);
             * }*/
        }
        public static EffectTechnique Parse(BytecodeReader reader, BytecodeReader techniqueReader, ShaderVersion version)
        {
            var result     = new EffectTechnique(version);
            var nameOffset = techniqueReader.ReadUInt32();
            var nameReader = reader.CopyAtOffset((int)nameOffset);

            result.Name = nameReader.ReadString();
            var passCount       = techniqueReader.ReadUInt32();
            var annotationCount = techniqueReader.ReadUInt32();

            for (int i = 0; i < annotationCount; i++)
            {
                result.Annotations.Add(EffectAnnotation.Parse(reader, techniqueReader, version));
            }
            for (int i = 0; i < passCount; i++)
            {
                result.Passes.Add(EffectPass.Parse(reader, techniqueReader, version));
            }
            return(result);
        }
Example #3
0
        public static EffectPass Parse(BytecodeReader reader, BytecodeReader passReader, ShaderVersion version)
        {
            var result     = new EffectPass();
            var nameOffset = passReader.ReadUInt32();
            var nameReader = reader.CopyAtOffset((int)nameOffset);

            result.Name = nameReader.ReadString();
            var assignmentCount = passReader.ReadUInt32();
            var annotationCount = passReader.ReadUInt32();

            for (int i = 0; i < annotationCount; i++)
            {
                result.Annotations.Add(EffectAnnotation.Parse(reader, passReader, version));
            }
            for (int i = 0; i < assignmentCount; i++)
            {
                result.Assignments.Add(EffectAssignment.Parse(reader, passReader));
            }
            return(result);
        }