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

Queue.submit API changes #5031

Open
nical opened this issue Jan 10, 2024 · 0 comments
Open

Queue.submit API changes #5031

nical opened this issue Jan 10, 2024 · 0 comments
Labels
area: api Issues related to API surface kind: refactor Making existing function faster or nicer

Comments

@nical
Copy link
Contributor

nical commented Jan 10, 2024

Followup from #5028

Quoting @cwfitzgerald:

[..] To be consistent we need to make the submission index hold an Option on the direct backend, make poll a no-op if the submission index is None, then send all submit errors down the error sync.

This sucks, but the futures api is a better one, so will be resolved when we can figure that out.

Once this is done we can make it so queue.submit doesn't panic on errors and add the following test:

// Test that destroying a used resource between command buffer recording and submission fails gracefully.
#[gpu_test]
static TEXTURE_DESTROY_BEFORE_SUBMIT: GpuTestConfiguration = GpuTestConfiguration::new().run_sync(|ctx| {
    let descriptor = wgpu::TextureDescriptor {
        label: None,
        size: wgpu::Extent3d {
            width: 128,
            height: 128,
            depth_or_array_layers: 1,
        },
        mip_level_count: 1,
        sample_count: 1, // multisampling is not supported for clear
        dimension: wgpu::TextureDimension::D2,
        format: wgpu::TextureFormat::Rgba8Snorm,
        usage: wgpu::TextureUsages::COPY_DST | wgpu::TextureUsages::COPY_SRC | wgpu::TextureUsages::TEXTURE_BINDING,
        view_formats: &[],
    };

    let texture_1 = ctx.device.create_texture(&descriptor);
    let texture_2 = ctx.device.create_texture(&descriptor);

    let mut encoder = ctx.device.create_command_encoder(&wgpu::CommandEncoderDescriptor::default());
    encoder.copy_texture_to_texture(
        wgpu::ImageCopyTexture {
            texture: &texture_1,
            mip_level: 0,
            origin: wgpu::Origin3d::ZERO,
            aspect: wgpu::TextureAspect::All,
        },
        wgpu::ImageCopyTexture {
            texture: &texture_2,
            mip_level: 0,
            origin: wgpu::Origin3d::ZERO,
            aspect: wgpu::TextureAspect::All,            
        },
        wgpu::Extent3d {
            width: 128,
            height: 128,
            depth_or_array_layers: 1,
        }
    );

    texture_1.destroy();
    texture_2.destroy();

    fail(&ctx.device, || {
        ctx.queue.submit([encoder.finish()]);
    });
});

We'd like a similar test for buffers as well.

@teoxoy teoxoy added area: api Issues related to API surface kind: refactor Making existing function faster or nicer labels Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: api Issues related to API surface kind: refactor Making existing function faster or nicer
Projects
Status: Todo
Development

No branches or pull requests

2 participants