Example #1
0
            public void Read(FileReader reader)
            {
                var pos = reader.Position;

                uint SectionSize = reader.ReadUInt32();
                uint NameLength  = reader.ReadUInt32();

                Type = reader.ReadEnum <ShaderType>(false);
                uint index = reader.ReadUInt32();

                Text = reader.ReadString((int)NameLength);

                variationMacroData  = new VariationMacroData();
                variationSymbolData = new VariationSymbolData();
                UniformVariables    = new ShaderSymbolData();
                UniformBlocks       = new ShaderSymbolData();
                SamplerVariables    = new ShaderSymbolData();
                AttributeVariables  = new ShaderSymbolData();

                variationMacroData.Read(reader);
                variationSymbolData.Read(reader);
                UniformVariables.Read(reader);
                UniformBlocks.Read(reader);
                SamplerVariables.Read(reader);
                AttributeVariables.Read(reader);

                reader.Seek(SectionSize + pos, System.IO.SeekOrigin.Begin);
            }
Example #2
0
            public void Read(FileReader reader, SHARC.Header header)
            {
                var pos = reader.Position;

                uint SectionSize = reader.ReadUInt32();
                uint NameLength  = reader.ReadUInt32();

                if (header.Version >= 13)
                {
                    VertexShaderIndex    = reader.ReadInt32();
                    FragmentShaderIndex  = reader.ReadInt32();
                    GeoemetryShaderIndex = reader.ReadInt32();
                    ushort computeUnk1  = reader.ReadUInt16();
                    ushort vertexUnk2   = reader.ReadUInt16();
                    ushort fragmentUnk2 = reader.ReadUInt16();
                    ushort geometryUnk2 = reader.ReadUInt16();
                    ushort computeUnk2  = reader.ReadUInt16();
                }
                else
                {
                    VertexShaderIndex    = reader.ReadInt32();
                    FragmentShaderIndex  = reader.ReadInt32();
                    GeoemetryShaderIndex = reader.ReadInt32();

                    VertexShaderIndex    = 0;
                    FragmentShaderIndex  = 1;
                    GeoemetryShaderIndex = -1;
                }
                Text = reader.ReadString((int)NameLength, true);

                variationVertexMacroData   = new VariationMacroData();
                variationFragmenMacroData  = new VariationMacroData();
                variationGeometryMacroData = new VariationMacroData();
                variationComputeMacroData  = new VariationMacroData();

                variationSymbolData     = new VariationSymbolData();
                variationSymbolDataFull = new VariationSymbolData();
                UniformVariables        = new ShaderSymbolData();
                UniformBlocks           = new ShaderSymbolData();
                SamplerVariables        = new ShaderSymbolData();
                AttributeVariables      = new ShaderSymbolData();

                variationVertexMacroData.Read(reader, header.Version);
                variationFragmenMacroData.Read(reader, header.Version);
                variationGeometryMacroData.Read(reader, header.Version);

                if (header.Version >= 13)
                {
                    variationComputeMacroData.Read(reader, header.Version);
                }

                variationSymbolData.Read(reader);
                variationSymbolDataFull.Read(reader);

                UniformVariables.Read(reader, header.Version, true);
                if (header.Version <= 12)
                {
                    if (header.Version >= 11)
                    {
                        UniformBlocks.Read(reader, header.Version, true);
                    }

                    SamplerVariables.Read(reader, header.Version);
                    AttributeVariables.Read(reader, header.Version);
                }


                reader.Seek(SectionSize + pos, System.IO.SeekOrigin.Begin);
            }