示例#1
0
        public override void Record(GraphicsContext context, ref Resolver resolver)
        {
            var resources = resolver.GetComponent <PipelineResources>();

            var sceneColor = resolver.ResolveResource(resources.SceneColor);

            context.Barrier(ResourceBarrier.Transition(_output.OutputBuffer, ResourceState.Present, ResourceState.CopyDestination));
            context.CopyResource(sceneColor, _output.OutputBuffer);
            context.Barrier(ResourceBarrier.Transition(_output.OutputBuffer, ResourceState.CopyDestination, ResourceState.Present));
        }
示例#2
0
        public override void Record(GraphicsContext context, ref Resolver resolver)
        {
            using var _ = context.ScopedEvent(Argb32.Green, "Tonemap");

            var resources     = resolver.GetComponent <PipelineResources>();
            var sampledOutput = resolver.ResolveResource(resources.SampledOutput);

            context.Barrier(ResourceBarrier.Transition(_output.OutputBuffer, ResourceState.Present, ResourceState.CopyDestination));
            context.CopyResource(sampledOutput, _output.OutputBuffer);
            context.Barrier(ResourceBarrier.Transition(_output.OutputBuffer, ResourceState.CopyDestination, ResourceState.Present));
        }
示例#3
0
        public ResourceBarrier CreateTransition(ResourceState state, ResourceBarrierOptions options)
        {
            ResourceBarrier barrier;

            if (Desc.Type == ResourceType.Buffer)
            {
                barrier = ResourceBarrier.Transition(Desc.Buffer, CurrentTrackedState, state, options);
            }
            else
            {
                barrier = ResourceBarrier.Transition(Desc.Texture, CurrentTrackedState, state, uint.MaxValue, options);
            }

            CurrentTrackedState = state;
            return(barrier);
        }
示例#4
0
        public override void Render()
        {
            var context = _device.BeginGraphicsContext(_pso);

            using (context.ScopedBarrier(ResourceBarrier.Transition(_output.OutputBuffer, ResourceState.Present, ResourceState.RenderTarget)))
            {
                context.SetViewportAndScissor(_output.Resolution);
                context.SetRenderTarget(_output.OutputBufferView);
                context.SetTopology(Topology.TriangleList);
                context.SetShaderResourceBuffer(0, _colors);
                context.SetRoot32BitConstants(1, _constants);
                context.Draw(3);
            }

            context.Close();
            _device.Execute(context).Block();
            _output.Present();
        }
示例#5
0
        public override void Record(GraphicsContext context, ref Resolver resolver)
        {
            using var _ = context.ScopedEvent(Argb32.Green, "Tonemap");

            var color    = default(TextureHandle);//builder.GetInput<TextureHandle>();
            var settings = resolver.GetComponent <RenderSettings>();

            var sampledOutput = resolver.ResolveResource(color);

            using (context.ScopedBarrier(ResourceBarrier.Transition(_output.OutputBuffer, ResourceState.Present, settings.Msaa.IsMultiSampled ? ResourceState.ResolveDestination : ResourceState.CopyDestination)))
            {
                if (settings.Msaa.IsMultiSampled)
                {
                    context.ResolveSubresource(sampledOutput, _output.OutputBuffer);
                }
                else
                {
                    context.CopyResource(sampledOutput, _output.OutputBuffer);
                }
            }
        }