示例#1
0
        public override void Init()
        {
            base.Init();

            GenerateQuad();

            var shader = Resources.Load <Shader>("shaders/raytracing.shader");

            storageTex    = Texture.CreateStorage(2048, 2048, VkFormat.R8G8B8A8SNorm);
            uniformBuffer = new SharedBuffer(VkBufferUsageFlags.UniformBuffer, (uint)Utilities.SizeOf <UboCompute>());

            material = new Material(shader);
            material.SetTexture("samplerColor", storageTex);

            computePipeline    = shader.GetPass("Compute");
            computeResourceSet = new DescriptorSet(computePipeline.PipelineLayout.ResourceLayout[0], storageTex, uniformBuffer);

            renderer.AddComputePass(Docompute);
            renderer.AddGraphicsPass(DrawQuad);

            MainView.Attach(null, null, renderer);
        }