Esempio n. 1
0
 private static UniqueComPtr <ID3D12Debug> GetDebug(out SupportedDebugLayer supportedLayer)
 {
     using UniqueComPtr <ID3D12Debug> debug = default;
     Guard.TryGetInterface(D3D12GetDebugInterface(debug.Iid, (void **)&debug));
     supportedLayer = debug.HasInterface <ID3D12Debug3>() ? SupportedDebugLayer.Debug3 : SupportedDebugLayer.Debug;
     return(debug.Move());
 }
Esempio n. 2
0
        private static UniqueComPtr <IDXGraphicsAnalysis> GetPixIfAttached()
        {
            using UniqueComPtr <IDXGraphicsAnalysis> analysis = default;
            Guard.TryGetInterface(DXGIGetDebugInterface1(0, analysis.Iid, (void **)&analysis));
            if (analysis.Exists)
            {
                LogHelper.LogInformation("PIX debugger is attached");
            }

            return(analysis.Move());
        }
Esempio n. 3
0
        private static Guid *Initialize()
        {
            UniqueComPtr <IUnknown> p = default;

            Debug.Assert(ComPtr.GetAddressOf(&p) == &p._ptr);

            // *probably* not a valid COM type without a GUID
#if REFLECTION
            Debug.Assert(typeof(T).GetCustomAttribute <GuidAttribute>() is not null);
#endif

            var ptr = (Guid *)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(T), sizeof(Guid));
            *ptr = typeof(T).GUID;
            return(ptr);
        }
Esempio n. 4
0
//        [DebuggerNonUserCode]
//        public static void PossibleDeviceDisconnect(this ComputeDevice device)
//            => PossibleDeviceDisconnect(device.Get());

//        [DebuggerNonUserCode]
//        public static void PossibleDeviceDisconnect(ID3D12Device* device)
//        {
//#if !DEBUG
//            throw new Exception("This should never even be present in release builds. Use only for specific debug issues");
//#else
//            var reason = device->GetDeviceRemovedReason();
//            if (reason == Windows.S_OK)
//            {
//                return;
//            }

//            /* inspect this */
//            throw new DeviceDisconnectedException("Device disconnected unexpectedly", reason);
//#endif
//        }

        public static bool IsDeviceRemoved(this UniqueComPtr <ID3D12Device> device) =>
        device.Ptr->GetDeviceRemovedReason() != Windows.S_OK;
Esempio n. 5
0
 private static UniqueComPtr <ID3D12DeviceRemovedExtendedDataSettings1> GetDred()
 {
     using UniqueComPtr <ID3D12DeviceRemovedExtendedDataSettings1> dredSettings = default;
     Guard.TryGetInterface(D3D12GetDebugInterface(dredSettings.Iid, (void **)&dredSettings));
     return(dredSettings.Move());
 }
Esempio n. 6
0
 private static UniqueComPtr <IDXGIDebug1> GetDxgiDebug()
 {
     using UniqueComPtr <IDXGIDebug1> debug = default;
     Guard.TryGetInterface(DXGIGetDebugInterface1(0, debug.Iid, (void **)&debug));
     return(debug.Move());
 }
 public D3DBlobMemoryManager(UniqueComPtr <ID3DBlob> blob)
 {
     _blob = blob.Move();
 }