Table of Contents

Class GraphicsMarshal

Namespace
Stride.Graphics
Assembly
Stride.Graphics.dll

An unsafe class that provides a set of methods to access the underlying native DXGI and Direct3D devices and resources from its Stride counterparts.

public static class GraphicsMarshal
Inheritance
object
GraphicsMarshal

Methods

CreateTextureFromNative(GraphicsDevice, ID3D11Texture2D*, bool, bool)

Creates a Texture from a Direct3D 11 texture.

public static Texture CreateTextureFromNative(GraphicsDevice device, ID3D11Texture2D* dxTexture2D, bool takeOwnership, bool isSRgb = false)

Parameters

device GraphicsDevice

The GraphicsDevice in use.

dxTexture2D ID3D11Texture2D*

The Direct3D 11 texture.

takeOwnership bool

false to call Silk.NET.Direct3D11.ID3D11Resource.AddRef() on the texture; true to not call it, effectively taking ownership of the texture.

isSRgb bool

A value indicating whether to set the format of the Texture to sRGB.

Returns

Texture

A Stride Texture.

GetNativeDevice(GraphicsDevice)

Gets the underlying Direct3D 11 native device.

public static ComPtr<ID3D11Device> GetNativeDevice(GraphicsDevice device)

Parameters

device GraphicsDevice

The Stride Graphics Device.

Returns

ComPtr<ID3D11Device>

A COM pointer to a Silk.NET.Direct3D11.ID3D11Device instance representing the native Direct3D 11 device.

GetNativeDeviceContext(GraphicsDevice)

Gets the underlying Direct3D 11 native device context.

public static ComPtr<ID3D11DeviceContext> GetNativeDeviceContext(GraphicsDevice device)

Parameters

device GraphicsDevice

The Stride Graphics Device.

Returns

ComPtr<ID3D11DeviceContext>

A COM pointer to a Silk.NET.Direct3D11.ID3D11DeviceContext instance representing the native Direct3D 11 command queue.

GetNativeRenderTargetView(Texture)

Gets the underlying Direct3D 11 native render target view.

public static ComPtr<ID3D11RenderTargetView> GetNativeRenderTargetView(Texture texture)

Parameters

texture Texture

Returns

ComPtr<ID3D11RenderTargetView>

A COM pointer to a Silk.NET.Direct3D11.ID3D11RenderTargetView instance representing the native Direct3D 11 render target view on the Texture.

GetNativeResource(GraphicsResource)

Gets the underlying Direct3D 11 native resource.

public static ComPtr<ID3D11Resource> GetNativeResource(GraphicsResource resource)

Parameters

resource GraphicsResource

The Stride Graphics Resource.

Returns

ComPtr<ID3D11Resource>

A COM pointer to a Silk.NET.Direct3D11.ID3D11Resource instance representing the native Direct3D 11 resource.

GetNativeShaderResourceView(GraphicsResource)

Gets the underlying Direct3D 11 native shader resource view.

public static ComPtr<ID3D11ShaderResourceView> GetNativeShaderResourceView(GraphicsResource resource)

Parameters

resource GraphicsResource

The Stride Graphics Resource.

Returns

ComPtr<ID3D11ShaderResourceView>

A COM pointer to a Silk.NET.Direct3D11.ID3D11ShaderResourceView instance representing the native Direct3D 11 shader resource view on the resource.

GetNativeSwapChain(GraphicsPresenter)

Gets the underlying DXGI swap-chain.

public static ComPtr<IDXGISwapChain1>? GetNativeSwapChain(GraphicsPresenter presenter)

Parameters

presenter GraphicsPresenter

The Stride Graphics Presenter.

Returns

ComPtr<IDXGISwapChain1>?

A COM pointer to a Silk.NET.DXGI.IDXGISwapChain instance representing the native DirectX swap-chain, or null if the presenter does not encapsulate a DXGI swap-chain.