-
Notifications
You must be signed in to change notification settings - Fork 14
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
base: master
Are you sure you want to change the base?
Conversation
2a4cf85
to
b26987f
Compare
There was a problem hiding this 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()); |
There was a problem hiding this comment.
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
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), | ||
}, | ||
], | ||
}) | ||
} |
There was a problem hiding this comment.
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
Closes #750