HDR渲染管线中的像素格式-v1

目录

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

REF

游戏中多pass打断问题

IOS10扩展像素格式

相关推荐
SmalBox16 小时前
【节点】[Projection节点]原理解析与实际应用
unity3d·游戏开发·图形学
SmalBox1 天前
【节点】[Distance节点]原理解析与实际应用
unity3d·游戏开发·图形学
玖釉-2 天前
旋转图像:从矩阵转置、镜像到坐标变换的系统理解
c++·windows·算法·图形渲染
玖釉-2 天前
Slang 和 HLSL 的区别与用法详解:现代图形渲染中的两种 Shader 编程语言
c++·算法·图形渲染
winlife_3 天前
把 Godot 编辑器接入 AI:Funplay MCP for Godot 介绍
人工智能·编辑器·godot·ai编程·游戏开发·mcp
SmalBox3 天前
【节点】[Tangent节点]原理解析与实际应用
unity3d·游戏开发·图形学
DBBH3 天前
AI帮我忙之webgpu实时路径追踪
图形渲染·webgpu
winlife_3 天前
把 Cocos Creator 编辑器接入 AI:Funplay MCP for Cocos 介绍
人工智能·编辑器·ai编程·cocos creator·游戏开发·claude·mcp
SmalBox4 天前
【节点】[RadiansToDegrees节点]原理解析与实际应用
unity3d·游戏开发·图形学
郝学胜-神的一滴4 天前
中级OpenGL教程 006:高光反射原理与 Shader 实现
c++·unity·godot·图形渲染·three.js·opengl·unreal