Skip to content
  • Lina Versace's avatar
    mesa: Add _mesa_format_fallback_rgbx_to_rgba() [v2] · a1983223
    Lina Versace authored
    
    
    The new function takes a mesa_format and, if the format is an alpha
    format with a non-alpha variant, returns the non-alpha format.
    Otherwise, it returns the original format.
    
    Example:
      input -> output
    
      // Fallback exists
      MESA_FORMAT_R8G8B8X8_UNORM -> MESA_FORMAT_R8G8B8A8_UNORM
      MESA_FORMAT_RGBX_UNORM16 -> MESA_FORMAT_RGBA_UNORM16
    
      // No fallback
      MESA_FORMAT_R8G8B8A8_UNORM -> MESA_FORMAT_R8G8B8A8_UNORM
      MESA_FORMAT_Z_FLOAT32 -> MESA_FORMAT_Z_FLOAT32
    
    i965 will use this for EGLImages and DRIimages.
    
    v2 (Jason Ekstrand):
     - Use mako
     - Rework to be easier to read
     - Write directly to the output file
    
    Reviewed-by: Kenneth Graunke's avatarKenneth Graunke <kenneth@whitecape.org>
    a1983223