Version: 2022.3
Experimental: this API is experimental and might be changed or removed in the future.

GraphicsFormatUtility

class in UnityEngine.Experimental.Rendering

切换到手册

描述

This utility class contains helper functions that enable you to query properties of a TextureFormat, RenderTextureFormat, or GraphicsFormat. This class also includes format conversion and size calculation functions.

静态函数

ComputeMipChainSizeComputes the memory size in bytes for a chain of mipmaps.
ComputeMipmapSizeComputes the memory size in bytes for a single mipmap.
ConvertToAlphaFormatInput a GraphicsFormat to return an equivalent GraphicsFormat that includes an alpha component.
GetAlphaComponentCount返回该格式的 Alpha 分量数。
GetBlockHeight返回纹素块的高度(以纹素为单位)。
GetBlockSizeReturns the memory size in bytes of a texel block.
GetBlockWidth返回纹素块的宽度(以纹素为单位)。
GetColorComponentCount返回该格式的颜色分量数。
GetComponentCountReturns the number of components this format has.
GetDepthBitsReturns the number of bits per pixel this format contains for depth.
GetDepthStencilFormatReturns a supported depth stencil format that has 'minimumDepthBits' of bits or higher per pixel for the depth component if a compatible format exists on the current platform. If 'minimumStencilBits' is higher than 0, and a compatible format exists on the current platform, Unity returns a depth stencil format with 8 bits per pixel for the stencil component.
GetFormatStringReturns a string that represents a format enum value.
GetGraphicsFormat将 RenderTextureFormat 或 TextureFormat 转换为 GraphicsFormat。
GetLinearFormat返回 GraphicsFormat 的等效线性格式。例如,如果输入为 kFormatR8G8B8A8_SRGB,则该函数返回 kFormatR8G8B8A8_UNorm。如果输入 GraphicsFormat 已经是线性的,则该函数返回输入 GraphicsFormat。
GetRenderTextureFormat将 GraphicsFormat 转换为 RenderTextureFormat。
GetSRGBFormat返回 GraphicsFormat 的等效 sRGB 格式。例如,如果输入为 kFormatR8G8B8A8_UNorm,则该函数返回 kFormatR8G8B8A8_SRGB。如果输入 GraphicsFormat 已经是 sRGB,则该函数返回输入 GraphicsFormat。如果没有等效 sRGB 格式,则该函数返回输入 GraphicsFormat。
GetSwizzleAReturns a FormatSwizzle enum that is mapped to the alpha channel for a given format.
GetSwizzleBReturns a FormatSwizzle enum that is mapped to the blue channel for a given format.
GetSwizzleGReturns a FormatSwizzle enum that is mapped to the green channel for a given format.
GetSwizzleR返回其通道被映射到给定格式的 R 通道的 FormatSwizzle 枚举。
GetTextureFormat将 GraphicsFormat 转换为 TextureFormat。
HasAlphaChannel如果该格式具有 Alpha 分量,则返回 true。否则返回 false。
Is16BitPackedFormat如果该格式为打包格式并具有 16 位格式,则返回 true。否则返回 false。
IsAlphaOnlyFormat如果该格式仅具有 Alpha 分量,则返回 true。否则返回 false。
IsAlphaTestFormat如果该格式仅具有只有 1 或 2 个位的 Alpha 分量,则返回 true。否则返回 false。
IsASTCFormat如果该格式使用 ASTC,则返回 true。否则返回 false。
IsBCFormat如果该格式为 DXTC、RGTC 或 BPTC 格式,则返回 true。否则返回 false。
IsBPTCFormat如果该格式使用 BPTC,则返回 true。否则返回 false。
IsCompressedFormat如果该格式为压缩格式,则返回 true。否则返回 false。
IsCrunchFormatReturns true if the format data is compressed with Crunch. Returns false otherwise.
IsDepthFormat如果该格式为深度格式,则返回 true。否则返回 false。
IsDepthStencilFormatReturns true if the format is a depth or stencil format. Returns false otherwise.
IsDXTCFormat如果该格式使用 DXTC,则返回 true。否则返回 false。
IsEACFormat如果该格式使用 EAC,则返回 true。否则返回 false。
IsETCFormat如果该格式使用 ETC 和 ETC2,则返回 true。否则返回 false。
IsFloatFormat如果该格式为单精度浮点格式,则返回 true。否则返回 false。
IsHalfFormat如果该格式为半精度浮点格式,则返回 true。否则返回 false。
IsHDRFormatReturns true if the format is capable of representing HDR data. Returns false otherwise.
IsIEEE754Format如果该格式为浮点格式,则返回 true。否则返回 false。
IsIntegerFormat如果该格式为整数格式,则返回 true。否则返回 false。
IsNormFormat如果该格式为归一化格式,则返回 true。否则返回 false。
IsPackedFormat如果该格式为打包格式,则返回 true。否则返回 false。
IsPVRTCFormat如果该格式使用 PVRTC,则返回 true。否则返回 false。
IsRGTCFormat如果该格式使用 RGTC,则返回 true。否则返回 false。
IsSignedFormat如果该格式为有符号格式,则返回 true。否则返回 false。
IsSIntFormat如果该格式为有符号整数格式,则返回 true。否则返回 false。
IsSNormFormat如果该格式为有符号归一化格式,则返回 true。否则返回 false。
IsSRGBFormat如果该格式在读取时执行 sRGB 到线性转换并在写入时执行线性到 sRGB 转换,则返回 true。否则返回 false。
IsStencilFormat如果该格式为模板格式,则返回 true。否则返回 false。
IsSwizzleFormat如果该格式不是 RGBA 格式,则返回 true。否则返回 false。
IsUIntFormat如果该格式为无符号整数格式,则返回 true。否则返回 false。
IsUNormFormat如果该格式为无符号归一化格式,则返回 true。否则返回 false。
IsUnsignedFormat如果该格式为无符号格式,则返回 true。否则返回 false。
IsXRFormat如果该格式为扩展范围格式,则返回 true。对于扩展范围格式,蓝色、绿色和红色分量采用线性编码,它们的值范围从 0.752941 到 1.25098。在采样、渲染和写入操作中,Alpha 分量始终限制为 [0.0, 1.0] 范围,尽管支持此范围之外的值。否则返回 false。