public void ResourceFromTexture3D(Device device, Type bufferType) { using Texture3D <float> buffer = device.Get().AllocateTexture3D <float>(bufferType, 16, 16, 4); using ComPtr <ID3D12Resource> d3D12Resource = default; InteropServices.GetID3D12Resource(buffer, Windows.__uuidof <ID3D12Resource>(), (void **)d3D12Resource.GetAddressOf()); Assert.IsTrue(d3D12Resource.Get() != null); Assert.AreEqual(d3D12Resource.Get()->GetDesc().Dimension, D3D12_RESOURCE_DIMENSION_TEXTURE3D); d3D12Resource.Dispose(); int hResult = InteropServices.TryGetID3D12Resource(buffer, Windows.__uuidof <ID3D12Resource>(), (void **)d3D12Resource.GetAddressOf()); Assert.AreEqual(hResult, S.S_OK); Assert.IsTrue(d3D12Resource.Get() != null); Assert.AreEqual(d3D12Resource.Get()->GetDesc().Dimension, D3D12_RESOURCE_DIMENSION_TEXTURE3D); }
public void ResourceFromBuffer(Device device, Type bufferType) { using Buffer <float> buffer = device.Get().AllocateBuffer <float>(bufferType, 128); using ComPtr <ID3D12Resource> d3D12Resource = default; InteropServices.GetID3D12Resource(buffer, FX.__uuidof <ID3D12Resource>(), (void **)d3D12Resource.GetAddressOf()); Assert.IsTrue(d3D12Resource.Get() != null); Assert.AreEqual(d3D12Resource.Get()->GetDesc().Dimension, D3D12_RESOURCE_DIMENSION_BUFFER); d3D12Resource.Dispose(); int hResult = InteropServices.TryGetID3D12Resource(buffer, FX.__uuidof <ID3D12Resource>(), (void **)d3D12Resource.GetAddressOf()); Assert.AreEqual(hResult, FX.S_OK); Assert.IsTrue(d3D12Resource.Get() != null); Assert.AreEqual(d3D12Resource.Get()->GetDesc().Dimension, D3D12_RESOURCE_DIMENSION_BUFFER); }