Exemple #1
0
        internal static void MigrateMSAA(ref FrameSettings cameraFrameSettings, ref FrameSettingsOverrideMask newFrameSettingsOverrideMask)
        {
            if (cameraFrameSettings.IsEnabled(FrameSettingsField.MSAA))
            {
                cameraFrameSettings.msaaMode = MSAAMode.FromHDRPAsset;
            }
            else
            {
                cameraFrameSettings.msaaMode = MSAAMode.None;
            }

            newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.MSAAMode] = newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.MSAA];
            newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.MSAA]     = false;
        }
Exemple #2
0
#pragma warning disable 618 // Type or member is obsolete
        internal static void MigrateFromClassVersion(ref ObsoleteFrameSettings oldFrameSettingsFormat, ref FrameSettings newFrameSettingsFormat, ref FrameSettingsOverrideMask newFrameSettingsOverrideMask)
        {
            if (oldFrameSettingsFormat == null)
            {
                return;
            }

            // no need to migrate those computed at frame value
            //newFrameSettingsFormat.diffuseGlobalDimmer = oldFrameSettingsFormat.diffuseGlobalDimmer;
            //newFrameSettingsFormat.specularGlobalDimmer = oldFrameSettingsFormat.specularGlobalDimmer;

            // Data
            switch (oldFrameSettingsFormat.shaderLitMode)
            {
            case ObsoleteLitShaderMode.Forward:
                newFrameSettingsFormat.litShaderMode = LitShaderMode.Forward;
                break;

            case ObsoleteLitShaderMode.Deferred:
                newFrameSettingsFormat.litShaderMode = LitShaderMode.Deferred;
                break;

            default:
                throw new ArgumentException("Unknown ObsoleteLitShaderMode");
            }

            newFrameSettingsFormat.SetEnabled(FrameSettingsField.ShadowMaps, oldFrameSettingsFormat.enableShadow);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.ContactShadows, oldFrameSettingsFormat.enableContactShadows);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.Shadowmask, oldFrameSettingsFormat.enableShadowMask);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.SSR, oldFrameSettingsFormat.enableSSR);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.SSAO, oldFrameSettingsFormat.enableSSAO);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.SubsurfaceScattering, oldFrameSettingsFormat.enableSubsurfaceScattering);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.Transmission, oldFrameSettingsFormat.enableTransmission);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.AtmosphericScattering, oldFrameSettingsFormat.enableAtmosphericScattering);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.Volumetrics, oldFrameSettingsFormat.enableVolumetrics);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.ReprojectionForVolumetrics, oldFrameSettingsFormat.enableReprojectionForVolumetrics);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.LightLayers, oldFrameSettingsFormat.enableLightLayers);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.DepthPrepassWithDeferredRendering, oldFrameSettingsFormat.enableDepthPrepassWithDeferredRendering);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.TransparentPrepass, oldFrameSettingsFormat.enableTransparentPrepass);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.MotionVectors, oldFrameSettingsFormat.enableMotionVectors);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.ObjectMotionVectors, oldFrameSettingsFormat.enableObjectMotionVectors);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.Decals, oldFrameSettingsFormat.enableDecals);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.Refraction, oldFrameSettingsFormat.enableRoughRefraction);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.TransparentPostpass, oldFrameSettingsFormat.enableTransparentPostpass);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.Distortion, oldFrameSettingsFormat.enableDistortion);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.Postprocess, oldFrameSettingsFormat.enablePostprocess);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.OpaqueObjects, oldFrameSettingsFormat.enableOpaqueObjects);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.TransparentObjects, oldFrameSettingsFormat.enableTransparentObjects);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.MSAA, oldFrameSettingsFormat.enableMSAA);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.ExposureControl, oldFrameSettingsFormat.enableExposureControl);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.AsyncCompute, oldFrameSettingsFormat.enableAsyncCompute);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.LightListAsync, oldFrameSettingsFormat.runLightListAsync);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.SSRAsync, oldFrameSettingsFormat.runSSRAsync);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.SSAOAsync, oldFrameSettingsFormat.runSSAOAsync);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.ContactShadowsAsync, oldFrameSettingsFormat.runContactShadowsAsync);
            newFrameSettingsFormat.SetEnabled(FrameSettingsField.VolumeVoxelizationsAsync, oldFrameSettingsFormat.runVolumeVoxelizationAsync);

            if (oldFrameSettingsFormat.lightLoopSettings != null)
            {
                newFrameSettingsFormat.SetEnabled(FrameSettingsField.DeferredTile, oldFrameSettingsFormat.lightLoopSettings.enableDeferredTileAndCluster);
                newFrameSettingsFormat.SetEnabled(FrameSettingsField.ComputeLightEvaluation, oldFrameSettingsFormat.lightLoopSettings.enableComputeLightEvaluation);
                newFrameSettingsFormat.SetEnabled(FrameSettingsField.ComputeLightVariants, oldFrameSettingsFormat.lightLoopSettings.enableComputeLightVariants);
                newFrameSettingsFormat.SetEnabled(FrameSettingsField.ComputeMaterialVariants, oldFrameSettingsFormat.lightLoopSettings.enableComputeMaterialVariants);
                newFrameSettingsFormat.SetEnabled(FrameSettingsField.FPTLForForwardOpaque, oldFrameSettingsFormat.lightLoopSettings.enableFptlForForwardOpaque);
                newFrameSettingsFormat.SetEnabled(FrameSettingsField.BigTilePrepass, oldFrameSettingsFormat.lightLoopSettings.enableBigTilePrepass);
            }

            // OverrideMask
            newFrameSettingsOverrideMask.mask = new BitArray128();
            Array values = Enum.GetValues(typeof(ObsoleteFrameSettingsOverrides));

            foreach (ObsoleteFrameSettingsOverrides val in values)
            {
                if ((val & oldFrameSettingsFormat.overrides) > 0)
                {
                    switch (val)
                    {
                    case ObsoleteFrameSettingsOverrides.Shadow:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.ShadowMaps] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.ContactShadow:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.ContactShadows] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.ShadowMask:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.Shadowmask] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.SSR:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.SSR] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.SSAO:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.SSAO] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.SubsurfaceScattering:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.SubsurfaceScattering] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.Transmission:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.Transmission] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.AtmosphericScaterring:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.AtmosphericScattering] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.Volumetrics:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.Volumetrics] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.ReprojectionForVolumetrics:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.ReprojectionForVolumetrics] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.LightLayers:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.LightLayers] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.ShaderLitMode:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.LitShaderMode] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.DepthPrepassWithDeferredRendering:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.DepthPrepassWithDeferredRendering] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.TransparentPrepass:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.TransparentPrepass] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.MotionVectors:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.MotionVectors] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.ObjectMotionVectors:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.ObjectMotionVectors] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.Decals:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.Decals] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.RoughRefraction:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.Refraction] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.TransparentPostpass:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.TransparentPostpass] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.Distortion:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.Distortion] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.Postprocess:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.Postprocess] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.OpaqueObjects:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.OpaqueObjects] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.TransparentObjects:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.TransparentObjects] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.MSAA:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.MSAA] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.ExposureControl:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.ExposureControl] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.AsyncCompute:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.AsyncCompute] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.LightListAsync:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.LightListAsync] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.SSRAsync:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.SSRAsync] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.SSAOAsync:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.SSAOAsync] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.ContactShadowsAsync:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.ContactShadowsAsync] = true;
                        break;

                    case ObsoleteFrameSettingsOverrides.VolumeVoxelizationsAsync:
                        newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.VolumeVoxelizationsAsync] = true;
                        break;

                    default:
                        throw new ArgumentException("Unknown ObsoleteFrameSettingsOverride, was " + val);
                    }
                }
            }

            if (oldFrameSettingsFormat.lightLoopSettings != null)
            {
                values = Enum.GetValues(typeof(ObsoleteLightLoopSettingsOverrides));
                foreach (ObsoleteLightLoopSettingsOverrides val in values)
                {
                    if ((val & oldFrameSettingsFormat.lightLoopSettings.overrides) > 0)
                    {
                        switch (val)
                        {
                        case ObsoleteLightLoopSettingsOverrides.TileAndCluster:
                            newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.DeferredTile] = true;
                            break;

                        case ObsoleteLightLoopSettingsOverrides.BigTilePrepass:
                            newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.BigTilePrepass] = true;
                            break;

                        case ObsoleteLightLoopSettingsOverrides.ComputeLightEvaluation:
                            newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.ComputeLightEvaluation] = true;
                            break;

                        case ObsoleteLightLoopSettingsOverrides.ComputeLightVariants:
                            newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.ComputeLightVariants] = true;
                            break;

                        case ObsoleteLightLoopSettingsOverrides.ComputeMaterialVariants:
                            newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.ComputeMaterialVariants] = true;
                            break;

                        case ObsoleteLightLoopSettingsOverrides.FptlForForwardOpaque:
                            newFrameSettingsOverrideMask.mask[(int)FrameSettingsField.FPTLForForwardOpaque] = true;
                            break;

                        default:
                            throw new ArgumentException("Unknown ObsoleteLightLoopSettingsOverrides");
                        }
                    }
                }
            }

            //free space:
            oldFrameSettingsFormat = null;
        }