@@ -278,6 +278,7 @@ pub struct VulkanEngine<'a> {
278278 video_state : Option < VideoState > ,
279279 clear_black_pipeline : wgpu:: RenderPipeline ,
280280 crt_background_pipeline : wgpu:: RenderPipeline ,
281+ biolum_bg_pipeline : wgpu:: RenderPipeline ,
281282
282283 // 3D Engine Extensions
283284 camera_uniform_buffer : wgpu:: Buffer ,
@@ -1139,6 +1140,67 @@ impl<'a> VulkanEngine<'a> {
11391140 cache : None ,
11401141 } ) ;
11411142
1143+ let solid_biolum_bg_shader = device. create_shader_module ( wgpu:: ShaderModuleDescriptor {
1144+ label : Some ( "Solid Biolum BG Shader" ) ,
1145+ source : wgpu:: ShaderSource :: Wgsl ( std:: borrow:: Cow :: Borrowed ( r#"
1146+ struct VertexOutput {
1147+ @builtin(position) clip_position: vec4<f32>,
1148+ }
1149+ @vertex
1150+ fn vs_main(@builtin(vertex_index) in_vertex_index: u32) -> VertexOutput {
1151+ var out: VertexOutput;
1152+ let x = f32((in_vertex_index << 1u) & 2u) * 2.0 - 1.0;
1153+ let y = f32(in_vertex_index & 2u) * 2.0 - 1.0;
1154+ out.clip_position = vec4<f32>(x, y, 1.0, 1.0);
1155+ return out;
1156+ }
1157+ @fragment
1158+ fn fs_main() -> @location(0) vec4<f32> {
1159+ return vec4<f32>(0.001, 0.003, 0.008, 1.0);
1160+ }
1161+ "# ) ) ,
1162+ } ) ;
1163+
1164+ let biolum_bg_pipeline = device. create_render_pipeline ( & wgpu:: RenderPipelineDescriptor {
1165+ label : Some ( "Biolum BG Pipeline" ) ,
1166+ layout : Some ( & clear_black_layout) ,
1167+ vertex : wgpu:: VertexState {
1168+ module : & solid_biolum_bg_shader,
1169+ entry_point : Some ( "vs_main" ) ,
1170+ buffers : & [ ] ,
1171+ compilation_options : wgpu:: PipelineCompilationOptions :: default ( ) ,
1172+ } ,
1173+ fragment : Some ( wgpu:: FragmentState {
1174+ module : & solid_biolum_bg_shader,
1175+ entry_point : Some ( "fs_main" ) ,
1176+ targets : & [ Some ( wgpu:: ColorTargetState {
1177+ format : config. format ,
1178+ blend : Some ( wgpu:: BlendState :: REPLACE ) ,
1179+ write_mask : wgpu:: ColorWrites :: ALL ,
1180+ } ) ] ,
1181+ compilation_options : wgpu:: PipelineCompilationOptions :: default ( ) ,
1182+ } ) ,
1183+ primitive : wgpu:: PrimitiveState {
1184+ topology : wgpu:: PrimitiveTopology :: TriangleList ,
1185+ strip_index_format : None ,
1186+ front_face : wgpu:: FrontFace :: Ccw ,
1187+ cull_mode : None ,
1188+ polygon_mode : wgpu:: PolygonMode :: Fill ,
1189+ unclipped_depth : false ,
1190+ conservative : false ,
1191+ } ,
1192+ depth_stencil : Some ( wgpu:: DepthStencilState {
1193+ format : wgpu:: TextureFormat :: Depth32Float ,
1194+ depth_write_enabled : Some ( true ) ,
1195+ depth_compare : Some ( wgpu:: CompareFunction :: Always ) ,
1196+ stencil : wgpu:: StencilState :: default ( ) ,
1197+ bias : wgpu:: DepthBiasState :: default ( ) ,
1198+ } ) ,
1199+ multisample : wgpu:: MultisampleState :: default ( ) ,
1200+ multiview_mask : None ,
1201+ cache : None ,
1202+ } ) ;
1203+
11421204 let crt_background_shader_src = resolve_shader_includes ( r#"
11431205 // INCLUDE: common
11441206
@@ -1998,6 +2060,7 @@ impl<'a> VulkanEngine<'a> {
19982060 video_state : None ,
19992061 clear_black_pipeline,
20002062 crt_background_pipeline,
2063+ biolum_bg_pipeline,
20012064
20022065 camera_uniform_buffer,
20032066 camera_bind_group,
@@ -4101,11 +4164,7 @@ impl<'a> VulkanEngine<'a> {
41014164 resolve_target : None ,
41024165 depth_slice : None ,
41034166 ops : wgpu:: Operations {
4104- load : wgpu:: LoadOp :: Clear ( if vis_def. id == 19 {
4105- wgpu:: Color { r : 0.001 , g : 0.003 , b : 0.008 , a : 1.0 }
4106- } else {
4107- wgpu:: Color { r : 0.1 , g : 0.1 , b : 0.1 , a : 1.0 }
4108- } ) ,
4167+ load : wgpu:: LoadOp :: Clear ( wgpu:: Color { r : 0.1 , g : 0.1 , b : 0.1 , a : 1.0 } ) ,
41094168 store : wgpu:: StoreOp :: Store ,
41104169 } ,
41114170 } ) ] ,
@@ -4157,6 +4216,9 @@ impl<'a> VulkanEngine<'a> {
41574216 if vis_def. id == 11 {
41584217 render_pass. set_pipeline ( & self . clear_black_pipeline ) ;
41594218 render_pass. draw ( 0 ..3 , 0 ..1 ) ;
4219+ } else if vis_def. id == 19 {
4220+ render_pass. set_pipeline ( & self . biolum_bg_pipeline ) ;
4221+ render_pass. draw ( 0 ..3 , 0 ..1 ) ;
41604222 } else if vis_def. id == 17 {
41614223 render_pass. set_pipeline ( & self . crt_background_pipeline ) ;
41624224 render_pass. set_bind_group ( 0 , & self . uniform_bind_group , & [ ] ) ;
0 commit comments