Table of Contents

Class ShaderResourceViewProxy

Namespace
HelixToolkit.SharpDX.Utilities
Assembly
HelixToolkit.SharpDX.dll

A proxy container to handle view resources

public class ShaderResourceViewProxy : DisposeObject, IDisposable
Inheritance
ShaderResourceViewProxy
Implements
Inherited Members

Constructors

ShaderResourceViewProxy(Device)

Initializes a new instance of the ShaderResourceViewProxy class.

public ShaderResourceViewProxy(Device device)

Parameters

device Device

The device.

ShaderResourceViewProxy(Device, Resource)

public ShaderResourceViewProxy(Device device, Resource resource)

Parameters

device Device
resource Resource

ShaderResourceViewProxy(Device, Texture1DDescription)

Initializes a new instance of the ShaderResourceViewProxy class.

public ShaderResourceViewProxy(Device device, Texture1DDescription textureDesc)

Parameters

device Device

The device.

textureDesc Texture1DDescription

The texture desc.

ShaderResourceViewProxy(Device, ref Texture1DDescription)

Initializes a new instance of the ShaderResourceViewProxy class.

public ShaderResourceViewProxy(Device device, ref Texture1DDescription textureDesc)

Parameters

device Device

The device.

textureDesc Texture1DDescription

The texture desc.

ShaderResourceViewProxy(Device, Texture2DDescription)

Initializes a new instance of the ShaderResourceViewProxy class.

public ShaderResourceViewProxy(Device device, Texture2DDescription textureDesc)

Parameters

device Device

The device.

textureDesc Texture2DDescription

The texture desc.

ShaderResourceViewProxy(Device, ref Texture2DDescription)

Initializes a new instance of the ShaderResourceViewProxy class.

public ShaderResourceViewProxy(Device device, ref Texture2DDescription textureDesc)

Parameters

device Device

The device.

textureDesc Texture2DDescription

The texture desc.

ShaderResourceViewProxy(Device, Texture3DDescription)

Initializes a new instance of the ShaderResourceViewProxy class.

public ShaderResourceViewProxy(Device device, Texture3DDescription textureDesc)

Parameters

device Device

The device.

textureDesc Texture3DDescription

The texture desc.

ShaderResourceViewProxy(Device, ref Texture3DDescription)

Initializes a new instance of the ShaderResourceViewProxy class.

public ShaderResourceViewProxy(Device device, ref Texture3DDescription textureDesc)

Parameters

device Device

The device.

textureDesc Texture3DDescription

The texture desc.

ShaderResourceViewProxy(ShaderResourceView)

Initializes a new instance of the ShaderResourceViewProxy class.

public ShaderResourceViewProxy(ShaderResourceView view)

Parameters

view ShaderResourceView

The view.

Properties

DepthStencilView

Gets the depth stencil view.

public DepthStencilView? DepthStencilView { get; }

Property Value

DepthStencilView

The depth stencil view.

Empty

public static ShaderResourceViewProxy Empty { get; }

Property Value

ShaderResourceViewProxy

Guid

public Guid Guid { get; set; }

Property Value

Guid

RenderTargetView

Gets the render target view.

public RenderTargetView? RenderTargetView { get; }

Property Value

RenderTargetView

The render target view.

Resource

Gets the resource.

public Resource? Resource { get; }

Property Value

Resource

The resource.

TextureFormat

public Format TextureFormat { get; }

Property Value

Format

TextureView

Gets the texture view.

public ShaderResourceView? TextureView { get; }

Property Value

ShaderResourceView

The texture view.

Methods

CreateDepthStencilView()

public void CreateDepthStencilView()

CreateDepthStencilView(DepthStencilViewDescription)

public void CreateDepthStencilView(DepthStencilViewDescription desc)

Parameters

desc DepthStencilViewDescription

CreateDepthStencilView(ref DepthStencilViewDescription)

public void CreateDepthStencilView(ref DepthStencilViewDescription desc)

Parameters

desc DepthStencilViewDescription

CreateRenderTargetView()

Creates the render target.

public void CreateRenderTargetView()

CreateTextureView()

Creates the view.

public void CreateTextureView()

CreateTextureView(ShaderResourceViewDescription)

Creates the view.

public void CreateTextureView(ShaderResourceViewDescription desc)

Parameters

desc ShaderResourceViewDescription

CreateTextureView(ref ShaderResourceViewDescription)

Creates the view.

public void CreateTextureView(ref ShaderResourceViewDescription desc)

Parameters

desc ShaderResourceViewDescription

CreateView(TextureModel?, bool, bool)

Creates the view from texture model.

public void CreateView(TextureModel? texture, bool createSRV = true, bool enableAutoGenMipMap = true)

Parameters

texture TextureModel

The stream.

createSRV bool

Create ShaderResourceView

enableAutoGenMipMap bool

Enable auto mipmaps generation

Exceptions

ArgumentOutOfRangeException

CreateView(DepthStencilViewDescription)

Creates the view.

public void CreateView(DepthStencilViewDescription desc)

Parameters

desc DepthStencilViewDescription

The desc.

CreateView(Device, Stream, bool, bool)

Creates ShaderResourceViewProxy from common file formats such as Jpg, Bmp, DDS, Png, etc

public static ShaderResourceViewProxy CreateView(Device device, Stream texture, bool createSRV = true, bool generateMipMaps = true)

Parameters

device Device

The device.

texture Stream

The texture.

createSRV bool

if set to true [create SRV].

generateMipMaps bool

Returns

ShaderResourceViewProxy

CreateView(Device, nint, int, int, Format, bool, bool)

Creates the 2D texture view from raw pixel byte array

public static ShaderResourceViewProxy CreateView(Device device, nint dataPtr, int width, int height, Format format, bool createSRV = true, bool generateMipMaps = true)

Parameters

device Device

The device.

dataPtr nint

The data PTR.

width int

The width.

height int

The height.

format Format

The format.

createSRV bool

if set to true [create SRV].

generateMipMaps bool

Returns

ShaderResourceViewProxy

CreateView(RenderTargetViewDescription)

Creates the view.

public void CreateView(RenderTargetViewDescription desc)

Parameters

desc RenderTargetViewDescription

The desc.

CreateView(ShaderResourceViewDescription)

Creates the view.

public void CreateView(ShaderResourceViewDescription desc)

Parameters

desc ShaderResourceViewDescription

The desc.

CreateView(nint, int, Format, bool, bool)

Creates the shader resource view from data ptr.

public void CreateView(nint dataPtr, int width, Format format, bool createSRV = true, bool generateMipMaps = true)

Parameters

dataPtr nint

The data PTR.

width int

The width.

format Format

The format.

createSRV bool

if set to true [create SRV].

generateMipMaps bool

CreateView(nint, int, int, Format, bool, bool)

Creates the shader resource view from data ptr.

public void CreateView(nint dataPtr, int width, int height, Format format, bool createSRV = true, bool generateMipMaps = true)

Parameters

dataPtr nint

The data PTR.

width int

The width.

height int

The height.

format Format

The format.

createSRV bool

if set to true [create SRV].

generateMipMaps bool

CreateView(nint, int, int, int, Format, bool, bool)

Creates the view.

public void CreateView(nint dataPtr, int width, int height, int depth, Format format, bool createSRV = true, bool generateMipMaps = true)

Parameters

dataPtr nint
width int

The width.

height int

The height.

depth int

The depth.

format Format

The format.

createSRV bool

if set to true [create SRV].

generateMipMaps bool

CreateViewFromColorArray(Color4[])

Creates the 1D texture view from color array.

public void CreateViewFromColorArray(Color4[] array)

Parameters

array Color4[]

The array.

CreateViewFromColorArray(Color4[], int, int, bool, bool)

Creates the 2D texture view from color array.

public void CreateViewFromColorArray(Color4[] array, int width, int height, bool createSRV = true, bool generateMipMaps = true)

Parameters

array Color4[]

The array.

width int

The width.

height int

The height.

createSRV bool
generateMipMaps bool

CreateViewFromColorArray(Device, Color4[])

Creates the 1D texture view from color array.

public static ShaderResourceViewProxy CreateViewFromColorArray(Device device, Color4[] array)

Parameters

device Device
array Color4[]

The array.

Returns

ShaderResourceViewProxy

CreateViewFromColorArray(Device, Color4[], int, int, bool, bool)

Creates the 2D texture view from color array.

public static ShaderResourceViewProxy CreateViewFromColorArray(Device device, Color4[] array, int width, int height, bool createSRV = true, bool generateMipMaps = true)

Parameters

device Device
array Color4[]

The array.

width int

The width.

height int

The height.

createSRV bool
generateMipMaps bool

Returns

ShaderResourceViewProxy

CreateViewFromPixelData(Device, Half4[], int, int, int, Format, bool, bool)

Creates the view from pixel data.

public static ShaderResourceViewProxy CreateViewFromPixelData(Device device, Half4[] pixels, int width, int height, int depth, Format format, bool createSRV = true, bool generateMipMaps = true)

Parameters

device Device

The device.

pixels Half4[]

The pixels.

width int

The width.

height int

The height.

depth int

The depth.

format Format

The format.

createSRV bool

if set to true [create SRV].

generateMipMaps bool

if set to true [generate mip maps].

Returns

ShaderResourceViewProxy

CreateViewFromPixelData(Device, byte[], int, int, int, Format, bool, bool)

Creates the 3D texture view from raw pixel array

public static ShaderResourceViewProxy CreateViewFromPixelData(Device device, byte[] pixels, int width, int height, int depth, Format format, bool createSRV = true, bool generateMipMaps = true)

Parameters

device Device

The device.

pixels byte[]

The pixels.

width int

The width.

height int

The height.

depth int

The depth.

format Format

The format.

createSRV bool

if set to true [create SRV].

generateMipMaps bool

Returns

ShaderResourceViewProxy

CreateViewFromPixelData(Device, nint, int, int, int, Format, bool, bool)

Creates the view from pixel data.

public static ShaderResourceViewProxy CreateViewFromPixelData(Device device, nint pixels, int width, int height, int depth, Format format, bool createSRV = true, bool generateMipMaps = true)

Parameters

device Device

The device.

pixels nint

The pixels.

width int

The width.

height int

The height.

depth int

The depth.

format Format

The format.

createSRV bool

if set to true [create SRV].

generateMipMaps bool

Returns

ShaderResourceViewProxy

CreateView<T>(Device, T[], Format, bool, bool)

Creates ShaderResourceViewProxy from 2D texture array

public static ShaderResourceViewProxy CreateView<T>(Device device, T[] array, Format format, bool createSRV = true, bool generateMipMaps = true) where T : unmanaged

Parameters

device Device

The device.

array T[]

The array.

format Format

The format.

createSRV bool

if set to true [create SRV].

generateMipMaps bool

Returns

ShaderResourceViewProxy

Type Parameters

T

CreateView<T>(Device, T[], int, int, Format, bool, bool)

Creates the 2D texture view from data array

public static ShaderResourceViewProxy CreateView<T>(Device device, T[] array, int width, int height, Format format, bool createSRV = true, bool generateMipMaps = true) where T : unmanaged

Parameters

device Device

The device.

array T[]

The array.

width int

The width.

height int

The height.

format Format

The format.

createSRV bool

if set to true [create SRV].

generateMipMaps bool

Returns

ShaderResourceViewProxy

Type Parameters

T

CreateView<T>(T[], Format, bool, bool)

Creates the 1D texture view from data array.

public void CreateView<T>(T[] array, Format format, bool createSRV = true, bool generateMipMaps = true) where T : unmanaged

Parameters

array T[]

The array.

format Format

The format.

createSRV bool

if set to true [create SRV].

generateMipMaps bool

if set to true [generate mip maps].

Type Parameters

T

CreateView<T>(T[], int, Format, bool, bool)

Creates the 1D texture view from data array.

public void CreateView<T>(T[] array, int length, Format format, bool createSRV = true, bool generateMipMaps = true) where T : unmanaged

Parameters

array T[]

The array.

length int

data length

format Format

The pixel format.

createSRV bool

if set to true [create SRV].

generateMipMaps bool

Type Parameters

T

CreateView<T>(T[], int, int, Format, bool, bool)

Creates the 2D texture view from data array.

public void CreateView<T>(T[] array, int width, int height, Format format, bool createSRV = true, bool generateMipMaps = true) where T : unmanaged

Parameters

array T[]

The array.

width int

The width.

height int

The height.

format Format

The format.

createSRV bool

if set to true [create SRV].

generateMipMaps bool

Type Parameters

T

Exceptions

ArgumentOutOfRangeException

CreateView<T>(T[], int, int, int, Format, bool, bool)

Creates the view from 3D texture byte array.

public void CreateView<T>(T[] pixels, int width, int height, int depth, Format format, bool createSRV = true, bool generateMipMaps = true) where T : unmanaged

Parameters

pixels T[]

The pixels.

width int

The width.

height int

The height.

depth int

The depth.

format Format

The format.

createSRV bool

if set to true [create SRV].

generateMipMaps bool

Type Parameters

T

Exceptions

ArgumentOutOfRangeException

OnDispose(bool)

Disposes of object resources.

protected override void OnDispose(bool disposeManagedResources)

Parameters

disposeManagedResources bool

If true, managed resources should be disposed of in addition to unmanaged resources.

Operators

implicit operator DepthStencilView?(ShaderResourceViewProxy?)

Performs an implicit conversion from ShaderResourceViewProxy to DepthStencilView.

public static implicit operator DepthStencilView?(ShaderResourceViewProxy? proxy)

Parameters

proxy ShaderResourceViewProxy

The proxy.

Returns

DepthStencilView

The result of the conversion.

implicit operator RenderTargetView?(ShaderResourceViewProxy?)

Performs an implicit conversion from ShaderResourceViewProxy to RenderTargetView.

public static implicit operator RenderTargetView?(ShaderResourceViewProxy? proxy)

Parameters

proxy ShaderResourceViewProxy

The proxy.

Returns

RenderTargetView

The result of the conversion.

implicit operator ShaderResourceView?(ShaderResourceViewProxy?)

Performs an implicit conversion from ShaderResourceViewProxy to SharpDX.Direct3D11.ShaderResourceView.

public static implicit operator ShaderResourceView?(ShaderResourceViewProxy? proxy)

Parameters

proxy ShaderResourceViewProxy

The proxy.

Returns

ShaderResourceView

The result of the conversion.