1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
/*=========================================================================
Program: Visualization Toolkit
Module: vtkDirectXGPUInfoList.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkDirectXGPUInfoList - Get GPUs VRAM information using DirectX.
// .SECTION Description
// vtkDirectXGPUInfoList implements Probe() method of vtkGPUInfoList
// through the DirectX API. As recommended by Microsoft, the WMI interface is
// used for Windows XP and the DXGI interface is used for Windows Vista and
// later. (see documentation of VideoMemory sample of the DirectX SDK)
// ref: http://msdn.microsoft.com/en-us/library/ee419018(v=VS.85)
// .SECTION See Also
// vtkGPUInfo vtkGPUInfoList
#ifndef vtkDirectXGPUInfoList_h
#define vtkDirectXGPUInfoList_h
#include "vtkRenderingOpenGLModule.h" // For export macro
#include "vtkGPUInfoList.h"
#include <d3d9.h> // DirectX, HMONITOR
class VTKRENDERINGOPENGL_EXPORT vtkDirectXGPUInfoList : public vtkGPUInfoList
{
public:
static vtkDirectXGPUInfoList* New();
vtkTypeMacro(vtkDirectXGPUInfoList, vtkGPUInfoList);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Build the list of vtkInfoGPU if not done yet.
// \post probed: IsProbed()
virtual void Probe();
protected:
// Description:
// Default constructor.
vtkDirectXGPUInfoList();
virtual ~vtkDirectXGPUInfoList();
// Description:
// Probe the GPUs with the DXGI api (Windows Vista or later).
// It returns true if it succeeded (DXGI API is supported and probing
// succeeded)
// \pre m_exists: m!=0
// \pre info_exist: info!=0
bool ProbeInfoWithDXGI(HMONITOR m,
vtkGPUInfo *info);
// Description:
// Probe the GPUs with the WMI api (Windows XP or later).
// \pre m_exists: m!=0
// \pre info_exist: info!=0
void ProbeInfoWithWMI(HMONITOR m,
vtkGPUInfo *info);
// Description:
// Used by ProbeInfoWithWMI().
// \pre pre hm_exists: hm!=0
// \pre strDeviceID_exists: strDeviceID!=0
// \pre cchDeviceID_is_positive: cchDeviceID>0
bool GetDeviceIDFromHMonitor(HMONITOR hm,
WCHAR *strDeviceID,
int cchDeviceID);
private:
vtkDirectXGPUInfoList(const vtkDirectXGPUInfoList&); // Not implemented.
void operator=(const vtkDirectXGPUInfoList&); // Not implemented.
};
#endif
|