a02d0a2e9f
The decoder's NV12 dmabuf imports per-plane (R8 + GR88, explicit DRM format modifier, dedicated dup'd-fd import, FOREIGN→graphics acquire) and a fullscreen-triangle render pass converts it into the presenter's video image with the CICP-driven coefficients ported from video_gl.rs (same tests, plus a rows-vs-matrix agreement check). SPIR-V is committed (shaders/build.sh regenerates) so builds and CI need no toolchain. The import extension set is probed at device creation; unsupported boxes and 3-failure streaks demote the decoder to software via the existing force_software contract. The session binary now honors the Settings decoder preference instead of forcing software. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
37 lines
1.1 KiB
GLSL
37 lines
1.1 KiB
GLSL
// NV12 → RGBA with the stream's CICP signaling — the Vulkan port of the GL presenter's
|
|
// fragment shader (video_gl.rs). The YUV→RGB matrix + range expansion arrive as three
|
|
// push-constant rows precomputed on the CPU (csc.rs `csc_rows`): rgb[i] = dot(r_i.xyz,
|
|
// yuv) + r_i.w — one shader for BT.601/709/2020, full/limited. The chroma plane is
|
|
// half-res; the linear sampler interpolates, same as the GL path.
|
|
//
|
|
// Regenerate: shaders/build.sh (committed .spv, no build-time toolchain).
|
|
#version 450
|
|
|
|
layout(location = 0) in vec2 v_uv;
|
|
layout(location = 0) out vec4 frag;
|
|
|
|
layout(set = 0, binding = 0) uniform sampler2D u_y;
|
|
layout(set = 0, binding = 1) uniform sampler2D u_c;
|
|
|
|
layout(push_constant) uniform Csc {
|
|
vec4 r0;
|
|
vec4 r1;
|
|
vec4 r2;
|
|
} pc;
|
|
|
|
void main() {
|
|
vec3 yuv = vec3(texture(u_y, v_uv).r, texture(u_c, v_uv).rg);
|
|
frag = vec4(
|
|
clamp(
|
|
vec3(
|
|
dot(pc.r0.xyz, yuv) + pc.r0.w,
|
|
dot(pc.r1.xyz, yuv) + pc.r1.w,
|
|
dot(pc.r2.xyz, yuv) + pc.r2.w
|
|
),
|
|
0.0,
|
|
1.0
|
|
),
|
|
1.0
|
|
);
|
|
}
|