Ejemplo n.º 1
0
        private static void Window_Render(double time_ms, double delta_ms)
        {
            //Acquire the frame
            GraphicsDevice.AcquireFrame();

            graph.QueueOp(new GpuOp()
            {
                ColorAttachments = new string[] { GraphicsDevice.DefaultFramebuffer[GraphicsDevice.CurrentFrameID].ColorAttachments[0].Name },
                DepthAttachment  = null,
                PassName         = "main_pass",
                Resources        = new GpuResourceRequest[]
                {
                    new GpuResourceRequest()
                    {
                        Name           = GraphicsDevice.DefaultFramebuffer[GraphicsDevice.CurrentFrameID].ColorAttachments[0].Name,
                        Accesses       = AccessFlags.None,
                        DesiredLayout  = ImageLayout.Undefined,
                        FirstLoadStage = PipelineStage.ColorAttachOut,
                        LastStoreStage = PipelineStage.ColorAttachOut,
                        Stores         = AccessFlags.ColorAttachmentWrite,
                    }
                },
                Cmd         = GpuCmd.Draw,
                VertexCount = 3,
            });

            graph.Build();
            GraphicsDevice.PresentFrame();
        }
Ejemplo n.º 2
0
        private static void Engine_OnRender(double time_ms, double delta_ms)
        {
            //Acquire the frame
            GraphicsDevice.AcquireFrame();

            if (buildGeometry)
            {
                Engine.RenderGraph.QueueOp(new GpuOp()
                {
                    PassName  = "ray_build_pass",
                    Resources = new string[] {
                        geometry.ScratchBuffer.Name,
                        geometry.BuiltGeometryBuffer.Name,
                        vertexBuffer.LocalBuffer.Name,
                        indexBuffer.LocalBuffer.Name,
                    },
                    RRGeometry      = geometry,
                    RRIntersections = rayIntersections,
                    Cmd             = GpuCmd.Build,
                });
                buildGeometry = false;
            }
            else
            {
                buildGeometry = true;
                Engine.RenderGraph.QueueOp(new GpuOp()
                {
                    PassName  = "ray_intersect_pass",
                    Resources = new string[] {
                        rayIntersections.ScratchBuffer.Name,
                        geometry.BuiltGeometryBuffer.Name,
                        rayIntersections.RayBuffer.LocalBuffer.Name,
                        rayIntersections.HitBuffer.LocalBuffer.Name,
                    },
                    RRGeometry      = geometry,
                    RRIntersections = rayIntersections,
                    Cmd             = GpuCmd.Intersect,
                });
            }

            Engine.RenderGraph.QueueOp(new GpuOp()
            {
                ColorAttachments = new string[] { GraphicsDevice.DefaultFramebuffer[GraphicsDevice.CurrentFrameID].ColorAttachments[0].Name },
                DepthAttachment  = depthImageViews[GraphicsDevice.CurrentFrameID].Name,
                PassName         = "main_pass",
                Resources        = new string[] {
                    Engine.GlobalParameters.Name,
                    rayIntersections.HitBuffer.LocalBuffer.Name,
                    //rayIntersections.RayBuffer.LocalBuffer.Name,
                },
                Cmd         = GpuCmd.Draw,
                VertexCount = 3,
            });

            Engine.RenderGraph.Build();

            GraphicsDevice.PresentFrame();
        }
Ejemplo n.º 3
0
        private static void Engine_OnRender(double time_ms, double delta_ms)
        {
            //Acquire the frame
            GraphicsDevice.AcquireFrame();

            heightMap.Generate();
            Engine.RenderGraph.QueueOp(new GpuOp()
            {
                ColorAttachments = new string[] { GraphicsDevice.DefaultFramebuffer[GraphicsDevice.CurrentFrameID].ColorAttachments[0].Name },
                DepthAttachment  = depthImageViews[GraphicsDevice.CurrentFrameID].Name,
                PassName         = "main_pass",
                Resources        = new string[] {
                    Engine.GlobalParameters.Name,
                },
                Cmd         = GpuCmd.Draw,
                VertexCount = 3,
            });
            Engine.RenderGraph.Build();

            GraphicsDevice.PresentFrame();
        }