Exemplo n.º 1
0
        public SerializedPass(ObjectReader reader)
        {
            var version = reader.version;

            int numIndices = reader.ReadInt32();

            m_NameIndices = new KeyValuePair <string, int> [numIndices];
            for (int i = 0; i < numIndices; i++)
            {
                m_NameIndices[i] = new KeyValuePair <string, int>(reader.ReadAlignedString(), reader.ReadInt32());
            }

            m_Type                 = (PassType)reader.ReadInt32();
            m_State                = new SerializedShaderState(reader);
            m_ProgramMask          = reader.ReadUInt32();
            progVertex             = new SerializedProgram(reader);
            progFragment           = new SerializedProgram(reader);
            progGeometry           = new SerializedProgram(reader);
            progHull               = new SerializedProgram(reader);
            progDomain             = new SerializedProgram(reader);
            m_HasInstancingVariant = reader.ReadBoolean();
            if (version[0] >= 2018) //2018 and up
            {
                var m_HasProceduralInstancingVariant = reader.ReadBoolean();
            }
            reader.AlignStream();
            m_UseName     = reader.ReadAlignedString();
            m_Name        = reader.ReadAlignedString();
            m_TextureName = reader.ReadAlignedString();
            m_Tags        = new SerializedTagMap(reader);
        }
Exemplo n.º 2
0
        public SerializedPass(ObjectReader reader)
        {
            var version = reader.version;

            if (version[0] > 2020 || (version[0] == 2020 && version[1] >= 2)) //2020.2 and up
            {
                int numEditorDataHash = reader.ReadInt32();
                m_EditorDataHash = new Hash128[numEditorDataHash];
                for (int i = 0; i < numEditorDataHash; i++)
                {
                    m_EditorDataHash[i] = new Hash128(reader);
                }
                reader.AlignStream();
                m_Platforms = reader.ReadUInt8Array();
                reader.AlignStream();
                if (version[0] < 2021 || (version[0] == 2021 && version[1] < 2)) //2021.1 and down
                {
                    m_LocalKeywordMask = reader.ReadUInt16Array();
                    reader.AlignStream();
                    m_GlobalKeywordMask = reader.ReadUInt16Array();
                    reader.AlignStream();
                }
            }

            int numIndices = reader.ReadInt32();

            m_NameIndices = new KeyValuePair <string, int> [numIndices];
            for (int i = 0; i < numIndices; i++)
            {
                m_NameIndices[i] = new KeyValuePair <string, int>(reader.ReadAlignedString(), reader.ReadInt32());
            }

            m_Type        = (PassType)reader.ReadInt32();
            m_State       = new SerializedShaderState(reader);
            m_ProgramMask = reader.ReadUInt32();
            progVertex    = new SerializedProgram(reader);
            progFragment  = new SerializedProgram(reader);
            progGeometry  = new SerializedProgram(reader);
            progHull      = new SerializedProgram(reader);
            progDomain    = new SerializedProgram(reader);
            if (version[0] > 2019 || (version[0] == 2019 && version[1] >= 3)) //2019.3 and up
            {
                progRayTracing = new SerializedProgram(reader);
            }
            m_HasInstancingVariant = reader.ReadBoolean();
            if (version[0] >= 2018) //2018 and up
            {
                var m_HasProceduralInstancingVariant = reader.ReadBoolean();
            }
            reader.AlignStream();
            m_UseName     = reader.ReadAlignedString();
            m_Name        = reader.ReadAlignedString();
            m_TextureName = reader.ReadAlignedString();
            m_Tags        = new SerializedTagMap(reader);
            if (version[0] > 2021 || (version[0] == 2021 && version[1] >= 2)) //2021.2 and up
            {
                m_SerializedKeywordStateMask = reader.ReadUInt16Array();
                reader.AlignStream();
            }
        }