# GetDepthStencilFormat

> Returns a supported depth stencil format that has 'depthBits' of bits for the depth component if a compatible format exists on the current platform.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.Experimental.Rendering](/engine/6000.7/script-reference/unityengine/experimental/rendering.md)
* **Assembly:** UnityEngine.CoreModule

## GetDepthStencilFormat(int)

Returns a supported depth stencil format that has 'depthBits' of bits for the depth component if a compatible format exists on the current platform.

```csharp
public static GraphicsFormat GetDepthStencilFormat(int depthBits)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Number of bits that the format should have for the depth component.

### Returns

| Type                                                                                                   | Description                                                 |
| ------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------- |
| [GraphicsFormat](/engine/6000.7/script-reference/unityengine/experimental/rendering/graphicsformat.md) | A GraphicsFormat that has a depth and/or stencil component. |

### Remarks

The depth bits are rounded up to 0, 16, 24 or 32 bits. The format is not guaranteed to have a stencil component. Returns the default format for the current platform if no supported format has the requested amount of bits for the depth component.

Additional Resources: [RenderTexture.depthStencilFormat](/engine/6000.7/script-reference/unityengine/rendertexture/depthstencilformat.md), [RenderTextureDescriptor.depthStencilFormat](/engine/6000.7/script-reference/unityengine/rendertexturedescriptor/depthstencilformat.md).

## GetDepthStencilFormat(int, int)

Returns a supported depth stencil format that has 'depthBits' of bits for the depth component if a compatible format exists on the current platform.

```csharp
public static GraphicsFormat GetDepthStencilFormat(int minimumDepthBits, int minimumStencilBits)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): **** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)):&#x20;

### Returns

| Type                                                                                                   | Description                                                 |
| ------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------- |
| [GraphicsFormat](/engine/6000.7/script-reference/unityengine/experimental/rendering/graphicsformat.md) | A GraphicsFormat that has a depth and/or stencil component. |

### Remarks

The depth bits are rounded up to 0, 16, 24 or 32 bits. The format is not guaranteed to have a stencil component. Returns the default format for the current platform if no supported format has the requested amount of bits for the depth component.

Additional Resources: [RenderTexture.depthStencilFormat](/engine/6000.7/script-reference/unityengine/rendertexture/depthstencilformat.md), [RenderTextureDescriptor.depthStencilFormat](/engine/6000.7/script-reference/unityengine/rendertexturedescriptor/depthstencilformat.md).
