Table of Contents

Class TextureExtensions

Namespace
Stride.Graphics
Assembly
Stride.Graphics.dll
public static class TextureExtensions
Inheritance
object
TextureExtensions

Methods

CreateDepthTextureCompatible(Texture)

Creates a Shader Resource View on a Depth-Stencil Texture.

public static Texture CreateDepthTextureCompatible(this Texture texture)

Parameters

texture Texture

The Texture to create a Depth-Stencil Texture View for.

Returns

Texture

A new Texture representing the Texture View bound to texture.

EnsureRenderTarget(Texture)

Verifies that a given Texture is a Render Target.

public static Texture EnsureRenderTarget(this Texture texture)

Parameters

texture Texture

Returns

Texture

Exceptions

ArgumentException

FromFileData(GraphicsDevice, byte[])

Creates a Texture from image file data.

public static Texture FromFileData(GraphicsDevice graphicsDevice, byte[] data)

Parameters

graphicsDevice GraphicsDevice

The graphics device in which to create the Texture.

data byte[]

The image file data.

Returns

Texture

The created Texture.

ToDepthStencilReadOnlyTexture(Texture)

Creates a Shader Resource View that is read-only on a Depth-Stencil Texture.

public static Texture ToDepthStencilReadOnlyTexture(this Texture texture)

Parameters

texture Texture

The Texture to create a read-only Depth-Stencil Texture View for.

Returns

Texture

A new Texture representing the Texture View bound to texture.

ToTextureView(Texture, ViewType, int, int)

Creates a Shader Resource View for a Texture.

public static Texture ToTextureView(this Texture texture, ViewType viewType, int arraySlice, int mipLevel)

Parameters

texture Texture

The Texture to create a Shader Resource View for.

viewType ViewType

One of the values of ViewType indicating which sub-resources from the Texture's mip hierarchy and array slices (if a Texture Array) the Shader Resource View can access.

arraySlice int

The index of the array slice. It is zero-based, so the first index is 0. If the Texture is not a Texture Array, specify 0.

mipLevel int

The index of the mip level. It is zero-based, so the first index is 0. If the Texture has no mip-chain, specify 0.

Returns

Texture

A new Texture representing the Texture View bound to texture.