Loading...
Searching...
No Matches
NV12ExternalOES.hpp File Reference

NV12 sampled through a GL_TEXTURE_EXTERNAL_OES texture. More...

Detailed Description

NV12 sampled through a GL_TEXTURE_EXTERNAL_OES texture.

The zero-copy counterpart to NV12.hpp. Where that decoder takes two plane textures and converts YUV to RGB in the shader, this one takes a single external image and converts nothing: sampling an external texture already returns RGB, because the driver's sampler does the conversion.

That is not a preference, it is what EGL drivers implement. Importing NV12 as two single-channel 2D images is refused outright – drivers reject fourcc 'R8 ' as a 2D texture – so a dma-buf NV12 frame can only be sampled this way.

THE SHADER TRICK

samplerExternalOES cannot be baked: glslang rejects the type when targeting SPIR-V, and every score shader goes through QShaderBaker. So the fragment shader is baked normally with sampler2D – giving valid SPIR-V and a correct reflection – and only its GLSL variant is replaced afterwards with hand-written ESSL declaring samplerExternalOES.

The two halves need not agree: QRhiGles2 takes the bind target from the texture (QGles2Texture::target, set from QRhiTexture::ExternalOES), not from the shader description. So the description keeps saying Sampler2D while the GL program says external, and each is right about its own half.

Go to the source code of this file.

Classes

struct  score::gfx::NV12ExternalOESDecoder
 

Namespaces

namespace  score
 Base toolkit upon which the software is built.
 
namespace  score::gfx
 Graphics rendering pipeline for ossia score.
 

Functions

bool score::gfx::nv12ExternalOesUsable (QRhi::Implementation backend) noexcept
 
QByteArray score::gfx::toExternalSamplerEssl (QByteArray glsl)