Ejemplo n.º 1
0
        /// <summary>
        /// Tests if a sub frame should be skipped before trying to record it. Callback is invoked for every frame during the recording session.
        /// </summary>
        /// <remarks>
        /// If this function returns True, RecordFrame will not be invoked.
        /// </remarks>
        /// <param name="ctx">The current recording session.</param>
        /// <returns>True if the sub frame should be skipped, False otherwise.</returns>
        protected internal virtual bool SkipSubFrame(RecordingSession ctx)
        {
            if (!settings.IsAccumulationSupported())
            {
                return(false);
            }
            IAccumulation accumulation = settings as IAccumulation;

            AccumulationSettings accumulationSettings = null;

            if (accumulation != null)
            {
                accumulationSettings = accumulation.GetAccumulationSettings();
            }

            int accumulationSamples = 1;

            if (accumulationSettings != null && accumulationSettings.CaptureAccumulation)
            {
                accumulationSamples = accumulationSettings.Samples;
            }

            bool skip = (ctx.subFrameIndex) % accumulationSamples != 0;

            return(skip);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Are we currently capturing SubFrames.
        /// </summary>
        /// <returns>bool</returns>
        internal static bool CaptureAccumulation(RecorderSettings settings)
        {
#if HDRP_ACCUM_API
            var hdPipeline = RenderPipelineManager.currentPipeline as HDRenderPipeline;
            if (hdPipeline != null && settings.IsAccumulationSupported())
            {
                IAccumulation accumulation = settings as IAccumulation;
                if (accumulation != null)
                {
                    AccumulationSettings aSettings = accumulation.GetAccumulationSettings();
                    if (aSettings != null)
                    {
                        return(aSettings.CaptureAccumulation);
                    }
                }
            }
#endif
            return(false);
        }
        /// <inheritdoc/>
        protected internal override bool BeginRecording(RecordingSession session)
        {
            if (!base.BeginRecording(session))
            {
                return(false);
            }
#if HDRP_ACCUM_API
            var hdPipeline = RenderPipelineManager.currentPipeline as HDRenderPipeline;
            if (hdPipeline != null)
            {
                if (settings.IsAccumulationSupported() && settings is IAccumulation accumulation)
                {
                    AccumulationSettings aSettings = accumulation.GetAccumulationSettings();

                    if (aSettings != null && aSettings.CaptureAccumulation)
                    {
                        if (aSettings != null &&
                            aSettings.ShutterType == AccumulationSettings.ShutterProfileType.Range)
                        {
                            hdPipeline.BeginRecording(
                                aSettings.Samples,
                                aSettings.ShutterInterval,
                                aSettings.ShutterFullyOpen,
                                aSettings.ShutterBeginsClosing
                                );
                        }
                        else
                        {
                            hdPipeline.BeginRecording(
                                aSettings.Samples,
                                aSettings.ShutterInterval,
                                aSettings.ShutterProfileCurve
                                );
                        }
                    }
                }
            }
#endif
            UseAsyncGPUReadback            = SystemInfo.supportsAsyncGPUReadback;
            m_OngoingAsyncGPURequestsCount = 0;
            m_DelayedEncoderDispose        = false;
            return(true);
        }