I'm rewriting my DirectX rust project in C# and this piece of code (same logic of the rust project) throws an Acces Violation exception.
Actual behavior
var descriptorHeapDescription = new D3D12_DESCRIPTOR_HEAP_DESC()
{
NumDescriptors = 3,
Type = D3D12_DESCRIPTOR_HEAP_TYPE.D3D12_DESCRIPTOR_HEAP_TYPE_RTV
};
// Device is an object that implements ID3D12Device10.
Device.CreateDescriptorHeap(descriptorHeapDescription, typeof(ID3D12DescriptorHeap).GUID, out object descriptorHeap);
((ID3D12DescriptorHeap)descriptorHeap).GetCPUDescriptorHandleForHeapStart();
That last line where i call the .GetCPUDescriptorHandleForHeapStart() is where this exception is thrown:
Exception thrown at 0x00007FFB01900657 (D3D12Core.dll) in DirectXPInvoke.exe: 0xC0000005: Access violation writing location 0x0000000000000009.
Expected behavior
As this doesn't happen on rust and I'm basically translating from one language to another I expect this to work normally and return the handle.
I also put ID3D12Device10.CreateDescriptorHeap inside the preserveSigMethods of NativeMethods.json, and checked if the HRESULT of the Heap Creation was successful returning S_OK. It did create succesfully the heap.
I'm rewriting my DirectX rust project in C# and this piece of code (same logic of the rust project) throws an Acces Violation exception.
Actual behavior
That last line where i call the
.GetCPUDescriptorHandleForHeapStart()
is where this exception is thrown:Exception thrown at 0x00007FFB01900657 (D3D12Core.dll) in DirectXPInvoke.exe: 0xC0000005: Access violation writing location 0x0000000000000009.
Expected behavior
As this doesn't happen on rust and I'm basically translating from one language to another I expect this to work normally and return the handle. I also put
ID3D12Device10.CreateDescriptorHeap
inside thepreserveSigMethods
of NativeMethods.json, and checked if the HRESULT of the Heap Creation was successful returning S_OK. It did create succesfully the heap.Repro steps
NativeMethods.txt
content://=====DirectX Stuff===== D3D12GetDebugInterface D3D12CreateDevice
ID3D12CommandQueue ID3D12Debug ID3D12DescriptorHeap ID3D12Device ID3D12Device10 ID3D12Resource2
D3D_FEATURE_LEVEL
//=====DXGI Stuff===== CreateDXGIFactory2
IDXGIAdapter4 IDXGIFactory7 IDXGISwapChain4
DXGI_ADAPTER_FLAG DXGI_CREATE_FACTORY_DEBUG DXGI_MWA_NO_ALT_ENTER
Context