コード例 #1
0
        public override bool Register(ref RenderPassBuilder builder, ref Resolver resolver)
        {
            var resources = new PipelineResources();
            var settings  = resolver.GetComponent <PipelineSettings>();

            resources.SceneColor = builder.CreatePrimaryOutputRelativeTexture(
                TextureDesc.CreateRenderTargetDesc(DataFormat.R8G8B8A8UnsignedNormalized, Rgba128.CornflowerBlue, settings.Msaa),
                ResourceState.RenderTarget,
                debugName: nameof(resources.SceneColor)
                );

            resources.SceneDepth = builder.CreatePrimaryOutputRelativeTexture(
                TextureDesc.CreateDepthStencilDesc(DataFormat.Depth32Single, 1.0f, 0, false, settings.Msaa),
                ResourceState.DepthWrite,
                debugName: nameof(resources.SceneDepth)
                );

            resolver.CreateComponent(resources);

            DefaultPipelineState = settings.Msaa.IsMultiSampled ? _texMsaa8x : _tex;

            var fovAngleY = 70.0f * MathF.PI / 180.0f;

            _frameConstants.Projection = Matrix4x4.CreatePerspectiveFieldOfView(fovAngleY, settings.AspectRatio, 0.001f, 100f);

            return(true);
        }
コード例 #2
0
        public override bool Register(ref RenderPassBuilder builder, ref Resolver resolver)
        {
            if (!IsEnabled)
            {
                return(false);
            }

            var settings  = resolver.GetComponent <RenderSettings>();
            var resources = resolver.GetComponent <RenderResources>();

            builder.CreatePrimaryOutputRelativeTexture(TextureDesc.CreateUnorderedAccessResourceDesc(DataFormat.Unknown, TextureDimension.Tex2D));

            return(true);
        }
コード例 #3
0
ファイル: WorldPass.cs プロジェクト: john-h-k/Voltium
        public override bool Register(ref RenderPassBuilder builder, ref Resolver resolver)
        {
            var settings = resolver.GetComponent <RenderSettings>();

            RenderResources resources;

            resources.SceneColor = builder.CreatePrimaryOutputRelativeTexture(
                TextureDesc.CreateRenderTargetDesc(BackBufferFormat.R8G8B8A8UnsignedNormalized, DefaultSkyColor, settings.Msaa),
                ResourceState.RenderTarget
                );

            resources.SceneDepth = builder.CreatePrimaryOutputRelativeTexture(
                TextureDesc.CreateDepthStencilDesc(DataFormat.Depth32Single, 1, 0, false, settings.Msaa),
                ResourceState.DepthWrite
                );

            resolver.CreateComponent(resources);

            DefaultPipelineState = settings.Msaa.IsMultiSampled ? MsaaPso : Pso;

            builder.SetOutput(resources.SceneColor);

            return(true);
        }
コード例 #4
0
ファイル: MsaaPass.cs プロジェクト: john-h-k/Voltium
        public override bool Register(ref RenderPassBuilder builder, ref Resolver resolver)
        {
            var resources = resolver.GetComponent <PipelineResources>();
            var settings  = resolver.GetComponent <PipelineSettings>();

            if (settings.Msaa.IsMultiSampled)
            {
                resources.SampledOutput = builder.CreatePrimaryOutputRelativeTexture(
                    TextureDesc.CreateRenderTargetDesc(DataFormat.R8G8B8A8UnsignedNormalized, Rgba128.CornflowerBlue),
                    ResourceState.ResolveDestination,
                    debugName: nameof(resources.SampledOutput)
                    );

                resolver.SetComponent(resources);
                builder.MarkUsage(resources.SceneColor, ResourceState.ResolveSource);
                return(true);
            }
            else
            {
                resolver.SetComponent(resources);
                resources.SampledOutput = resources.SceneColor;
                return(false);
            }
        }