diff --git a/src/D3DHost/D3DHost_View.cxx b/src/D3DHost/D3DHost_View.cxx index fc61996613..cf573e7664 100644 --- a/src/D3DHost/D3DHost_View.cxx +++ b/src/D3DHost/D3DHost_View.cxx @@ -24,6 +24,16 @@ IMPLEMENT_STANDARD_RTTIEXT(D3DHost_View,OpenGl_View) +namespace +{ + enum D3DHost_VendorId + { + D3DHost_VendorId_AMD = 0x1002, + D3DHost_VendorId_NVIDIA = 0x10DE, + D3DHost_VendorId_Intel = 0x8086, + }; +} + // ======================================================================= // function : d3dFormatError // purpose : @@ -130,6 +140,51 @@ void D3DHost_View::SetWindow (const Handle(Aspect_Window)& theWindow, } } +// ======================================================================= +// function : DiagnosticInformation +// purpose : +// ======================================================================= +void D3DHost_View::DiagnosticInformation (TColStd_IndexedDataMapOfStringString& theDict, + Graphic3d_DiagnosticInfo theFlags) const +{ + base_type::DiagnosticInformation (theDict, theFlags); + if (myD3dDevice == NULL) + { + return; + } + + D3DCAPS9 aDevCaps; + memset (&aDevCaps, 0, sizeof(aDevCaps)); + if (myD3dDevice->GetDeviceCaps (&aDevCaps) < 0) + { + return; + } + + const UINT anAdapter = aDevCaps.AdapterOrdinal; + D3DADAPTER_IDENTIFIER9 aDevId; + memset (&aDevId, 0, sizeof(aDevId)); + if (myD3dLib->GetAdapterIdentifier (anAdapter, 0, &aDevId) < 0) + { + return; + } + + TCollection_AsciiString aVendorId ((int )aDevId.VendorId); + switch (aDevId.VendorId) + { + case D3DHost_VendorId_AMD: aVendorId = "AMD"; break; + case D3DHost_VendorId_NVIDIA: aVendorId = "NVIDIA"; break; + case D3DHost_VendorId_Intel: aVendorId = "Intel"; break; + } + theDict.Add ("D3Dvendor", aVendorId); + theDict.Add ("D3Ddescription", aDevId.Description); + theDict.Add ("D3DdeviceName", aDevId.DeviceName); + theDict.Add ("D3Ddriver", aDevId.Driver); + theDict.Add ("D3DdeviceId", TCollection_AsciiString((int )aDevId.DeviceId)); + theDict.Add ("D3Dinterop", myD3dWglFbo.IsNull() || myD3dWglFbo->D3dFallback() + ? "Software Fallback" + : "WGL_NV_DX_interop"); +} + // ======================================================================= // function : d3dInitLib // purpose : diff --git a/src/D3DHost/D3DHost_View.hxx b/src/D3DHost/D3DHost_View.hxx index 47b4bb12db..baa599979f 100644 --- a/src/D3DHost/D3DHost_View.hxx +++ b/src/D3DHost/D3DHost_View.hxx @@ -58,6 +58,11 @@ public: //! Redraw only immediate layer. Standard_EXPORT virtual void RedrawImmediate() Standard_OVERRIDE; + //! Fill in the dictionary with diagnostic info. + //! Should be called within rendering thread. + Standard_EXPORT virtual void DiagnosticInformation (TColStd_IndexedDataMapOfStringString& theDict, + Graphic3d_DiagnosticInfo theFlags) const Standard_OVERRIDE; + public: //! @return true if IDirect3DDevice9Ex device has been created