internal unsafe static void AllocateLuts(ref AtmosphereLuts luts)
 {
     if (luts.TransmittanceLut == RwTexId.NULL)
     {
         luts.TransmittanceLut = MyRwTextures.CreateUav2D(512, 128, SharpDX.DXGI.Format.R32G32_Float);
     }
 }
Beispiel #2
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 unsafe static void AllocateLuts(ref AtmosphereLuts luts)
 {
     if (luts.TransmittanceLut == RwTexId.NULL)
     {
         luts.TransmittanceLut = MyRwTextures.CreateUav2D(256, 64, SharpDX.DXGI.Format.R16G16B16A16_Float);
         luts.InscatterLut     = MyRwTextures.CreateUav3D(32, 128, 32 * 8, SharpDX.DXGI.Format.R16G16B16A16_Float);
     }
 }