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(); } }
public SerializedProgram(ObjectReader reader) { var version = reader.version; int numSubPrograms = reader.ReadInt32(); m_SubPrograms = new SerializedSubProgram[numSubPrograms]; for (int i = 0; i < numSubPrograms; i++) { m_SubPrograms[i] = new SerializedSubProgram(reader); } if ((version[0] == 2020 && version[1] > 3) || (version[0] == 2020 && version[1] == 3 && version[2] >= 2) || //2020.3.2f1 and up (version[0] > 2021) || (version[0] == 2021 && version[1] > 1) || (version[0] == 2021 && version[1] == 1 && version[2] >= 1)) //2021.1.1f1 and up { m_CommonParameters = new SerializedProgramParameters(reader); } if (version[0] > 2022 || (version[0] == 2022 && version[1] >= 1)) //2022.1 and up { m_SerializedKeywordStateMask = reader.ReadUInt16Array(); reader.AlignStream(); } }
public VideoClip(ObjectReader reader) : base(reader) { m_OriginalPath = reader.ReadAlignedString(); var m_ProxyWidth = reader.ReadUInt32(); var m_ProxyHeight = reader.ReadUInt32(); var Width = reader.ReadUInt32(); var Height = reader.ReadUInt32(); if (version[0] > 2017 || (version[0] == 2017 && version[1] >= 2)) //2017.2 and up { var m_PixelAspecRatioNum = reader.ReadUInt32(); var m_PixelAspecRatioDen = reader.ReadUInt32(); } var m_FrameRate = reader.ReadDouble(); var m_FrameCount = reader.ReadUInt64(); var m_Format = reader.ReadInt32(); var m_AudioChannelCount = reader.ReadUInt16Array(); reader.AlignStream(); var m_AudioSampleRate = reader.ReadUInt32Array(); var m_AudioLanguage = reader.ReadStringArray(); if (version[0] >= 2020) //2020.1 and up { var m_VideoShadersSize = reader.ReadInt32(); var m_VideoShaders = new PPtr <Shader> [m_VideoShadersSize]; for (var i = 0; i < m_VideoShadersSize; i++) { m_VideoShaders[i] = new PPtr <Shader>(reader); } } m_ExternalResources = new StreamedResource(reader); var m_HasSplitAlpha = reader.ReadBoolean(); if (version[0] >= 2020) //2020.1 and up { var m_sRGB = reader.ReadBoolean(); } ResourceReader resourceReader; if (!string.IsNullOrEmpty(m_ExternalResources.m_Source)) { resourceReader = new ResourceReader(m_ExternalResources.m_Source, assetsFile, m_ExternalResources.m_Offset, (int)m_ExternalResources.m_Size); } else { resourceReader = new ResourceReader(reader, reader.BaseStream.Position, (int)m_ExternalResources.m_Size); } m_VideoData = resourceReader; }
public VideoClip(ObjectReader reader) : base(reader) { m_OriginalPath = reader.ReadAlignedString(); var m_ProxyWidth = reader.ReadUInt32(); var m_ProxyHeight = reader.ReadUInt32(); var Width = reader.ReadUInt32(); var Height = reader.ReadUInt32(); if (version[0] > 2017 || (version[0] == 2017 && version[1] >= 2)) //2017.2 and up { var m_PixelAspecRatioNum = reader.ReadUInt32(); var m_PixelAspecRatioDen = reader.ReadUInt32(); } var m_FrameRate = reader.ReadDouble(); var m_FrameCount = reader.ReadUInt64(); var m_Format = reader.ReadInt32(); var m_AudioChannelCount = reader.ReadUInt16Array(); reader.AlignStream(); var m_AudioSampleRate = reader.ReadUInt32Array(); var m_AudioLanguage = reader.ReadStringArray(); //StreamedResource m_ExternalResources m_Source = reader.ReadAlignedString(); var m_Offset = reader.ReadUInt64(); m_Size = reader.ReadUInt64(); var m_HasSplitAlpha = reader.ReadBoolean(); ResourceReader resourceReader; if (!string.IsNullOrEmpty(m_Source)) { resourceReader = new ResourceReader(m_Source, assetsFile, (long)m_Offset, (int)m_Size); } else { resourceReader = new ResourceReader(reader, reader.BaseStream.Position, (int)m_Size); } m_VideoData = new Lazy <byte[]>(resourceReader.GetData); }
public SpriteRenderData(ObjectReader reader) { var version = reader.version; texture = new PPtr <Texture2D>(reader); if (version[0] > 5 || (version[0] == 5 && version[1] >= 2)) //5.2 and up { alphaTexture = new PPtr <Texture2D>(reader); } if (version[0] > 5 || (version[0] == 5 && version[1] >= 6)) //5.6 and up { var m_SubMeshesSize = reader.ReadInt32(); m_SubMeshes = new SubMesh[m_SubMeshesSize]; for (int i = 0; i < m_SubMeshesSize; i++) { m_SubMeshes[i] = new SubMesh(reader); } m_IndexBuffer = reader.ReadBytes(reader.ReadInt32()); reader.AlignStream(4); m_VertexData = new VertexData(reader); } else { var verticesSize = reader.ReadInt32(); vertices = new SpriteVertex[verticesSize]; for (int i = 0; i < verticesSize; i++) { vertices[i] = new SpriteVertex(reader); } indices = reader.ReadUInt16Array(reader.ReadInt32()); reader.AlignStream(4); } if (version[0] >= 2018) //2018 and up { m_Bindpose = reader.ReadMatrixArray(reader.ReadInt32()); if (version[0] == 2018 && version[1] < 2) //2018.2 down { var m_SourceSkinSize = reader.ReadInt32(); for (int i = 0; i < m_SourceSkinSize; i++) { m_SourceSkin[i] = new BoneWeights4(reader); } } } textureRect = reader.ReadRectangleF(); textureRectOffset = reader.ReadVector2(); if (version[0] > 5 || (version[0] == 5 && version[1] >= 6)) //5.6 and up { atlasRectOffset = reader.ReadVector2(); } settingsRaw = new SpriteSettings(reader); if (version[0] > 4 || (version[0] == 4 && version[1] >= 5)) //4.5 and up { uvTransform = reader.ReadVector4(); } if (version[0] >= 2017) //2017 and up { downscaleMultiplier = reader.ReadSingle(); } }
public SerializedSubProgram(ObjectReader reader) { var version = reader.version; m_BlobIndex = reader.ReadUInt32(); m_Channels = new ParserBindChannels(reader); m_KeywordIndices = reader.ReadUInt16Array(); if (version[0] >= 2017) //2017 and up { reader.AlignStream(); } m_ShaderHardwareTier = reader.ReadSByte(); m_GpuProgramType = (ShaderGpuProgramType)reader.ReadSByte(); reader.AlignStream(); int numVectorParams = reader.ReadInt32(); m_VectorParams = new VectorParameter[numVectorParams]; for (int i = 0; i < numVectorParams; i++) { m_VectorParams[i] = new VectorParameter(reader); } int numMatrixParams = reader.ReadInt32(); m_MatrixParams = new MatrixParameter[numMatrixParams]; for (int i = 0; i < numMatrixParams; i++) { m_MatrixParams[i] = new MatrixParameter(reader); } int numTextureParams = reader.ReadInt32(); m_TextureParams = new TextureParameter[numTextureParams]; for (int i = 0; i < numTextureParams; i++) { m_TextureParams[i] = new TextureParameter(reader); } int numBufferParams = reader.ReadInt32(); m_BufferParams = new BufferBinding[numBufferParams]; for (int i = 0; i < numBufferParams; i++) { m_BufferParams[i] = new BufferBinding(reader); } int numConstantBuffers = reader.ReadInt32(); m_ConstantBuffers = new ConstantBuffer[numConstantBuffers]; for (int i = 0; i < numConstantBuffers; i++) { m_ConstantBuffers[i] = new ConstantBuffer(reader); } int numConstantBufferBindings = reader.ReadInt32(); m_ConstantBufferBindings = new BufferBinding[numConstantBufferBindings]; for (int i = 0; i < numConstantBufferBindings; i++) { m_ConstantBufferBindings[i] = new BufferBinding(reader); } int numUAVParams = reader.ReadInt32(); m_UAVParams = new UAVParameter[numUAVParams]; for (int i = 0; i < numUAVParams; i++) { m_UAVParams[i] = new UAVParameter(reader); } if (version[0] >= 2017) //2017 and up { int numSamplers = reader.ReadInt32(); m_Samplers = new SamplerParameter[numSamplers]; for (int i = 0; i < numSamplers; i++) { m_Samplers[i] = new SamplerParameter(reader); } } if (version[0] > 2017 || (version[0] == 2017 && version[1] >= 2)) //2017.2 and up { var m_ShaderRequirements = reader.ReadInt32(); } }
public SerializedSubProgram(ObjectReader reader) { var version = reader.version; m_BlobIndex = reader.ReadUInt32(); m_Channels = new ParserBindChannels(reader); if ((version[0] >= 2019 && version[0] < 2021) || (version[0] == 2021 && version[1] < 2)) //2019 ~2021.1 { var m_GlobalKeywordIndices = reader.ReadUInt16Array(); reader.AlignStream(); var m_LocalKeywordIndices = reader.ReadUInt16Array(); reader.AlignStream(); } else { m_KeywordIndices = reader.ReadUInt16Array(); if (version[0] >= 2017) //2017 and up { reader.AlignStream(); } } m_ShaderHardwareTier = reader.ReadSByte(); m_GpuProgramType = (ShaderGpuProgramType)reader.ReadSByte(); reader.AlignStream(); if ((version[0] == 2020 && version[1] > 3) || (version[0] == 2020 && version[1] == 3 && version[2] > 0) || (version[0] == 2020 && version[1] == 3 && version[2] == 0 && version[3] >= 2) || //2020.3.0f2 to 2020.3.x (version[0] == 2021 && version[1] > 1) || (version[0] == 2021 && version[1] == 1 && version[2] >= 4)) //2021.1.4f1 to 2021.1.x { m_Parameters = new SerializedProgramParameters(reader); } else { int numVectorParams = reader.ReadInt32(); m_VectorParams = new VectorParameter[numVectorParams]; for (int i = 0; i < numVectorParams; i++) { m_VectorParams[i] = new VectorParameter(reader); } int numMatrixParams = reader.ReadInt32(); m_MatrixParams = new MatrixParameter[numMatrixParams]; for (int i = 0; i < numMatrixParams; i++) { m_MatrixParams[i] = new MatrixParameter(reader); } int numTextureParams = reader.ReadInt32(); m_TextureParams = new TextureParameter[numTextureParams]; for (int i = 0; i < numTextureParams; i++) { m_TextureParams[i] = new TextureParameter(reader); } int numBufferParams = reader.ReadInt32(); m_BufferParams = new BufferBinding[numBufferParams]; for (int i = 0; i < numBufferParams; i++) { m_BufferParams[i] = new BufferBinding(reader); } int numConstantBuffers = reader.ReadInt32(); m_ConstantBuffers = new ConstantBuffer[numConstantBuffers]; for (int i = 0; i < numConstantBuffers; i++) { m_ConstantBuffers[i] = new ConstantBuffer(reader); } int numConstantBufferBindings = reader.ReadInt32(); m_ConstantBufferBindings = new BufferBinding[numConstantBufferBindings]; for (int i = 0; i < numConstantBufferBindings; i++) { m_ConstantBufferBindings[i] = new BufferBinding(reader); } int numUAVParams = reader.ReadInt32(); m_UAVParams = new UAVParameter[numUAVParams]; for (int i = 0; i < numUAVParams; i++) { m_UAVParams[i] = new UAVParameter(reader); } if (version[0] >= 2017) //2017 and up { int numSamplers = reader.ReadInt32(); m_Samplers = new SamplerParameter[numSamplers]; for (int i = 0; i < numSamplers; i++) { m_Samplers[i] = new SamplerParameter(reader); } } } if (version[0] > 2017 || (version[0] == 2017 && version[1] >= 2)) //2017.2 and up { if (version[0] >= 2021) //2021.1 and up { var m_ShaderRequirements = reader.ReadInt64(); } else { var m_ShaderRequirements = reader.ReadInt32(); } } }