Closed jarmohh closed 7 years ago
You should use the constructor public Texture2D1(Device3 device, Texture2DDescription1 description)
Here's my depth stencil code ..
depthStencilTexture = new Texture2D(Dx11Graphics.Device3d, new Texture2DDescription()
{
Format = Format.D16_UNorm,
ArraySize = 1,
MipLevels = 1,
Width = width,
Height = height,
SampleDescription = new SampleDescription(1, 0),
Usage = ResourceUsage.Default,
BindFlags = BindFlags.DepthStencil,
CpuAccessFlags = CpuAccessFlags.None,
OptionFlags = ResourceOptionFlags.None
});
{
depthStencilView = new DepthStencilView(Dx11Graphics.Device3d, depthStencilTexture);
}
.. xoofx just answered. But I would add that I almost never use NativePointers for day to day SharpDX code. Always go for the 'managed style' option, SharpDX is 100% (or near to) written for typical C# code style.
Thanks I must try this. Hope that do what I want. depthStencilView = new DepthStencilView(Dx11Graphics.Device3d, depthStencilTexture);
This does not exist in latest UWP public Texture2D1(Device3 device, Texture2DDescription1 description) It exist in Texture2D but not in Texture2D1. That is why I ask :) Only one constructor and only one parameter.
Latest UWP nuget paket v3.1.1. Picture of error in VS2015.
ah yes, it was maybe added after. You can grab dll directly from latest artifacts
I have other same kind of problems. Look pictures. SharpDX.Direct2D1.Factory3 and SharpDX.DirectWrite.Factory3 has only one constuctor with nativepointer. One of the nuget was old, when I update that it resolve first problem :), but not those.
I take latest artifacts, still those two has only one constructor with nativepointer parameter.
I am creating template UWP project to windows. I an porting default C++ template to C# to create xbox (and other) C# UWP projects. Some issues left. So I create Texture2DDescription1 and next is Texture2D1. There is only one constructor with native pointer. Question is how to create Texture2D1.
C++ code CD3D11_TEXTURE2D_DESC1 depthStencilDesc(DXGI_FORMAT_D24_UNORM_S8_UINT, lround(m_d3dRenderTargetSize.Width), lround(m_d3dRenderTargetSize.Height), 1, 1, D3D11_BIND_DEPTH_STENCIL);
C# code Texture2DDescription1 depthStencilDesc = new Texture2DDescription1(); depthStencilDesc.Format = Format.D24_UNorm_S8_UInt; depthStencilDesc.Width = (int)_d3dRenderTargetSize.Width; depthStencilDesc.Height = (int)_d3dRenderTargetSize.Height; depthStencilDesc.ArraySize = 0; depthStencilDesc.MipLevels = 1; depthStencilDesc.BindFlags = BindFlags.DepthStencil;
//THIS DOES NOT WORK SharpDX.Direct3D11.Texture2D1 depthStencil = new Texture2D1(_d3dDevice.NativePointer);
How to create Texture2D1 with Texture2DDescription1 ?