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

Support input NV12 textures #748

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jerzywilczek
Copy link
Collaborator

@jerzywilczek jerzywilczek commented Sep 9, 2024

Closes #750

Copy link
Member

@wkozyra95 wkozyra95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but make sure it does not panic when passed texture is invalid

@@ -182,6 +189,15 @@ impl InputTexture {
error!("Invalid texture passed as an input: {err}")
}
}
InputTextureState::Nv12WgpuTexture(texture) => {
let texture = NV12TextureView::from_wgpu_texture(texture.as_ref());
let bind_group = texture.new_bind_group(ctx, ctx.format.nv12_layout());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what will happen if the passed texture is not nv12?

e.g. for rgba texture with do some validation inside fill_from_wgpu_texture

Comment on lines +63 to +82
pub(super) fn new_bind_group(
&self,
ctx: &WgpuCtx,
layout: &wgpu::BindGroupLayout,
) -> wgpu::BindGroup {
ctx.device.create_bind_group(&wgpu::BindGroupDescriptor {
label: Some("nv12 texture bind group"),
layout,
entries: &[
wgpu::BindGroupEntry {
binding: 0,
resource: wgpu::BindingResource::TextureView(&self.view_y),
},
wgpu::BindGroupEntry {
binding: 1,
resource: wgpu::BindingResource::TextureView(&self.view_uv),
},
],
})
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be created just once

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

Successfully merging this pull request may close these issues.

Add NV12 format conversion to prepare the compositor for ingesting output from the vulkan decoder
3 participants