Struct TextureDesc
Descriptor used to create texture resources
Inherited Members
Namespace: UnityEngine.Rendering.RenderGraphModule
Assembly: Unity.RenderPipelines.Core.Runtime.dll
Syntax
public struct TextureDesc
Constructors
TextureDesc(int, int, bool, bool)
TextureDesc constructor for a texture using explicit size
Declaration
public TextureDesc(int width, int height, bool dynamicResolution = false, bool xrReady = false)
Parameters
Type | Name | Description |
---|---|---|
int | width | Texture width |
int | height | Texture height |
bool | dynamicResolution | Use dynamic resolution |
bool | xrReady | Set this to true if the Texture is a render texture in an XR setting. |
TextureDesc(RenderTexture)
Do a best effort conversion from a RenderTexture to a TextureDesc. This tries to initialize a descriptor to be as close as possible to the given render texture but there might be subtle differences when creating render graph textures using this TextureDesc due to the underlying RTHandle system.
Declaration
public TextureDesc(RenderTexture input)
Parameters
Type | Name | Description |
---|---|---|
RenderTexture | input | The texture to create a TextureDesc from |
TextureDesc(RenderTextureDescriptor)
Do a best effort conversion from a RenderTextureDescriptor to a TextureDesc. This tries to initialize a descriptor to be as close as possible to the given render texture descriptor but there might be subtle differences when creating render graph textures using this TextureDesc due to the underlying RTHandle system. Some parameters of the TextureDesc (like name and filtering modes) are not present in the RenderTextureDescriptor for these the returned TextureDesc will contain plausible default values.
Declaration
public TextureDesc(RenderTextureDescriptor input)
Parameters
Type | Name | Description |
---|---|---|
RenderTextureDescriptor | input | The texture descriptor to create a TextureDesc from |
TextureDesc(TextureDesc)
Copy constructor
Declaration
public TextureDesc(TextureDesc input)
Parameters
Type | Name | Description |
---|---|---|
TextureDesc | input | The TextureDesc instance to copy from. |
TextureDesc(ScaleFunc, bool, bool)
TextureDesc constructor for a texture using a functor for scaling
Declaration
public TextureDesc(ScaleFunc func, bool dynamicResolution = false, bool xrReady = false)
Parameters
Type | Name | Description |
---|---|---|
ScaleFunc | func | Function used to determine the texture size |
bool | dynamicResolution | Use dynamic resolution |
bool | xrReady | Set this to true if the Texture is a render texture in an XR setting. |
TextureDesc(Vector2, bool, bool)
TextureDesc constructor for a texture using a fixed scaling
Declaration
public TextureDesc(Vector2 scale, bool dynamicResolution = false, bool xrReady = false)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | scale | RTHandle scale used for this texture |
bool | dynamicResolution | Use dynamic resolution |
bool | xrReady | Set this to true if the Texture is a render texture in an XR setting. |
Fields
anisoLevel
Anisotropic filtering level.
Declaration
public int anisoLevel
Field Value
Type | Description |
---|---|
int |
autoGenerateMips
Automatically generate mip maps.
Declaration
public bool autoGenerateMips
Field Value
Type | Description |
---|---|
bool |
bindTextureMS
Bind texture multi sampled.
Declaration
public bool bindTextureMS
Field Value
Type | Description |
---|---|
bool |
clearBuffer
Texture needs to be cleared on first use.
Declaration
public bool clearBuffer
Field Value
Type | Description |
---|---|
bool |
clearColor
Clear color.
Declaration
public Color clearColor
Field Value
Type | Description |
---|---|
Color |
dimension
Texture dimension.
Declaration
public TextureDimension dimension
Field Value
Type | Description |
---|---|
TextureDimension |
disableFallBackToImportedTexture
If all passes writing to a texture are culled by Dynamic Render Pass Culling, it will automatically fallback to a similar preallocated texture. Set this to true to force the allocation.
Declaration
public bool disableFallBackToImportedTexture
Field Value
Type | Description |
---|---|
bool |
discardBuffer
Texture needs to be discarded on last use.
Declaration
public bool discardBuffer
Field Value
Type | Description |
---|---|
bool |
enableRandomWrite
Enable random UAV read/write on the texture.
Declaration
public bool enableRandomWrite
Field Value
Type | Description |
---|---|
bool |
fallBackToBlackTexture
Determines whether the texture will fallback to a black texture if it is read without ever writing to it.
Declaration
public bool fallBackToBlackTexture
Field Value
Type | Description |
---|---|
bool |
fastMemoryDesc
Descriptor to determine how the texture will be in fast memory on platform that supports it.
Declaration
public FastMemoryDesc fastMemoryDesc
Field Value
Type | Description |
---|---|
FastMemoryDesc |
filterMode
Filtering mode.
Declaration
public FilterMode filterMode
Field Value
Type | Description |
---|---|
FilterMode |
format
Color or depth stencil format.
Declaration
public GraphicsFormat format
Field Value
Type | Description |
---|---|
GraphicsFormat |
func
Texture scale function.
Declaration
public ScaleFunc func
Field Value
Type | Description |
---|---|
ScaleFunc |
height
Texture height.
Declaration
public int height
Field Value
Type | Description |
---|---|
int |
isShadowMap
Texture is a shadow map.
Declaration
public bool isShadowMap
Field Value
Type | Description |
---|---|
bool |
memoryless
Memory less flag.
Declaration
public RenderTextureMemoryless memoryless
Field Value
Type | Description |
---|---|
RenderTextureMemoryless |
mipMapBias
Mip map bias.
Declaration
public float mipMapBias
Field Value
Type | Description |
---|---|
float |
msaaSamples
Number of MSAA samples.
Declaration
public MSAASamples msaaSamples
Field Value
Type | Description |
---|---|
MSAASamples |
name
Texture name.
Declaration
public string name
Field Value
Type | Description |
---|---|
string |
scale
Texture scale.
Declaration
public Vector2 scale
Field Value
Type | Description |
---|---|
Vector2 |
sizeMode
Texture sizing mode.
Declaration
public TextureSizeMode sizeMode
Field Value
Type | Description |
---|---|
TextureSizeMode |
slices
Number of texture slices..
Declaration
public int slices
Field Value
Type | Description |
---|---|
int |
useDynamicScale
Declaration
public bool useDynamicScale
Field Value
Type | Description |
---|---|
bool |
useDynamicScaleExplicit
Declaration
public bool useDynamicScaleExplicit
Field Value
Type | Description |
---|---|
bool |
useMipMap
Texture needs mip maps.
Declaration
public bool useMipMap
Field Value
Type | Description |
---|---|
bool |
vrUsage
Special treatment of the VR eye texture used in stereoscopic rendering.
Declaration
public VRTextureUsage vrUsage
Field Value
Type | Description |
---|---|
VRTextureUsage |
width
Texture width.
Declaration
public int width
Field Value
Type | Description |
---|---|
int |
wrapMode
Addressing mode.
Declaration
public TextureWrapMode wrapMode
Field Value
Type | Description |
---|---|
TextureWrapMode |
Properties
colorFormat
Color format. Sets the format. The getter checks if format is a color format. Returns the format if a color format, otherwise returns GraphicsFormat.None.
Declaration
public GraphicsFormat colorFormat { get; set; }
Property Value
Type | Description |
---|---|
GraphicsFormat |
depthBufferBits
Depth buffer bit depth of the format. The setter convert the bits to valid depth stencil format and sets the format. The getter gets the depth bits of the format.
Declaration
public DepthBits depthBufferBits { get; set; }
Property Value
Type | Description |
---|---|
DepthBits |
Methods
CalculateFinalDimensions()
Calculate the final size of the texture descriptor in pixels. This takes into account the sizeMode set for this descriptor. For the automatically scaled sizes the size will be relative to the RTHandle reference size SetReferenceSize.
Declaration
public Vector2Int CalculateFinalDimensions()
Returns
Type | Description |
---|---|
Vector2Int | The calculated size. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown if the texture descriptor's size mode falls outside the expected range. |
GetHashCode()
Hash function
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | The texture descriptor hash. |