Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: Multiple command buffers / render passes seems to break surface.get_current_texture() #5663

Closed
ggadwa opened this issue May 4, 2024 · 2 comments

Comments

@ggadwa
Copy link

ggadwa commented May 4, 2024

Description
Going from 0.19.4 to 0.20.0 makes my game always return timeout when getting the output surface.

Repro steps
Just for ease in my code, there are multiple command buffer creation, render pass, then queue submits. This is all on a single thread. In 0.19.4, this worked, but if I do anything more than a single command buffer, this:

surface.get_current_texture()

returns a timeout.

Not a recreation example but just how my normal rendering goes (this happens maybe 5-10 times every frame, and is different every time but the normal command/render pass/queue stuff), this is just a simple example.

       // set the matrix
        let buf: [[f32; 4]; 4] = view.ortho_matrix.into();
        view.queue.write_buffer(&self.uniform_buffer_ortho_matrix, 0, bytemuck::cast_slice(&buf));

        let mut encoder = view.device.create_command_encoder(
            &wgpu::CommandEncoderDescriptor {
                label: None,
            }
        );
        
        { // to drop render pass
            let mut render_pass = 
                encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
                    label: None,
                    color_attachments: &[Some(wgpu::RenderPassColorAttachment {
                        view: &view.color_texture_view,
                        resolve_target: None,
                        ops: wgpu::Operations {
                            load: wgpu::LoadOp::Load,
                            store: wgpu::StoreOp::Store,
                        },
                    })],
                    depth_stencil_attachment: None,
                    occlusion_query_set: None,
                    timestamp_writes: None
                });

            render_pass.set_pipeline(&self.pipeline);
            render_pass.set_bind_group(0, &self.bind_group_ortho_matrix, &[]);
            render_pass.set_vertex_buffer(0, self.vertex_buffer.slice(..));
            render_pass.draw(0..6, 0..1);
        }

        view.queue.submit(iter::once(encoder.finish()));

This worked fine in 0.19.4, in 0.20.0 it throws the timeout (always, not just a first frame or every once in a while). If I need to rework all my code I can but this seems like a regression.

So, specifically, if I do an encoder/render pass/draw something/queue submit more than once in a frame in the same thread it breaks current surface. If I do it JUST ONCE, it works fine.

Expected vs observed behavior
Seems to be a regression; to have it work like it did in 0.19.4.

Extra materials
n/a

Platform
Windows 10, AMD card, game also runs on Mac but haven't tested it there yet.

@ggadwa
Copy link
Author

ggadwa commented May 4, 2024

Note: I saw a couple deadlock issues appeared as I typed in this one -- possibly related.

@teoxoy
Copy link
Member

teoxoy commented May 13, 2024

Closing as duplicate of #5693.

@teoxoy teoxoy closed this as not planned Won't fix, can't repro, duplicate, stale May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants