目录
- R16G16B16A16
- [EGL------R10G10B10A2 渲染HDR内容实践](#EGL——R10G10B10A2 渲染HDR内容实践)
- metal中的扩展像素格式
- P010
- R11G10B10F
- REF
R16G16B16A16
支持透明度,精度高用起来简单。现在大模型中也常用。。不过游戏中通常不怎么使用这个,涉及DDR带宽读写的功耗开销。复杂场景,pass打断,FP16格式带来的功耗开销,

IOS中一个display p3就建议采用FP16的格式了,不一定支持硬件合成,
下面各种奇葩的像素格式,解决一个问题,优化带宽读写功耗,
EGL------R10G10B10A2 渲染HDR内容实践
基于gles,如果要渲染HDR的视频,
1)视频解码拿出像素buffer,携带metadata
2)EGL创建surface,
- 指定色域格式,BT2020_PQ,BT2020_HLG
- 指定像素格式,一般rgba10bit
EGL中还需要给windows设置像素格式,下面是android的平台化代码:
cpp
/*
* Initialize an EGL eglContext_ for the current display_.
*
* Supported Format:
* 8888: EGL_COLOR_COMPONENT_TYPE_EXT EGL_COLOR_COMPONENT_TYPE_FIXED_EXT
* 101010102:EGL_COLOR_COMPONENT_TYPE_EXT EGL_COLOR_COMPONENT_TYPE_FIXED_EXT
* 16161616: EGL_COLOR_COMPONENT_TYPE_EXT EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT
*
*/
bool ImageViewEngine::CreateWideColorCtx(WIDECOLOR_MODE mode) {
EGLBoolean status;
std::vector<EGLint> attributes {
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT,
EGL_BLUE_SIZE, glWideColorCfg[mode].b_,
EGL_GREEN_SIZE, glWideColorCfg[mode].g_,
EGL_RED_SIZE, glWideColorCfg[mode].r_,
EGL_ALPHA_SIZE, glWideColorCfg[mode].a_,
};
attributes.push_back(EGL_NONE);
// request just one matching config and use it
EGLint cfgCount = 1;
EGLConfig config;
status = eglChooseConfig(display_, attributes.data(), &config,
cfgCount, &cfgCount);
if (!status || cfgCount != 1) {
// if not support, report to caller so caller could choose another one
LOGI("==== Chosen Config type(%d) is not supported", mode);
return false;
}
// Create GL3 Context
attributes.resize(0);
attributes.push_back(EGL_CONTEXT_CLIENT_VERSION);
attributes.push_back(3);
attributes.push_back(EGL_NONE);
eglContext_ = eglCreateContext(display_, config,
EGL_NO_CONTEXT, attributes.data());
if(eglContext_ == EGL_NO_CONTEXT) {
return false;
}
EGLint format;
eglGetConfigAttrib(display_, config, EGL_NATIVE_VISUAL_ID, &format);
LOGI("====Surface format is(%d)", format);
int32_t res = ANativeWindow_setBuffersGeometry(app_->window, 0, 0, format);
if(res < 0) {
eglDestroyContext(display_, eglContext_);
eglContext_ = EGL_NO_CONTEXT;
return false;
}
// ...
}
metal中的扩展像素格式
IOS10之后就搞出来的,重点看32pp的,

IOS10之后引入的,三个分量都是10bit~
cpp
if ([_device supportsFamily:MTLGPUFamilyApple3])
{
_drawableFormat = MTLPixelFormatBGR10_XR;
}
else
{
_drawableFormat = MTLPixelFormatBGRA8Unorm;
}
P010
HDR可能采用YUV存储,能比rgba少至少10%的数据量。
需要GPU支持采样,vulkan中需要设置ConversionInfo。
R11G10B10F
舍弃透明度,扩展rgb通道,
MTLPixelFormatRG11B10Float