I'm calling
IDXGIOutput* output;
adapter->EnumOutputs(0, &output);
DXGIOutput outputInterface = DXGIOutput(output);
adapter is a DXGIAdapter* that I create with EnumAdapters1 from the factory object, it gives me no problems, I get the description and it properly gives me the GPU name when I take its DXGI_ADAPTER_DESC1.
DXGIOutput is just a thin wrapper that contains an IDXGIOutput* and has a SafeRelease(obj) macro used in it's destructor to release the contained IDXGIOutput*.This is the macro:
#define SafeRelease(obj) {if(obj){(obj)->Release();(obj)=nullptr;}}It's just the standart SafeRelease used across most tutorials, but It kept telling me this when SafeRelease was called:
Unhandled exception at 0x00150138 in Rendering.exe: 0xC0000005: Access violation executing location 0x00150138.
since I was only using DXGIOutput outputInterface temporarily, once it got killed at the end of the function and it's destructor got called.
So I change it to:
#define SafeRelease(obj) {if(obj){(obj)->Release();}}
And now it stopped giving me the error.However, on the call stack it says:
<Unknown function> Unknown
[Frames below may be incorrect and/or missing]
So after I fixed the problem with the destructor, the line above it(adapter->EnumOutputs(0, &output);) started to give me an
Unhandled exception at 0x7728A4DE (ntdll.dll) in Rendering.exe: 0xC0000005: Access violation reading location 0xFEEEFEF6.
And on the top of the call stack there's:
ntdll.dll!<Unknown function> Unknown[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]dxgi.dll!<Unknown function> Unknowndxgi.dll!<Unknown function> Unknowndxgi.dll!<Unknown function> Unknowndxgi.dll!<Unknown function> Unknown