File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed
bevy_core_pipeline/src/oit Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 44
55#ifdef OIT_ENABLED
66// Add the fragment to the oit buffer
7- fn oit_draw (position : vec4f , color : vec4f ) -> vec4f {
7+ fn oit_draw (position : vec4f , color : vec4f ) {
88 // get the index of the current fragment relative to the screen size
99 let screen_index = i32 (floor (position . x ) + floor (position . y ) * view . viewport . z );
1010 // get the size of the buffer.
@@ -19,15 +19,14 @@ fn oit_draw(position: vec4f, color: vec4f) -> vec4f {
1919 // accidentally increase the index above the maximum value
2020 atomicStore (& oit_layer_ids [screen_index ], oit_layers_count );
2121 // TODO for tail blending we should return the color here
22- discard ;
22+ return ;
2323 }
2424
2525 // get the layer_index from the screen
2626 let layer_index = screen_index + layer_id * buffer_size ;
2727 let rgb9e5_color = bevy_pbr :: rgb9e5 :: vec3_to_rgb9e5_ (color . rgb );
2828 let depth_alpha = pack_24bit_depth_8bit_alpha (position . z , color . a );
2929 oit_layers [layer_index ] = vec2 (rgb9e5_color , depth_alpha );
30- discard ;
3130}
3231#endif // OIT_ENABLED
3332
Original file line number Diff line number Diff line change @@ -27,7 +27,12 @@ fn fragment(in: FullscreenVertexOutput) -> @location(0) vec4<f32> {
2727 let counter = atomicLoad (& layer_ids [screen_index ]);
2828 if counter == 0 {
2929 reset_indices (screen_index );
30- discard ;
30+
31+ // https://github.com/gfx-rs/wgpu/issues/4416
32+ if true {
33+ discard ;
34+ }
35+ return vec4 (0 .0 );
3136 } else {
3237 let result = sort (screen_index , buffer_size );
3338 reset_indices (screen_index );
Original file line number Diff line number Diff line change @@ -73,8 +73,9 @@ fn fragment(
7373#ifdef OIT_ENABLED
7474 let alpha_mode = pbr_input . material . flags & pbr_types :: STANDARD_MATERIAL_FLAGS_ALPHA_MODE_RESERVED_BITS ;
7575 if alpha_mode != pbr_types :: STANDARD_MATERIAL_FLAGS_ALPHA_MODE_OPAQUE {
76- // This will always return 0.0. The fragments will only be drawn during the oit resolve pass.
77- out . color = oit_draw (in . position , out . color );
76+ // The fragments will only be drawn during the oit resolve pass.
77+ oit_draw (in . position , out . color );
78+ discard ;
7879 }
7980#endif // OIT_ENABLED
8081
You can’t perform that action at this time.
0 commit comments