Version: 2023.1
LanguageEnglish
  • C#
Experimental: this API is experimental and might be changed or removed in the future.

GraphicsFormatUtility

class in UnityEngine.Experimental.Rendering

/

Implemented in:UnityEngine.CoreModule

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

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.

Static Methods

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.
GetAlphaComponentCountReturns the number of alpha components of the format.
GetBlockHeightReturns the height in texels of a texel block.
GetBlockSizeReturns the memory size in bytes of a texel block.
GetBlockWidthReturns the width in texels of a texel block.
GetColorComponentCountReturns the number of color components of the format.
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.
GetGraphicsFormatTranslates RenderTextureFormat or TextureFormat into GraphicsFormat.
GetLinearFormatReturns the equivalent linear format of a GraphicsFormat. For example, this function returns kFormatR8G8B8A8_UNorm if the input is kFormatR8G8B8A8_SRGB. If the input GraphicsFormat is already linear, this function returns the input GraphicsFormat.
GetRenderTextureFormatTranslates GraphicsFormat into RenderTextureFormat.
GetSRGBFormatReturns the equivalent sRGB format of a GraphicsFormat. For example, this function returns kFormatR8G8B8A8_SRGB if the input is kFormatR8G8B8A8_UNorm. If the input GraphicsFormat is already sRGB, this function returns the input GraphicsFormat. If there is no equivalent sRGB format, this function returns the input 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.
GetSwizzleRReturns FormatSwizzle enum of which channel is mapped to the R channel for a given format.
GetTextureFormatTranslates GraphicsFormat into TextureFormat.
HasAlphaChannelReturns true if the format has an alpha component. Returns false otherwise.
Is16BitPackedFormatReturns true if the format is packed and a 16-bit format. Returns false otherwise.
IsAlphaOnlyFormatReturns true if the format only has an alpha component. Returns false otherwise.
IsAlphaTestFormatReturns true if the format has an alpha component with only 1 or 2 bits. Returns false otherwise.
IsASTCFormatReturns true if the format uses ASTC. Returns false otherwise.
IsBCFormatReturns true if the format is a DXTC, RGTC or BPTC format. Returns false otherwise.
IsBPTCFormatReturns true if the format uses BPTC. Returns false otherwise.
IsCompressedFormatReturns true if the format is compressed. Returns false otherwise.
IsCrunchFormatReturns true if the format data is compressed with Crunch. Returns false otherwise.
IsDepthFormatReturns true if the format is a depth format. Returns false otherwise.
IsDepthStencilFormatReturns true if the format is a depth or stencil format. Returns false otherwise.
IsDXTCFormatReturns true if the format uses DXTC. Returns false otherwise.
IsEACFormatReturns true if the format uses EAC. Returns false otherwise.
IsETCFormatReturns true if the format uses ETC and ETC2. Returns false otherwise.
IsFloatFormatReturns true if the format is a single precision floating point format. Returns false otherwise.
IsHalfFormatReturns true if the format is a half precision floating point format. Returns false otherwise.
IsHDRFormatReturns true if the format is capable of representing HDR data. Returns false otherwise.
IsIEEE754FormatReturns true if the format is a floating point format. Returns false otherwise.
IsIntegerFormatReturns true if the format is an integer format. Returns false otherwise.
IsNormFormatReturns true if the format is a normalized format. Returns false otherwise.
IsPackedFormatReturns true if the format is packed. Returns false otherwise.
IsPVRTCFormatReturns true if the format uses PVRTC. Returns false otherwise.
IsRGTCFormatReturns true if the format uses RGTC. Returns false otherwise.
IsSignedFormatReturns true if the format is a signed format. Returns false otherwise.
IsSIntFormatReturns true if the format is a signed and integer format. Returns false otherwise.
IsSNormFormatReturns true if the format is a signed normalized format. Returns false otherwise.
IsSRGBFormatReturns true if the format performs sRGB to linear on read and linear to sRGB on write. Returns false otherwise.
IsStencilFormatReturns true if the format is a stencil format. Returns false otherwise.
IsSwizzleFormatReturns true if the format is not a RGBA format. Returns false otherwise.
IsUIntFormatReturns true if the format is an unsigned and integer format. Returns false otherwise.
IsUNormFormatReturns true if the format is an unsigned normalized format. Returns false otherwise.
IsUnsignedFormatReturns true if the format is an unsigned format. Returns false otherwise.
IsXRFormatReturns true if the format is an extended range format. With extended range format, the blue, green, and red components are linearly encoded, and their values range from -0.752941 to 1.25098. The alpha component is always clamped to a [0.0, 1.0] range in sampling, rendering, and writing operations, despite supporting values outside this range. Returns false otherwise.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961