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

Blit Utility #6819

Open
cwfitzgerald opened this issue Dec 23, 2024 · 4 comments
Open

Blit Utility #6819

cwfitzgerald opened this issue Dec 23, 2024 · 4 comments
Labels
area: api Issues related to API surface good first issue Good for newcomers help required We need community help to make this happen. type: enhancement New feature or request

Comments

@cwfitzgerald
Copy link
Member

We don't offer a blit_texture utility in wgpu right now due to a number of platforms needing to emulate it with standard pipelines.

While this shouldn't be something done implicitly, we can easily provide a user-space utility in utils to make blitting easier.

@cwfitzgerald cwfitzgerald added type: enhancement New feature or request area: api Issues related to API surface help required We need community help to make this happen. good first issue Good for newcomers labels Dec 23, 2024
@AbdullahElsheshtawy
Copy link

Is this the sort of api you are looking for?

use wgpu::util::BlitTexture;
encoder.blit_texture(source, dest, extent);

Should it be a standard pipeline or platform dependant (vkCmdBlitImage if supported else vkCmdCopyImage for example)?

@Wumpf
Copy link
Member

Wumpf commented Jan 2, 2025

it should be a utility that is implemented using wgpu exposed methods.

@cwfitzgerald can you add a bit more detail what this should do? I imagine what you're trying to get at is to have a copy_texture_to_texture that works on formats that aren't otherwise copyable?
Imho this shouldn't be called blit since that's a quite antique term at this point and technically 🤓 not correct

@cwfitzgerald
Copy link
Member Author

Should it be a standard pipeline

Yeah.

Can you add a bit more detail what this should do? I imagine what you're trying to get at is to have a copy_texture_to_texture that works on formats that aren't otherwise copyable?

To satisify all of the "I just need to render-copy A to B" be it incompatible formats, differing sizes, or whatever.

Is this the sort of api you are looking for?

I was thinking something on the lines of this. I want to make each pipeline explicit objects so we don't need an internal pipeline cache.

struct TextureBlitter { ... }

impl TextureBlitter {
    fn new(format: TextureFormat, sample_type: FilterMode) -> Self;
    
    fn copy(encoder: &mut CommandEncoder, target: &TextureView, source: &TextureView);
}

Or something like that.

@AbdullahElsheshtawy
Copy link

Alright I will get to work on it today

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 good first issue Good for newcomers help required We need community help to make this happen. type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants