// Shader.h
        private static void FShaderMapPointerTable_LoadFromArchive(FMaterialResourceProxyReader Ar)
        {
            if (GIsHybridUE5)
            {
                FPointerTableBase_LoadFromArchive(Ar);
            }

            var numTypes   = Ar.Read <int>();
            var numVFTypes = Ar.Read <int>();

            for (var typeIndex = 0; typeIndex < numTypes; ++typeIndex)
            {
                var typeName = Ar.Read <FHashedName>();
            }

            for (var vfTypeIndex = 0; vfTypeIndex < numVFTypes; ++vfTypeIndex)
            {
                var vfTypeName = Ar.Read <FHashedName>();
            }

            if (!GIsHybridUE5)
            {
                FPointerTableBase_LoadFromArchive(Ar);
            }
        }
        // MemoryImage.cpp
        private static void FPointerTableBase_LoadFromArchive(FMaterialResourceProxyReader Ar)
        {
            var numDependencies = Ar.Read <int>();

            for (var i = 0; i < numDependencies; ++i)
            {
                var nameHash        = Ar.Read <ulong>();
                var savedLayoutSize = Ar.Read <uint>();
                var savedLayoutHash = new FSHAHash(Ar);
            }
        }
        public FMaterialShaderMapId(FMaterialResourceProxyReader Ar)
        {
            var bIsLegacyPackage = Ar.Ver < (UE4Version)260;

            if (!bIsLegacyPackage)
            {
                QualityLevel = (EMaterialQualityLevel)Ar.Read <int>();
                FeatureLevel = (ERHIFeatureLevel)Ar.Read <int>();
            }
            else
            {
                var legacyQualityLevel = Ar.Read <byte>();
            }

            // Cooked so can assume this is valid
            CookedShaderMapIdHash = new FSHAHash(Ar);

            if (!bIsLegacyPackage)
            {
                LayoutParams = Ar.Read <FPlatformTypeLayoutParameters>();
            }
        }
Example #4
0
        public void Deserialize(FMaterialResourceProxyReader Ar)
        {
            var bUseNewFormat = Ar.Versions["ShaderMap.UseNewCookedFormat"];

            ImageResult = new FMemoryImageResult(Ar);

            var bShareCode = Ar.ReadBoolean();

            if (bUseNewFormat)
            {
                var ShaderPlatform = Ar.Read <EShaderPlatform>();
            }

            if (bShareCode)
            {
                ResourceHash = new FSHAHash(Ar);
            }
            else
            {
                Code = new FShaderMapResourceCode(Ar);
            }
        }
        public void Deserialize(FMaterialResourceProxyReader Ar)
        {
            #region FMemoryImageResult::LoadFromArchive, MemoryImage.cpp
            if (GIsHybridUE5)
            {
                var layoutParameters = Ar.Read <FPlatformTypeLayoutParameters>();
            }

            var frozenSize   = Ar.Read <int>();
            var frozenObject = Ar.ReadBytes(frozenSize);

            if (GIsHybridUE5)
            {
                //var bFrozenObjectIsValid = pointerTable.LoadFromArchive(Ar, layoutParameters, frozenObject);
                FShaderMapPointerTable_LoadFromArchive(Ar);
            }

            var numVTables      = Ar.Read <uint>();
            var numScriptNames  = Ar.Read <uint>();
            var numMinimalNames = Ar.Read <uint>();

            for (var i = 0; i < numVTables; i++)
            {
                var typeNameHash = Ar.Read <ulong>();
                var numPatches   = Ar.Read <uint>();

                for (var patchIndex = 0; patchIndex < numPatches; ++patchIndex)
                {
                    var vTableOffset = Ar.Read <uint>();
                    var offset       = Ar.Read <uint>();
                }
            }

            for (var i = 0; i < numScriptNames; i++)
            {
                var name       = Ar.ReadFName();
                var numPatches = Ar.Read <uint>();

                for (var patchIndex = 0; patchIndex < numPatches; ++patchIndex)
                {
                    var offset = Ar.Read <uint>();
                }
            }

            for (var i = 0; i < numMinimalNames; i++)
            {
                var name       = Ar.ReadFName();
                var numPatches = Ar.Read <uint>();

                for (var patchIndex = 0; patchIndex < numPatches; ++patchIndex)
                {
                    var offset = Ar.Read <uint>();
                }
            }

            #endregion

            if (!GIsHybridUE5)
            {
                FShaderMapPointerTable_LoadFromArchive(Ar);
            }

            var bShareCode = Ar.ReadBoolean();
            if (GIsHybridUE5)
            {
                var shaderPlatform = Ar.Read <byte>();
            }

            if (bShareCode)
            {
                var resourceHash = new FSHAHash(Ar);
            }
            else
            {
                throw new NotImplementedException();
            }
        }