Ejemplo n.º 1
0
        internal static void CreateScreenResources()
        {
            var width   = m_resolution.X;
            var height  = m_resolution.Y;
            var samples = RenderSettings.AntialiasingMode.SamplesCount();

            if (MyGBuffer.Main == null)
            {
                MyGBuffer.Main = new MyGBuffer();
            }
            MyGBuffer.Main.Resize(width, height, samples, 0);

            MyScreenDependants.Resize(width, height, samples, 0);

            RemoveScreenResources();

            m_resolvedLight = new MyRenderTarget(width, height, Format.R11G11B10_Float, 1, 0);
            m_reduce0       = new MyUnorderedAccessTexture(width, height, Format.R32G32_Float);
            m_reduce0.SetDebugName("reduce0");
            m_reduce1 = new MyUnorderedAccessTexture(width, height, Format.R32G32_Float);
            m_reduce1.SetDebugName("reduce1");
            m_uav3 = new MyUnorderedAccessTexture(width, height, Format.R11G11B10_Float);

            m_localLum = new MyUnorderedAccessTexture(
                (width + MyLuminanceAverage.NumThreads - 1) / MyLuminanceAverage.NumThreads,
                (height + MyLuminanceAverage.NumThreads - 1) / MyLuminanceAverage.NumThreads,
                Format.R32_Float);

            m_div2   = new MyUnorderedAccessTexture(width / 2, height / 2, Format.R11G11B10_Float);
            m_div4   = new MyUnorderedAccessTexture(width / 4, height / 4, Format.R11G11B10_Float);
            m_div8   = new MyUnorderedAccessTexture(width / 8, height / 8, Format.R11G11B10_Float);
            m_div8_1 = new MyUnorderedAccessTexture(width / 8, height / 8, Format.R11G11B10_Float);

            m_rgba8_linear = new MyUnorderedAccessTexture(width, height, Format.R8G8B8A8_UNorm);

            m_rgba8_0 = new MyCustomTexture(width, height, BindFlags.RenderTarget | BindFlags.ShaderResource, Format.R8G8B8A8_Typeless);
            m_rgba8_0.AddView(new MyViewKey {
                Fmt = Format.R8G8B8A8_UNorm, View = MyViewEnum.RtvView
            });
            m_rgba8_0.AddView(new MyViewKey {
                Fmt = Format.R8G8B8A8_UNorm_SRgb, View = MyViewEnum.RtvView
            });
            m_rgba8_0.AddView(new MyViewKey {
                Fmt = Format.R8G8B8A8_UNorm_SRgb, View = MyViewEnum.SrvView
            });

            m_rgba8_1 = new MyRenderTarget(width, height, Format.R8G8B8A8_UNorm_SRgb, 1, 0);
            m_rgba8_2 = new MyRenderTarget(width, height, Format.R8G8B8A8_UNorm_SRgb, 1, 0);
            if (samples > 1)
            {
                m_rgba8_ms = new MyRenderTarget(width, height, Format.R8G8B8A8_UNorm_SRgb, samples, 0);
            }
            m_prevLum = new MyUnorderedAccessTexture(1, 1, Format.R32G32_Float);

            Debug.Assert(m_shadowsHelper == RwTexId.NULL);
            m_shadowsHelper  = MyRwTextures.CreateUav2D(width, height, Format.R8_UNorm, "cascade shadows gather");
            m_shadowsHelper1 = MyRwTextures.CreateUav2D(width, height, Format.R8_UNorm, "cascade shadows gather 2");

            m_gbuffer1Copy = MyRwTextures.CreateScratch2D(width, height, Format.R8G8B8A8_UNorm, samples, 0, "gbuffer 1 copy");
        }
 internal static void ResolveOIT(MyUnorderedAccessTexture accumTarget, MyUnorderedAccessTexture coverageTarget)
 {
     RC.SetBS(MyRender11.BlendInvTransparent);
     RC.SetPS(m_psResolve);
     RC.BindDepthRT(null, DepthStencilAccess.ReadOnly, MyGBuffer.Main.Get(MyGbufferSlot.LBuffer));
     RC.BindSRV(0, accumTarget);
     RC.BindSRV(1, coverageTarget);
     MyScreenPass.DrawFullscreenQuad(null);
 }
        internal static void Render(MyUnorderedAccessTexture accumTarget, MyUnorderedAccessTexture coverageTarget)
        {
            ProfilerShort.Begin("Atmosphere");
            MyGpuProfiler.IC_BeginBlock("Atmosphere");
            if (MyRender11.DebugOverrides.Atmosphere)
                MyAtmosphereRenderer.Render();
            MyGpuProfiler.IC_EndBlock();

            ProfilerShort.BeginNextBlock("Clouds");
            MyGpuProfiler.IC_BeginBlock("Clouds");
            if (MyRender11.DebugOverrides.Clouds)
                MyCloudRenderer.Render();
            MyGpuProfiler.IC_EndBlock();

            // setup weighted blended OIT targets + blend states
            if (MyRender11.DebugOverrides.OIT)
                SetupOIT(accumTarget, coverageTarget, true);
            else SetupStandard();

            MyDepthStencil depthResource;
            if (MyRender11.MultisamplingEnabled)
                depthResource = MyScreenDependants.m_resolvedDepth;
            else
                depthResource = MyGBuffer.Main.DepthStencil;

            ProfilerShort.BeginNextBlock("Billboards");
            MyGpuProfiler.IC_BeginBlock("Billboards");
            MyBillboardRenderer.Render(depthResource.Depth);
            MyGpuProfiler.IC_EndBlock();

            ProfilerShort.BeginNextBlock("GPU Particles");
            MyGpuProfiler.IC_BeginBlock("GPU Particles");
            if (MyRender11.DebugOverrides.GPUParticles)
                MyGPUParticleRenderer.Run(depthResource.Depth);
            MyGpuProfiler.IC_EndBlock();

            ProfilerShort.BeginNextBlock("Billboards - Depth Only");
            MyGpuProfiler.IC_BeginBlock("Billboards - Depth Only");
            bool windowsFound = MyBillboardRenderer.RenderWindowsDepthOnly(depthResource, MyRender11.Gbuffer1Copy);
            MyGpuProfiler.IC_EndBlock();

            if (MyRender11.DebugOverrides.OIT && windowsFound)
                SetupOIT(accumTarget, coverageTarget, false);

            ProfilerShort.BeginNextBlock("Render decals - Transparent");
            MyGpuProfiler.IC_BeginBlock("Render decals - Transparent");
            MyScreenDecals.Draw(true);
            MyGpuProfiler.IC_EndBlock();

            MyGpuProfiler.IC_BeginBlock("OIT Resolve");
            // resolve weighted blended OIT in  accum / coverage to LBuffer
            if (MyRender11.DebugOverrides.OIT)
                ResolveOIT(accumTarget, coverageTarget);
            MyGpuProfiler.IC_EndBlock();

            ProfilerShort.End();
        }
Ejemplo n.º 4
0
 internal static void ResolveOIT(MyUnorderedAccessTexture accumTarget, MyUnorderedAccessTexture coverageTarget)
 {
     RC.SetBS(MyRender11.BlendInvTransparent);
     RC.SetPS(m_psResolve);
     RC.BindDepthRT(null, DepthStencilAccess.ReadOnly, MyGBuffer.Main.Get(MyGbufferSlot.LBuffer));
     RC.BindSRV(0, accumTarget);
     RC.BindSRV(1, coverageTarget);
     MyScreenPass.DrawFullscreenQuad(null);
 }
Ejemplo n.º 5
0
        internal static void CreateScreenResources()
        {
            var width   = m_resolution.X;
            var height  = m_resolution.Y;
            var samples = RenderSettings.AntialiasingMode.SamplesCount();

            MyUtils.Init(ref MyGBuffer.Main);
            MyGBuffer.Main.Resize(width, height, samples, 0);

            MyScreenDependants.Resize(width, height, samples, 0);

            RemoveScreenResources();

            m_reduce0 = new MyUnorderedAccessTexture(width, height, Format.R32G32_Float);
            m_reduce0.SetDebugName("reduce0");
            m_reduce1 = new MyUnorderedAccessTexture(width, height, Format.R32G32_Float);
            m_reduce1.SetDebugName("reduce1");
            m_uav3 = new MyUnorderedAccessTexture(width, height, MyGBuffer.LBufferFormat);

            m_transparencyAccum    = new MyUnorderedAccessTexture(width, height, Format.R16G16B16A16_Float);
            m_transparencyCoverage = new MyUnorderedAccessTexture(width, height, Format.R8_UNorm);

            HalfScreenUavHDR         = new MyUnorderedAccessTexture(width / 2, height / 2, MyGBuffer.LBufferFormat);
            QuarterScreenUavHDR      = new MyUnorderedAccessTexture(width / 4, height / 4, MyGBuffer.LBufferFormat);
            EighthScreenUavHDR       = new MyUnorderedAccessTexture(width / 8, height / 8, MyGBuffer.LBufferFormat);
            EighthScreenUavHDRHelper = new MyUnorderedAccessTexture(width / 8, height / 8, MyGBuffer.LBufferFormat);

            m_rgba8_linear = new MyUnorderedAccessTexture(width, height, Format.R8G8B8A8_UNorm);

            m_rgba8_0 = new MyCustomTexture(width, height, BindFlags.RenderTarget | BindFlags.ShaderResource, Format.R8G8B8A8_Typeless);
            m_rgba8_0.AddView(new MyViewKey {
                Fmt = Format.R8G8B8A8_UNorm, View = MyViewEnum.RtvView
            });
            m_rgba8_0.AddView(new MyViewKey {
                Fmt = Format.R8G8B8A8_UNorm_SRgb, View = MyViewEnum.RtvView
            });
            m_rgba8_0.AddView(new MyViewKey {
                Fmt = Format.R8G8B8A8_UNorm_SRgb, View = MyViewEnum.SrvView
            });

            m_rgba8_1 = new MyRenderTarget(width, height, Format.R8G8B8A8_UNorm_SRgb, 1, 0);
            m_rgba8_2 = new MyRenderTarget(width, height, Format.R8G8B8A8_UNorm_SRgb, 1, 0);
            if (samples > 1)
            {
                m_rgba8_ms = new MyRenderTarget(width, height, Format.R8G8B8A8_UNorm_SRgb, samples, 0);
            }
            m_prevLum = new MyUnorderedAccessTexture(1, 1, Format.R32G32_Float);

            Debug.Assert(PostProcessedShadows == RwTexId.NULL);
            Debug.Assert(CascadesHelper == RwTexId.NULL);
            PostProcessedShadows = MyRwTextures.CreateUavRenderTarget(width, height, Format.R8_UNorm);
            CascadesHelper       = MyRwTextures.CreateRenderTarget(width, height, Format.R8_UNorm);

            m_gbuffer1Copy = MyRwTextures.CreateScratch2D(width, height, Format.R8G8B8A8_UNorm, samples, 0, "gbuffer 1 copy");
        }
        internal static void SetupOIT(MyUnorderedAccessTexture accumTarget, MyUnorderedAccessTexture coverageTarget)
        {
            RC.SetupScreenViewport();
            RC.SetBS(MyRender11.BlendWeightedTransparency);
            MyRender11.DeviceContext.ClearRenderTargetView(accumTarget.m_RTV, SharpDX.Color4.Black);
            MyRender11.DeviceContext.ClearRenderTargetView(coverageTarget.m_RTV, SharpDX.Color4.White);

            if (MyRender11.MultisamplingEnabled)
                RC.BindDepthRT(MyScreenDependants.m_resolvedDepth, DepthStencilAccess.ReadOnly, accumTarget, coverageTarget);
            else RC.BindDepthRT(MyGBuffer.Main.DepthStencil, DepthStencilAccess.ReadOnly, accumTarget, coverageTarget);
        }
        internal static void Render(MyUnorderedAccessTexture accumTarget, MyUnorderedAccessTexture coverageTarget)
        {
            ProfilerShort.Begin("Billboards");
            MyGpuProfiler.IC_BeginBlock("Billboards");
            if (MyRender11.MultisamplingEnabled)
            {
                MyBillboardRenderer.Render(MyGBuffer.Main.Get(MyGbufferSlot.LBuffer), MyScreenDependants.m_resolvedDepth, MyScreenDependants.m_resolvedDepth.Depth);
            }
            else
            {
                MyBillboardRenderer.Render(MyGBuffer.Main.Get(MyGbufferSlot.LBuffer), MyGBuffer.Main.DepthStencil, MyGBuffer.Main.DepthStencil.Depth);
            }
            MyGpuProfiler.IC_EndBlock();

            // setup weighted blended OIT targets + blend states
            if (MyRender11.DebugOverrides.OIT)
                SetupOIT(accumTarget, coverageTarget);
            else SetupStandard();

            ProfilerShort.BeginNextBlock("GPU Particles");
            MyGpuProfiler.IC_BeginBlock("GPU Particles");
            if (MyRender11.DebugOverrides.GPUParticles)
            {
                if (MyRender11.MultisamplingEnabled)
                {
                    MyGPUParticleRenderer.Run(MyScreenDependants.m_resolvedDepth.Depth);
                }
                else
                {
                    MyGPUParticleRenderer.Run(MyGBuffer.Main.DepthStencil.Depth);
                }
            }
            MyGpuProfiler.IC_EndBlock();

            // resolve weighted blended OIT in  accum / coverage to LBuffer
            if (MyRender11.DebugOverrides.OIT)
                ResolveOIT(accumTarget, coverageTarget);

            ProfilerShort.BeginNextBlock("Atmosphere");
            MyGpuProfiler.IC_BeginBlock("Atmosphere");
            if (MyRender11.DebugOverrides.Atmosphere)
                MyAtmosphereRenderer.Render();
            MyGpuProfiler.IC_EndBlock();

            ProfilerShort.BeginNextBlock("Clouds");
            MyGpuProfiler.IC_BeginBlock("Clouds");
            if (MyRender11.DebugOverrides.Clouds)
                MyCloudRenderer.Render();
            MyGpuProfiler.IC_EndBlock();

            ProfilerShort.End();
        }
        internal static void CreateScreenResources()
        {
            var width = m_resolution.X;
            var height = m_resolution.Y;
            var samples = RenderSettings.AntialiasingMode.SamplesCount();

            MyUtils.Init(ref MyGBuffer.Main);
            MyGBuffer.Main.Resize(width, height, samples, 0);

            MyScreenDependants.Resize(width, height, samples, 0);

            RemoveScreenResources();

            m_reduce0 = new MyUnorderedAccessTexture(width, height, Format.R32G32_Float);
            m_reduce0.SetDebugName("reduce0");
            m_reduce1 = new MyUnorderedAccessTexture(width, height, Format.R32G32_Float);
            m_reduce1.SetDebugName("reduce1");
            m_uav3 = new MyUnorderedAccessTexture(width, height, MyGBuffer.LBufferFormat);

            m_transparencyAccum = new MyUnorderedAccessTexture(width, height, Format.R16G16B16A16_Float);
            m_transparencyCoverage = new MyUnorderedAccessTexture(width, height, Format.R8_UNorm);

            HalfScreenUavHDR = new MyUnorderedAccessTexture(width / 2, height / 2, MyGBuffer.LBufferFormat);
            QuarterScreenUavHDR = new MyUnorderedAccessTexture(width / 4, height / 4, MyGBuffer.LBufferFormat);
            EighthScreenUavHDR = new MyUnorderedAccessTexture(width / 8, height / 8, MyGBuffer.LBufferFormat);
            EighthScreenUavHDRHelper = new MyUnorderedAccessTexture(width / 8, height / 8, MyGBuffer.LBufferFormat);

            m_rgba8_linear = new MyUnorderedAccessTexture(width, height, Format.R8G8B8A8_UNorm);

            m_rgba8_0 = new MyCustomTexture(width, height, BindFlags.RenderTarget | BindFlags.ShaderResource, Format.R8G8B8A8_Typeless);
            m_rgba8_0.AddView(new MyViewKey { Fmt = Format.R8G8B8A8_UNorm, View = MyViewEnum.RtvView });
            m_rgba8_0.AddView(new MyViewKey { Fmt = Format.R8G8B8A8_UNorm_SRgb, View = MyViewEnum.RtvView });
            m_rgba8_0.AddView(new MyViewKey { Fmt = Format.R8G8B8A8_UNorm_SRgb, View = MyViewEnum.SrvView });

            m_rgba8_1 = new MyRenderTarget(width, height, Format.R8G8B8A8_UNorm_SRgb, 1, 0);
            m_rgba8_2 = new MyRenderTarget(width, height, Format.R8G8B8A8_UNorm_SRgb, 1, 0);
            if (samples > 1)
            {
                m_rgba8_ms = new MyRenderTarget(width, height, Format.R8G8B8A8_UNorm_SRgb, samples, 0);
            }
            m_prevLum = new MyUnorderedAccessTexture(1, 1, Format.R32G32_Float);

            Debug.Assert(PostProcessedShadows == RwTexId.NULL);
            Debug.Assert(CascadesHelper == RwTexId.NULL);
            PostProcessedShadows = MyRwTextures.CreateUavRenderTarget(width, height, Format.R8_UNorm);
            CascadesHelper = MyRwTextures.CreateRenderTarget(width, height, Format.R8_UNorm);

            Gbuffer1Copy = new MyUnorderedAccessTexture(width, height, Format.R10G10B10A2_UNorm, samples, 0, "Gbuffer1Copy");
        }
Ejemplo n.º 9
0
        internal static void SetupOIT(MyUnorderedAccessTexture accumTarget, MyUnorderedAccessTexture coverageTarget)
        {
            RC.SetupScreenViewport();
            RC.SetBS(MyRender11.BlendWeightedTransparency);
            MyRender11.DeviceContext.ClearRenderTargetView(accumTarget.m_RTV, SharpDX.Color4.Black);
            MyRender11.DeviceContext.ClearRenderTargetView(coverageTarget.m_RTV, SharpDX.Color4.White);

            if (MyRender11.MultisamplingEnabled)
            {
                RC.BindDepthRT(MyScreenDependants.m_resolvedDepth, DepthStencilAccess.ReadOnly, accumTarget, coverageTarget);
            }
            else
            {
                RC.BindDepthRT(MyGBuffer.Main.DepthStencil, DepthStencilAccess.ReadOnly, accumTarget, coverageTarget);
            }
        }
Ejemplo n.º 10
0
        internal static void Resize(int width, int height, int samplesNum, int samplesQuality)
        {
            if (m_resolvedDepth != null) {
                m_resolvedDepth.Release();
                m_particlesRT.Release();
                m_ambientOcclusion.Release();
                m_test.Release();
                m_tileIndexes.Release();
            }

            m_resolvedDepth = new MyDepthStencil(width, height, 1, 0);
            m_particlesRT = new MyRenderTarget(width, height, Format.R16G16B16A16_Float, 1, 0);
            m_ambientOcclusion = new MyRenderTarget(width, height, Format.R8G8B8A8_UNorm, 1, 0);
            m_test = new MyUnorderedAccessTexture(width, height, Format.R8G8B8A8_UNorm);
            
            int tilesNum = ((width + MyLightRendering.TILE_SIZE - 1) / MyLightRendering.TILE_SIZE) * ((height + MyLightRendering.TILE_SIZE - 1) / MyLightRendering.TILE_SIZE);
            TilesNum = tilesNum;
            TilesX = (width + MyLightRendering.TILE_SIZE - 1) / MyLightRendering.TILE_SIZE;
            m_tileIndexes = new MyRWStructuredBuffer(tilesNum + tilesNum * MyRender11Constants.MAX_POINT_LIGHTS, sizeof(uint));
        }
Ejemplo n.º 11
0
        internal static void Resize(int width, int height, int samplesNum, int samplesQuality)
        {
            if (m_resolvedDepth != null)
            {
                m_resolvedDepth.Release();
                m_particlesRT.Release();
                m_ambientOcclusion.Release();
                m_test.Release();
                m_tileIndexes.Release();
            }

            m_resolvedDepth    = new MyDepthStencil(width, height, 1, 0);
            m_particlesRT      = new MyRenderTarget(width, height, Format.R16G16B16A16_Float, 1, 0);
            m_ambientOcclusion = new MyRenderTarget(width, height, Format.R8G8B8A8_UNorm, 1, 0);
            m_test             = new MyUnorderedAccessTexture(width, height, Format.R8G8B8A8_UNorm);

            int tilesNum = ((width + MyLightRendering.TILE_SIZE - 1) / MyLightRendering.TILE_SIZE) * ((height + MyLightRendering.TILE_SIZE - 1) / MyLightRendering.TILE_SIZE);

            TilesNum      = tilesNum;
            TilesX        = (width + MyLightRendering.TILE_SIZE - 1) / MyLightRendering.TILE_SIZE;
            m_tileIndexes = new MyRWStructuredBuffer(tilesNum + tilesNum * MyRender11Constants.MAX_POINT_LIGHTS, sizeof(uint));
        }
Ejemplo n.º 12
0
        internal static void CreateScreenResources()
        {
            var width = m_resolution.X;
            var height = m_resolution.Y;
            var samples = RenderSettings.AntialiasingMode.SamplesCount();

            if(MyGBuffer.Main == null)
            {
                MyGBuffer.Main = new MyGBuffer();
            }
            MyGBuffer.Main.Resize(width, height, samples, 0);

            MyScreenDependants.Resize(width, height, samples, 0);

            RemoveScreenResources();

            m_resolvedLight = new MyRenderTarget(width, height, Format.R11G11B10_Float, 1, 0);
            m_reduce0 = new MyUnorderedAccessTexture(width, height, Format.R32_Float);
            m_reduce0.SetDebugName("reduce0");
            m_reduce1 = new MyUnorderedAccessTexture(width, height, Format.R32_Float);
            m_reduce1.SetDebugName("reduce1");
            m_uav3 = new MyUnorderedAccessTexture(width, height, Format.R11G11B10_Float);

            m_localLum = new MyUnorderedAccessTexture(
                (width + MyLuminanceAverage.NumThreads - 1) / MyLuminanceAverage.NumThreads,
                (height + MyLuminanceAverage.NumThreads - 1) / MyLuminanceAverage.NumThreads,
                Format.R32_Float);

            m_div2 = new MyUnorderedAccessTexture(width / 2, height / 2, Format.R11G11B10_Float);
            m_div4 = new MyUnorderedAccessTexture(width / 4, height / 4, Format.R11G11B10_Float);
            m_div8 = new MyUnorderedAccessTexture(width / 8, height / 8, Format.R11G11B10_Float);
            m_div8_1 = new MyUnorderedAccessTexture(width / 8, height / 8, Format.R11G11B10_Float);

            m_rgba8_linear = new MyUnorderedAccessTexture(width, height, Format.R8G8B8A8_UNorm);

            m_rgba8_0 = new MyCustomTexture(width, height, BindFlags.RenderTarget | BindFlags.ShaderResource, Format.R8G8B8A8_Typeless);
            m_rgba8_0.AddView(new MyViewKey { Fmt = Format.R8G8B8A8_UNorm, View = MyViewEnum.RtvView });
            m_rgba8_0.AddView(new MyViewKey { Fmt = Format.R8G8B8A8_UNorm_SRgb, View = MyViewEnum.SrvView });

            m_rgba8_1 = new MyRenderTarget(width, height, Format.R8G8B8A8_UNorm_SRgb, 1, 0);
            m_prevLum = new MyUnorderedAccessTexture(1, 1, Format.R32_Float);

            Debug.Assert(m_shadowsHelper == RwTexId.NULL);
            m_shadowsHelper = MyRwTextures.CreateUav2D(width, height, Format.R8_UNorm, "cascade shadows gather");
            m_shadowsHelper1 = MyRwTextures.CreateUav2D(width, height, Format.R8_UNorm, "cascade shadows gather 2");
        }
        internal static void Render(MyUnorderedAccessTexture accumTarget, MyUnorderedAccessTexture coverageTarget)
        {
            ProfilerShort.Begin("Atmosphere");
            MyGpuProfiler.IC_BeginBlock("Atmosphere");
            if (MyRender11.DebugOverrides.Atmosphere)
            {
                MyAtmosphereRenderer.Render();
            }
            MyGpuProfiler.IC_EndBlock();

            ProfilerShort.BeginNextBlock("Clouds");
            MyGpuProfiler.IC_BeginBlock("Clouds");
            if (MyRender11.DebugOverrides.Clouds)
            {
                MyCloudRenderer.Render();
            }
            MyGpuProfiler.IC_EndBlock();

            // setup weighted blended OIT targets + blend states
            if (MyRender11.DebugOverrides.OIT)
            {
                SetupOIT(accumTarget, coverageTarget, true);
            }
            else
            {
                SetupStandard();
            }

            MyDepthStencil depthResource;

            if (MyRender11.MultisamplingEnabled)
            {
                depthResource = MyScreenDependants.m_resolvedDepth;
            }
            else
            {
                depthResource = MyGBuffer.Main.DepthStencil;
            }

            ProfilerShort.BeginNextBlock("Billboards");
            MyGpuProfiler.IC_BeginBlock("Billboards");
            MyBillboardRenderer.Render(depthResource.Depth);
            MyGpuProfiler.IC_EndBlock();

            ProfilerShort.BeginNextBlock("GPU Particles");
            MyGpuProfiler.IC_BeginBlock("GPU Particles");
            if (MyRender11.DebugOverrides.GPUParticles)
            {
                MyGPUParticleRenderer.Run(depthResource.Depth);
            }
            MyGpuProfiler.IC_EndBlock();

            ProfilerShort.BeginNextBlock("Billboards - Depth Only");
            MyGpuProfiler.IC_BeginBlock("Billboards - Depth Only");
            bool windowsFound = MyBillboardRenderer.RenderWindowsDepthOnly(depthResource, MyRender11.Gbuffer1Copy);

            MyGpuProfiler.IC_EndBlock();

            if (MyRender11.DebugOverrides.OIT && windowsFound)
            {
                SetupOIT(accumTarget, coverageTarget, false);
            }

            ProfilerShort.BeginNextBlock("Render decals - Transparent");
            MyGpuProfiler.IC_BeginBlock("Render decals - Transparent");
            MyScreenDecals.Draw(true);
            MyGpuProfiler.IC_EndBlock();

            MyGpuProfiler.IC_BeginBlock("OIT Resolve");
            // resolve weighted blended OIT in  accum / coverage to LBuffer
            if (MyRender11.DebugOverrides.OIT)
            {
                ResolveOIT(accumTarget, coverageTarget);
            }
            MyGpuProfiler.IC_EndBlock();

            ProfilerShort.End();
        }
Ejemplo n.º 14
0
        internal static void Render(MyUnorderedAccessTexture accumTarget, MyUnorderedAccessTexture coverageTarget)
        {
            ProfilerShort.Begin("Billboards");
            MyGpuProfiler.IC_BeginBlock("Billboards");
            if (MyRender11.MultisamplingEnabled)
            {
                MyBillboardRenderer.Render(MyGBuffer.Main.Get(MyGbufferSlot.LBuffer), MyScreenDependants.m_resolvedDepth, MyScreenDependants.m_resolvedDepth.Depth);
            }
            else
            {
                MyBillboardRenderer.Render(MyGBuffer.Main.Get(MyGbufferSlot.LBuffer), MyGBuffer.Main.DepthStencil, MyGBuffer.Main.DepthStencil.Depth);
            }
            MyGpuProfiler.IC_EndBlock();

            // setup weighted blended OIT targets + blend states
            if (MyRender11.DebugOverrides.OIT)
            {
                SetupOIT(accumTarget, coverageTarget);
            }
            else
            {
                SetupStandard();
            }

            ProfilerShort.BeginNextBlock("GPU Particles");
            MyGpuProfiler.IC_BeginBlock("GPU Particles");
            if (MyRender11.DebugOverrides.GPUParticles)
            {
                if (MyRender11.MultisamplingEnabled)
                {
                    MyGPUParticleRenderer.Run(MyScreenDependants.m_resolvedDepth.Depth);
                }
                else
                {
                    MyGPUParticleRenderer.Run(MyGBuffer.Main.DepthStencil.Depth);
                }
            }
            MyGpuProfiler.IC_EndBlock();

            // resolve weighted blended OIT in  accum / coverage to LBuffer
            if (MyRender11.DebugOverrides.OIT)
            {
                ResolveOIT(accumTarget, coverageTarget);
            }

            ProfilerShort.BeginNextBlock("Atmosphere");
            MyGpuProfiler.IC_BeginBlock("Atmosphere");
            if (MyRender11.DebugOverrides.Atmosphere)
            {
                MyAtmosphereRenderer.Render();
            }
            MyGpuProfiler.IC_EndBlock();

            ProfilerShort.BeginNextBlock("Clouds");
            MyGpuProfiler.IC_BeginBlock("Clouds");
            if (MyRender11.DebugOverrides.Clouds)
            {
                MyCloudRenderer.Render();
            }
            MyGpuProfiler.IC_EndBlock();

            ProfilerShort.End();
        }