Repository: bevyengine/bevy
File: examples/app/render_recovery.rs (Rust)

Code before:
                    mip_level_count: 1,
                    sample_count: 1,
                    dimension: TextureDimension::D2,
                    format: TextureFormat::Rgba16Float,
                    usage: TextureUsages::RENDER_ATTACHMENT,
                    view_formats: &[],
                }));
            }
        }
        RenderError::Validation => {
            device.create_buffer(&BufferDescriptor {
                label: None,
                size: 1 << 63,
                usage: BufferUsages::COPY_SRC,
                mapped_at_creation: false,
            });
        }
        RenderError::DeviceLost => {
            device.wgpu_device().destroy();
            device.poll(PollType::wait_indefinitely()).unwrap();
        }
        RenderError::Loop => {
            let sm = device.create_and_validate_shader_module(ShaderModuleDescriptor {
                label: Some("shader"),
                source: ShaderSource::Wgsl(
                    "@compute @workgroup_size(1, 1, 1) fn main() { loop {} }".into(),
                ),
            });

            let pipeline_layout = device.create_pipeline_layout(&PipelineLayoutDescriptor {
                label: Some("pipeline_layout"),
                bind_group_layouts: &[],
                immediate_size: 0,
            });

            let pipeline = device.create_compute_pipeline(&RawComputePipelineDescriptor {
                label: Some("pipeline"),
                layout: Some(&pipeline_layout),
                module: &sm,
                entry_point: Some("main"),
                compilation_options: Default::default(),
                cache: None,
            });

            let mut encoder = device.create_command_encoder(&CommandEncoderDescriptor::default());
            {
                let mut cpass = encoder.begin_compute_pass(&ComputePassDescriptor::default());
                cpass.set_pipeline(&pipeline);
                cpass.dispatch_workgroups(1, 1, 1);
            }
            device.poll(PollType::wait_indefinitely()).unwrap();

Review comment (bug):
```suggestion
                    "@compute @workgroup_size(1, 1, 1) fn main() { loop { workgroupBarrier(); } }".into(),
```

This made it crash as expected for me. Without it nothing happens.

Code after:
                    mip_level_count: 1,
                    sample_count: 1,
                    dimension: TextureDimension::D2,
                    format: TextureFormat::Rgba16Float,
                    usage: TextureUsages::RENDER_ATTACHMENT,
                    view_formats: &[],
                }));
            }
        }
        RenderError::Validation => {
            device.create_buffer(&BufferDescriptor {
                label: None,
                size: 1 << 63,
                usage: BufferUsages::COPY_SRC,
                mapped_at_creation: false,
            });
        }
        RenderError::DeviceLost => {
            device.wgpu_device().destroy();
            device.poll(PollType::wait_indefinitely()).unwrap();
        }
        RenderError::Loop => {
            let sm = device.create_and_validate_shader_module(ShaderModuleDescriptor {
                label: Some("shader"),
                source: ShaderSource::Wgsl(
                    "@compute @workgroup_size(1, 1, 1) fn main() { loop { workgroupBarrier(); } }"
                        .into(),
                ),
            });

            let pipeline_layout = device.create_pipeline_layout(&PipelineLayoutDescriptor {
                label: Some("pipeline_layout"),
                bind_group_layouts: &[],
                immediate_size: 0,
            });

            let pipeline = device.create_compute_pipeline(&RawComputePipelineDescriptor {
                label: Some("pipeline"),
                layout: Some(&pipeline_layout),
                module: &sm,
                entry_point: Some("main"),
                compilation_options: Default::default(),
                cache: None,
            });

            let mut encoder = device.create_command_encoder(&CommandEncoderDescriptor::default());
            {
                let mut cpass = encoder.begin_compute_pass(&ComputePassDescriptor::default());
                cpass.set_pipeline(&pipeline);
                cpass.dispatch_workgroups(1, 1, 1);
            }