/// <summary> /// Create a new Pipeline with supplied PipelineLayout /// </summary> public ComputePipeline(PipelineLayout layout, string spirvPath, PipelineCache cache = null, string name = "pipeline") : base(layout.Dev, cache, name) { SpirVPath = spirvPath; this.layout = layout; Activate(); }
/// <summary> /// Create and activate a new pipeline for supplied render pass. /// </summary> /// <param name="renderPass">a managed Render pass that will be activated (if not already) during the pipeline creation.</param> /// <param name="cache">an optional pipeline cache to speed up pipeline creation.</param> /// <param name="name">an optionnal name that will be used by the debug utils extension if enabled.</param> protected GraphicPipeline(RenderPass renderPass, PipelineCache cache = null, string name = "graphic pipeline") : base(renderPass.Dev, cache, name) { RenderPass = renderPass; }
public EnvironmentCube(string cubemapPath, DescriptorSet dsSkybox, PipelineLayout plLayout, Queue staggingQ, RenderPass renderPass, PipelineCache cache = null) : base(renderPass, cache, "EnvCube pipeline") { using (CommandPool cmdPool = new CommandPool(staggingQ.Dev, staggingQ.index)) { vboSkybox = new GPUBuffer <float> (staggingQ, cmdPool, VkBufferUsageFlags.VertexBuffer, box_vertices); cubemap = KTX.KTX.Load(staggingQ, cmdPool, cubemapPath, VkImageUsageFlags.Sampled, VkMemoryPropertyFlags.DeviceLocal, true); cubemap.CreateView(VkImageViewType.Cube, VkImageAspectFlags.Color); cubemap.CreateSampler(VkSamplerAddressMode.ClampToEdge); cubemap.SetName("skybox Texture"); cubemap.Descriptor.imageLayout = VkImageLayout.ShaderReadOnlyOptimal; GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault(VkPrimitiveTopology.TriangleList, renderPass.Samples, false); cfg.RenderPass = renderPass; cfg.Layout = plLayout; cfg.AddVertexBinding(0, 3 * sizeof(float)); cfg.AddVertexAttributes(0, VkFormat.R32g32b32Sfloat); cfg.AddShader(VkShaderStageFlags.Vertex, "#deferred.skybox.vert.spv"); cfg.AddShader(VkShaderStageFlags.Fragment, "#deferred.skybox.frag.spv"); cfg.multisampleState.rasterizationSamples = Samples; layout = cfg.Layout; init(cfg); generateBRDFLUT(staggingQ, cmdPool); generateCubemaps(staggingQ, cmdPool); } }
public FSQPipeline(RenderPass renderPass, PipelineLayout pipelineLayout, int attachment = 0, PipelineCache pipelineCache = null) : base(renderPass, pipelineCache, "FSQ pipeline") { using (GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault(VkPrimitiveTopology.TriangleList, this.RenderPass.Samples, false)) { cfg.RenderPass = RenderPass; cfg.Layout = pipelineLayout; cfg.AddShader(Dev, VkShaderStageFlags.Vertex, "#vke.FullScreenQuad.vert.spv"); cfg.AddShader(Dev, VkShaderStageFlags.Fragment, FragPath); cfg.multisampleState.rasterizationSamples = Samples; cfg.blendAttachments[attachment] = new VkPipelineColorBlendAttachmentState(true); layout = cfg.Layout; init(cfg); } }
protected Pipeline(Device dev, PipelineCache cache = null, string name = "custom pipeline") : base(dev, name) { this.Cache = cache; }
public ComputePipeline(Device dev, PipelineCache cache = null, string name = "compute pipeline") : base(dev, cache, name) { }
public DebugDrawPipeline(RenderPass renderPass, uint maxVertices = 100, VkSampleCountFlags samples = VkSampleCountFlags.SampleCount1, PipelineCache pipelineCache = null) : base(renderPass, pipelineCache, "Debug draw pipeline") { vboLength = maxVertices * 6 * sizeof(float); using (GraphicPipelineConfig cfg = GraphicPipelineConfig.CreateDefault(VkPrimitiveTopology.LineList, samples, false)) { cfg.rasterizationState.lineWidth = 1.0f; cfg.RenderPass = RenderPass; cfg.Layout = new PipelineLayout(Dev, new VkPushConstantRange(VkShaderStageFlags.Vertex, (uint)Marshal.SizeOf <Matrix4x4> () * 2)); cfg.AddVertexBinding(0, 6 * sizeof(float)); cfg.AddVertexAttributes(0, VkFormat.R32g32b32Sfloat, VkFormat.R32g32b32Sfloat); cfg.blendAttachments[0] = new VkPipelineColorBlendAttachmentState(true); cfg.AddShaders( new ShaderInfo(Dev, VkShaderStageFlags.Vertex, "#vke.debug.vert.spv"), new ShaderInfo(Dev, VkShaderStageFlags.Fragment, "#vke.debug.frag.spv") ); layout = cfg.Layout; init(cfg); } Vertices = new HostBuffer(Dev, VkBufferUsageFlags.VertexBuffer, vboLength); Vertices.Map(); }