use crate::renderer::buffers::Vertex; pub struct RaytracePass { pub pipeline: wgpu::RenderPipeline } impl RaytracePass { pub fn new(device: &wgpu::Device, swapchain_desc: &wgpu::SwapChainDescriptor, bind_group_layouts: &[&wgpu::BindGroupLayout]) -> Self { // Pipeline stuff let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { label: Some("Render Pipeline Layout"), bind_group_layouts: bind_group_layouts, push_constant_ranges: &[], }); let vert_state = wgpu::VertexState { //vert module: &device.create_shader_module(&wgpu::include_spirv!("..\\..\\shaders\\bin\\shader.vert.spv")), entry_point: "main", buffers: &[Vertex::desc()], }; let frag_state = wgpu::FragmentState { // frag module: &device.create_shader_module(&wgpu::include_spirv!("..\\..\\shaders\\bin\\shader.frag.spv")), entry_point: "main", targets: &[wgpu::ColorTargetState { format: swapchain_desc.format, alpha_blend: wgpu::BlendState::REPLACE, color_blend: wgpu::BlendState::REPLACE, write_mask: wgpu::ColorWrite::ALL, }], }; let prim_state = wgpu::PrimitiveState { // primitive topology: wgpu::PrimitiveTopology::TriangleList, strip_index_format: None, front_face: wgpu::FrontFace::Cw, cull_mode: wgpu::CullMode::Back, polygon_mode: wgpu::PolygonMode::Fill, }; let multisample_state = wgpu::MultisampleState { // multisample count: 1, mask: !0, alpha_to_coverage_enabled: false, }; // Create pipeline let pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor { label: Some("Render Pipeline"), layout: Some(&pipeline_layout), vertex: vert_state, fragment: Some(frag_state), primitive: prim_state, depth_stencil: None, multisample: multisample_state, }); Self { pipeline } } }