internal void StepUpdateFiltering() { if (6 <= state && state < 12) { int faceId = state - 6; var matrix = CubeFaceViewMatrix(Vector3.Zero, faceId); MyEnvProbeProcessing.RunForwardPostprocess(workCubemap.SubresourceRtv(faceId), m_cubemapDepth.SubresourceSrv(faceId), ref matrix); MyEnvProbeProcessing.BuildMipmaps(workCubemap); MyEnvProbeProcessing.Prefilter(workCubemap, workCubemapPrefiltered); ++state; if (state == 12) { blendT0 = MyRender11.CurrentDrawTime; } return; } }
internal void FinalizeEnvProbes() { if (MyRender11.IsIntelBrokenCubemapsWorkaround) { return; } ProfilerShort.Begin("FinalizeEnvProbes"); MyGpuProfiler.IC_BeginBlock("FinalizeEnvProbes"); if (m_lastUpdateTime == MyTimeSpan.Zero) { for (int i = 0; i < 6; i++) { PostprocessProbe(i); } MyGpuProfiler.IC_BeginBlock("BuildMipmaps"); MyEnvProbeProcessing.BuildMipmaps(m_workCubemap); MyGpuProfiler.IC_EndBlock(); MyGpuProfiler.IC_BeginBlock("Prefilter"); MyEnvProbeProcessing.Prefilter(m_workCubemap, m_workCubemapPrefiltered); MyGpuProfiler.IC_EndBlock(); MyGpuProfiler.IC_BeginBlock("CopyResource"); MyImmediateRC.RC.CopyResource(m_workCubemapPrefiltered, m_prevWorkCubemapPrefiltered); MyImmediateRC.RC.CopyResource(m_workCubemapPrefiltered, Cubemap); MyGpuProfiler.IC_EndBlock(); m_lastUpdateTime = MyRender11.CurrentDrawTime; } else { if (m_state >= 6 && m_state < 12) { PostprocessProbe(m_state - 6); } else if (m_state >= 12) { MyGpuProfiler.IC_BeginBlock("BlendAllProbes"); BlendAllProbes(); MyGpuProfiler.IC_EndBlock(); } if (m_state == 12) { MyGpuProfiler.IC_BeginBlock("BuildMipmaps"); m_lastUpdateTime = MyRender11.CurrentDrawTime; // whole cubemap is rendered and postprocessed, we can use it MyEnvProbeProcessing.BuildMipmaps(m_workCubemap); MyGpuProfiler.IC_EndBlock(); MyGpuProfiler.IC_BeginBlock("Prefilter"); MyEnvProbeProcessing.Prefilter(m_workCubemap, m_workCubemapPrefiltered); MyGpuProfiler.IC_EndBlock(); } m_state++; MyTimeSpan timeForNextCubemap = m_lastUpdateTime + MyTimeSpan.FromSeconds(MyEnvironmentProbe.MAX_BLEND_TIME_S); if (m_state > 12 && MyRender11.CurrentDrawTime > timeForNextCubemap) { m_state = 0; // Time is up, we need to render another environment map } } MyGpuProfiler.IC_EndBlock(); ProfilerShort.End(); }