feat(iced-video): added video format to the video frame
This commit is contained in:
@@ -1,13 +1,3 @@
|
||||
// struct VertexOutput {
|
||||
// @builtin(position) clip_position: vec4f,
|
||||
// @location(0) coords: vec2f,
|
||||
// }
|
||||
|
||||
// struct VertexInput {
|
||||
// // @location(0) position: vec3<f32>,
|
||||
// // @location(1) tex_coords: vec2<f32>,
|
||||
// }
|
||||
|
||||
struct VertexOutput {
|
||||
@builtin(position) clip_position: vec4<f32>,
|
||||
@location(0) tex_coords: vec2<f32>,
|
||||
@@ -15,38 +5,30 @@ struct VertexOutput {
|
||||
|
||||
@vertex
|
||||
fn vs_main(
|
||||
// model: VertexInput,
|
||||
@builtin(vertex_index) in_vertex_index: u32,
|
||||
) -> VertexOutput {
|
||||
var out: VertexOutput;
|
||||
out.tex_coords = vec2<f32>(0.0, 0.0);
|
||||
out.clip_position = vec4<f32>(0,0,0, 1.0);
|
||||
let uv = vec2<f32>(f32((in_vertex_index << 1u) & 2u), f32(in_vertex_index & 2u));
|
||||
out.clip_position = vec4<f32>(uv * 2.0 - 1.0, 0.0, 1.0);
|
||||
out.clip_position.y = -out.clip_position.y;
|
||||
out.tex_coords = uv;
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// @vertex
|
||||
// fn vs_main(@location(0) input: vec2f) -> VertexOutput {
|
||||
// var out: VertexOutput;
|
||||
// out.clip_position = vec4f(input, 0.0, 1.0);
|
||||
// out.coords = input * 0.5 + vec2f(0.5, 0.5);
|
||||
// return out;
|
||||
// }
|
||||
|
||||
@group(0) @binding(0) var y_texture: texture_2d<f32>;
|
||||
@group(0) @binding(1) var uv_texture: texture_2d<f32>;
|
||||
@group(0) @binding(2) var texture_sampler: sampler;
|
||||
@group(0) @binding(3) var<uniform> rgb_primaries: mat3x3<f32>;
|
||||
@group(0) @binding(3) var<uniform> rgb_primaries: mat4x4<f32>;
|
||||
|
||||
@fragment
|
||||
fn fs_main(input: VertexOutput) -> @location(0) vec4<f32> {
|
||||
let y = textureSample(y_texture, texture_sampler, input.tex_coords).r;
|
||||
let uv = textureSample(uv_texture, texture_sampler, input.tex_coords).rg;
|
||||
let yuv = vec3f(y, uv);
|
||||
let yuv = vec4f(y, uv, 0);
|
||||
let rgb = rgb_primaries * yuv;
|
||||
return vec4f(rgb, 1.0);
|
||||
return vec4f(rgb.r, rgb.g, rgb.b, 1.0);
|
||||
// let rgb = rgb_primaries * yuv;
|
||||
// return vec4f(rgb, 1.0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user