当前位置: 首页>>代码示例>>C++>>正文


C++ IDXGIAdapter1::GetDesc1方法代码示例

本文整理汇总了C++中IDXGIAdapter1::GetDesc1方法的典型用法代码示例。如果您正苦于以下问题:C++ IDXGIAdapter1::GetDesc1方法的具体用法?C++ IDXGIAdapter1::GetDesc1怎么用?C++ IDXGIAdapter1::GetDesc1使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDXGIAdapter1的用法示例。


在下文中一共展示了IDXGIAdapter1::GetDesc1方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetHardwareAdapter

	// Helper function for acquiring the first available hardware adapter that supports Direct3D 12.
	// If no such adapter can be found, *ppAdapter will be set to nullptr.
	void Renderer::GetHardwareAdapter(_In_ IDXGIFactory4* pFactory, _Outptr_result_maybenull_ IDXGIAdapter1** ppAdapter)
	{
		IDXGIAdapter1* pAdapter = nullptr;
		*ppAdapter = nullptr;

		for(UINT adapterIndex = 0; DXGI_ERROR_NOT_FOUND != pFactory->EnumAdapters1(adapterIndex, &pAdapter); ++adapterIndex)
		{
			DXGI_ADAPTER_DESC1 desc;
			pAdapter->GetDesc1(&desc);

			if(desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE)
			{
				// Don't select the Basic Render Driver adapter.
				// If you want a software adapter, pass in "/warp" on the command line.
				continue;
			}

			// Check to see if the adapter supports Direct3D 12, but don't create the
			// actual device yet.
			if(SUCCEEDED(D3D12CreateDevice(pAdapter, D3D_FEATURE_LEVEL_12_1, _uuidof(ID3D12Device), nullptr)))
			{
				break;
			}
		}

		*ppAdapter = pAdapter;
	}
开发者ID:Slin,项目名称:leapBoxing,代码行数:29,代码来源:LBRenderer.cpp

示例2: modes

	void	D3D11Renderer::EnumerateDisplayModes()
	{
		IDXGIFactory1	*factory = 0;

		if (CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void **)&factory) == S_OK)
		{
			IDXGIAdapter1	*adapter = 0;
			for (UINT i = 0; factory->EnumAdapters1(i, &adapter) != DXGI_ERROR_NOT_FOUND; i++)
			{
				DXGI_ADAPTER_DESC1 ad;
				adapter->GetDesc1(&ad);

				char description[128];
				size_t n;
				wcstombs_s(&n, description, ad.Description, 128);

				ATOM_LOG("-------------------------------------------------------------------------------\n");
				ATOM_LOG("[info]: adapter[%d]: %s\n", i, description);
				ATOM_LOG("[info]: - revision: %d\n", i, ad.Revision);
				ATOM_LOG("[info]: - video memory: %d\n", i, ad.DedicatedVideoMemory / 1024 / 1024);
				ATOM_LOG("[info]: - system memory: %d\n", i, ad.DedicatedSystemMemory / 1024 / 1024);
				ATOM_LOG("[info]: - shared system memory: %d\n", i, ad.SharedSystemMemory / 1024 / 1024);

				IDXGIOutput	*output = 0;
				for (UINT j = 0; adapter->EnumOutputs(j, &output) != DXGI_ERROR_NOT_FOUND; j++)
				{
					UINT			modesCount;
					DXGI_FORMAT		format = g_settings.format;

					output->GetDisplayModeList(format, 0, &modesCount, 0);
					DXGI_MODE_DESC	*modeDescs = new DXGI_MODE_DESC[modesCount];
					output->GetDisplayModeList(format, 0, &modesCount, modeDescs);

					ATOM_LOG("[info]: - output %d display modes(%d)\n", j, modesCount);
					for (UINT k = 0; k < modesCount; k++)
					{
						ATOM_LOG("[info]: -- mode[%d]: %d * %d", k, modeDescs[k].Width, modeDescs[k].Height);
						ATOM_LOG(", refresh rate: %d/%d\n", modeDescs[i].RefreshRate.Numerator, modeDescs[i].RefreshRate.Denominator);
					}
					delete[] modeDescs;
					memory::SafeRelease(&output);
				}
				memory::SafeRelease(&adapter);
			}
		}
		memory::SafeRelease(&factory);
	}
开发者ID:dotminic,项目名称:code,代码行数:47,代码来源:D3D11Renderer.cpp

示例3:

	DXGI_RATIONAL	D3D11Renderer::GetDefaultRefreshRate()
	{
		DXGI_RATIONAL	refreshRate = {59, 1};
		IDXGIFactory1	*factory = 0;

		if (CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void **)&factory) == S_OK)
		{
			IDXGIAdapter1	*adapter = 0;
			for (UINT i = 0; factory->EnumAdapters1(i, &adapter) != DXGI_ERROR_NOT_FOUND; i++)
			{
				DXGI_ADAPTER_DESC1 ad;
				IDXGIOutput	*output = 0;

				adapter->GetDesc1(&ad);
				for (UINT j = 0; adapter->EnumOutputs(j, &output) != DXGI_ERROR_NOT_FOUND; j++)
				{
					UINT			modesCount;
					DXGI_FORMAT		format = g_settings.format;

					output->GetDisplayModeList(format, 0, &modesCount, 0);
					DXGI_MODE_DESC	*modeDescs = new DXGI_MODE_DESC[modesCount];
					output->GetDisplayModeList(format, 0, &modesCount, modeDescs);
					for (UINT k = 0; k < modesCount; k++)
					{
						if (modeDescs[k].Width == (UINT)g_settings.width &&
							modeDescs[k].Height == (UINT)g_settings.height)
						{
							refreshRate = modeDescs[i].RefreshRate;
							delete[] modeDescs;
							memory::SafeRelease(&output);
							memory::SafeRelease(&adapter);
							memory::SafeRelease(&factory);
							return refreshRate;
						}
					}
					delete[] modeDescs;
					memory::SafeRelease(&output);
				}
				memory::SafeRelease(&adapter);
			}
		}
		memory::SafeRelease(&factory);
		return refreshRate;
	}
开发者ID:dotminic,项目名称:code,代码行数:44,代码来源:D3D11Renderer.cpp

示例4: FindAdapter

bool CRenderer::FindAdapter(IDXGIFactory1** factory, IDXGIAdapter1** adapter)
{
	HRESULT hr = S_OK;
	IDXGIAdapter1 * pCurrentAdapter = nullptr;
	DXGI_ADAPTER_DESC1 Bestdesc;
	if (!factory) {
		Log("Cannot send in a NULL factory");
		return false;
	}
	if (!adapter) {
		Log("Cannot send in a NULL adapter");
		return false;
	}

	// Create a factory to enumerate all of the hardware in the system.
	DXCall(hr = CreateDXGIFactory1(__uuidof(IDXGIFactory), reinterpret_cast<void**>(factory)));

#pragma warning(suppress: 6102)
	if (!*factory) {
		Log("Could not create the factory");
		return false;
	}
	unsigned int index = 0;
	while (DXGI_ERROR_NOT_FOUND != (*factory)->EnumAdapters1(index++, &pCurrentAdapter)) {
		DXGI_ADAPTER_DESC1 desc;
		ZeroMemory(&desc, sizeof(desc));
		DXCall(pCurrentAdapter->GetDesc1(&desc));
		if (nullptr == *adapter) {
			*adapter = pCurrentAdapter;
			Bestdesc = desc;
		}
		else if (Bestdesc.DedicatedSystemMemory < desc.DedicatedSystemMemory) {
			(*adapter)->Release();
			*adapter = pCurrentAdapter;
			Bestdesc = desc;
		}
		else {
			pCurrentAdapter->Release();
		}
	}
	return true;
}
开发者ID:JPStank,项目名称:ParticleEditor,代码行数:42,代码来源:Renderer.cpp

示例5: wcscmp

	//-----------------------------------------------------------------------
	BOOL D3D11DriverList::enumerate(IDXGIFactory1*	pDXGIFactory)
	{
		LogManager::getSingleton().logMessage( "D3D11: Driver Detection Starts" );
		// Create the DXGI Factory

		for( UINT iAdapter=0; ; iAdapter++ )
		{
			IDXGIAdapter1*					pDXGIAdapter;
			HRESULT hr = pDXGIFactory->EnumAdapters1( iAdapter, &pDXGIAdapter );
			if( DXGI_ERROR_NOT_FOUND == hr )
			{
				hr = S_OK;
				break;
			}
			if( FAILED(hr) )
			{
				delete pDXGIAdapter;
				return false;
			}

			// we don't want NVIDIA PerfHUD in the list - so - here we filter it out
			DXGI_ADAPTER_DESC1 adaptDesc;
			if ( SUCCEEDED( pDXGIAdapter->GetDesc1( &adaptDesc ) ) )
			{
				const bool isPerfHUD = wcscmp( adaptDesc.Description, L"NVIDIA PerfHUD" ) == 0;

				if (isPerfHUD)
				{
					continue;
				}
			}

			D3D11Device dev;
			mDriverList.push_back(new D3D11Driver( dev,  iAdapter,pDXGIAdapter) );

		}

		LogManager::getSingleton().logMessage( "D3D11: Driver Detection Ends" );

		return TRUE;
	}
开发者ID:MrLobo,项目名称:El-Rayo-de-Zeus,代码行数:42,代码来源:OgreD3D11DriverList.cpp

示例6: descriptionw

bool DeviceDirect3D::getAdapterHandle(std::vector<IDXGIAdapter1*>* adapters)
{
	HRESULT hr;

	//Create DXGI factory
	IDXGIFactory1* dxgiFactory;
	hr = CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)(&dxgiFactory));
	if(FAILED(hr))
	{
		LOGERROR(hr, "CreateDXGIFactory1");
		return false;
	}

	//Get all the adapters
	UINT i = 0;
	IDXGIAdapter1* pAdapter = nullptr;
	while(dxgiFactory->EnumAdapters1(i, &pAdapter) != DXGI_ERROR_NOT_FOUND)
	{ 
		adapters->push_back(pAdapter);

		DXGI_ADAPTER_DESC1 desc;
		pAdapter->GetDesc1(&desc);
		std::wstring descriptionw(desc.Description);
		std::string description(descriptionw.begin(), descriptionw.end());
		Logger() << "Adapter found: (" << i << ") " << description;

		++i;
	}
	dxgiFactory->Release();

	if(adapters->empty())
	{
		LOGFUNCERROR("Your graphics card does not appear to support DirectX 10 or later");
		return false;
	}

	return true;
}
开发者ID:MadrMan,项目名称:gpgpuraytrace,代码行数:38,代码来源:DeviceDirect3D.cpp

示例7: EnumAllDeviceAdapter

void EnumAllDeviceAdapter(rhi::IDeviceAdapter ** & adapterList, uint32 * num)
{
	PtrGIFactory factory;
	HRESULT hr = ::CreateDXGIFactory1(IID_PPV_ARGS(factory.GetAddressOf()));
	K3D_ASSERT(hr == S_OK, "create dx factory failed.");
	vector<IDXGIAdapter1*> adapters;
	IDXGIAdapter1* pAdapter = nullptr;
	for (UINT adapterIndex = 0; DXGI_ERROR_NOT_FOUND != factory->EnumAdapters1(adapterIndex, &pAdapter); ++adapterIndex) {
		DXGI_ADAPTER_DESC1 desc;
		pAdapter->GetDesc1(&desc);
		if (desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) {
			continue;
		}
		if (SUCCEEDED(D3D12CreateDevice(pAdapter, D3D_FEATURE_LEVEL_11_0, __uuidof(ID3D12Device), nullptr))) {
			adapters.push_back(pAdapter);
		}
	}

	*num = (uint32)adapters.size();
	if (adapters.empty())
	{
		return;
	}

	adapterList = new rhi::IDeviceAdapter*[adapters.size()];
	for (uint32 index = 0; index < adapters.size(); index++)
	{
		DXGI_ADAPTER_DESC1 desc;
		adapters[index]->GetDesc1(&desc);
		GpuVendor vendor = MapIdToVendor(desc.VendorId);
		char VendorName[256] = { 0 };
		StringUtil::WCharToChar(desc.Description, VendorName, 256);
		DX12LOG(Info, "Device", "Vendor is %s, Id is %d.", VendorName, desc.VendorId);
		adapterList[index] = new DeviceAdapter(adapters[index], vendor);
	}
};
开发者ID:aonorin,项目名称:kaleido3d,代码行数:36,代码来源:D3D12Device.cpp

示例8: main

int main() {

  printf("\n\ntest_win_api_directx_research\n\n");

  /* Retrieve a IDXGIFactory that can enumerate the adapters. */
  IDXGIFactory1* factory = NULL;
  HRESULT hr = CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)(&factory));

  if (S_OK != hr) {
    printf("Error: failed to retrieve the IDXGIFactory.\n");
    exit(EXIT_FAILURE);
  }

  /* Enumerate the adapters.*/
  UINT i = 0;
  IDXGIAdapter1* adapter = NULL;
  std::vector<IDXGIAdapter1*> adapters; /* Needs to be Released(). */

  while (DXGI_ERROR_NOT_FOUND != factory->EnumAdapters1(i, &adapter)) {
    adapters.push_back(adapter);
    ++i;
  }

  /* Get some info about the adapters (GPUs). */
  for (size_t i = 0; i < adapters.size(); ++i) {
    
    DXGI_ADAPTER_DESC1 desc;
    adapter = adapters[i];
    hr = adapter->GetDesc1(&desc);
    
    if (S_OK != hr) {
      printf("Error: failed to get a description for the adapter: %lu\n", i);
      continue;
    }

    wprintf(L"Adapter: %lu, description: %s\n", i, desc.Description);
  }

  /* Check what devices/monitors are attached to the adapters. */
  UINT dx = 0;
  IDXGIOutput* output = NULL;
  std::vector<IDXGIOutput*> outputs; /* Needs to be Released(). */
  
  for (size_t i = 0; i < adapters.size(); ++i) {

    dx = 0;
    adapter = adapters[i];
    
    while (DXGI_ERROR_NOT_FOUND != adapter->EnumOutputs(dx, &output)) {
      printf("Found monitor %d on adapter: %lu\n", dx, i);
      outputs.push_back(output);
      ++dx;
    }
  }

  if (0 >= outputs.size()) {
    printf("Error: no outputs found (%lu).\n", outputs.size());
    exit(EXIT_FAILURE);
  }

  /* Print some info about the monitors. */
  for (size_t i = 0; i < outputs.size(); ++i) {
    
    DXGI_OUTPUT_DESC desc;
    output = outputs[i];
    hr = output->GetDesc(&desc);
    
    if (S_OK != hr) {
      printf("Error: failed to retrieve a DXGI_OUTPUT_DESC for output %lu.\n", i);
      continue;
    }

    wprintf(L"Monitor: %s, attached to desktop: %c\n", desc.DeviceName, (desc.AttachedToDesktop) ? 'y' : 'n');
  }

  /*

    To get access to a OutputDuplication interface we need to have a 
    Direct3D device which handles the actuall rendering and "gpu" 
    stuff. According to a gamedev stackexchange it seems we can create
    one w/o a HWND. 

   */

  ID3D11Device* d3d_device = NULL; /* Needs to be released. */
  ID3D11DeviceContext* d3d_context = NULL; /* Needs to be released. */
  IDXGIAdapter1* d3d_adapter = NULL;
  D3D_FEATURE_LEVEL d3d_feature_level; /* The selected feature level (D3D version), selected from the Feature Levels array, which is NULL here; when it's NULL the default list is used see:  https://msdn.microsoft.com/en-us/library/windows/desktop/ff476082%28v=vs.85%29.aspx ) */
  
  { /* Start creating a D3D11 device */

#if 1
    /* 
       NOTE:  Apparently the D3D11CreateDevice function returns E_INVALIDARG, when
              you pass a pointer to an adapter for the first parameter and use the 
              D3D_DRIVER_TYPE_HARDWARE. When you want to pass a valid pointer for the
              adapter, you need to set the DriverType parameter (2nd) to 
              D3D_DRIVER_TYPE_UNKNOWN.
             
              @todo figure out what would be the best solution; easiest to use is 
//.........这里部分代码省略.........
开发者ID:OriginalQverty,项目名称:screen_capture,代码行数:101,代码来源:test_win_api_directx_research.cpp

示例9: Close

bool DXGI1Device::Init(const mfxU32 adapterNum)
{
    // release the object before initialization
    Close();

    // load up the library if it is not loaded
    if (NULL == m_hModule)
    {
        LoadDLLModule(L"dxgi.dll");
    }

    if (m_hModule)
    {
        DXGICreateFactoryFunc pFunc;
        IDXGIFactory1 *pFactory;
        IDXGIAdapter1 *pAdapter;
        DXGI_ADAPTER_DESC1 desc;
        mfxU32 curAdapter, maxAdapters;
        HRESULT hRes;

        // load address of procedure to create DXGI 1.1 factory
        pFunc = (DXGICreateFactoryFunc) GetProcAddress(m_hModule, "CreateDXGIFactory1");
        if (NULL == pFunc)
        {
            return false;
        }

        // create the factory
#if _MSC_VER >= 1400
        hRes = pFunc(__uuidof(IDXGIFactory1), (void**) (&pFactory));
#else
        hRes = pFunc(IID_IDXGIFactory1, (void**) (&pFactory));
#endif
        if (FAILED(hRes))
        {
            return false;
        }
        m_pDXGIFactory1 = pFactory;

        // get the number of adapters
        curAdapter = 0;
        maxAdapters = 0;
        mfxU32 outputs = 0;
        do
        {
            // get the required adapted
            hRes = pFactory->EnumAdapters1(curAdapter, &pAdapter);
            if (FAILED(hRes))
            {
                break;
            }

            mfxU32 curOutput = 0;
            HRESULT h;
            do
            {
                IDXGIOutput *out;
                h = pAdapter->EnumOutputs(curOutput, &out);
                
                if(FAILED(h))
                    break;

                // if it is the required adapter, save the interface
                if (outputs == adapterNum)
                    m_pDXGIAdapter1 = pAdapter;

                out->Release();
                
                outputs += 1;
                curOutput += 1;
            } while(!m_pDXGIAdapter1 && SUCCEEDED(h));

            if(!m_pDXGIAdapter1)
                pAdapter->Release();

            curAdapter += 1;

        } while (!m_pDXGIAdapter1 && SUCCEEDED(hRes));
        maxAdapters = curAdapter;

        // there is no required adapter
        if (adapterNum >= outputs)
        {
            return false;
        }
        pAdapter = (IDXGIAdapter1 *) m_pDXGIAdapter1;

        // get the adapter's parameters
        hRes = pAdapter->GetDesc1(&desc);
        if (FAILED(hRes))
        {
            return false;
        }

        // save the parameters
        m_vendorID = desc.VendorId;
        m_deviceID = desc.DeviceId;
        *((LUID *) &m_luid) = desc.AdapterLuid;
    }

//.........这里部分代码省略.........
开发者ID:AaronMike,项目名称:OBS,代码行数:101,代码来源:mfx_dxva2_device.cpp

示例10: if

DeviceManager::DeviceManager(void)
	: m_pd3dDevice(NULL), 
	m_pImmediateContext(NULL),    
	m_pDXGIFactory1(NULL)
{	
    
	// create DXGIFactory, d3d device

	HRESULT hr = S_OK;

	// create dxgi factory and keep it for future use.	
	hr = CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)(&m_pDXGIFactory1) );
	if (Logger::IsFailureLog(hr))
	{
         return;
	}
    
    
	IDXGIAdapter1* pAdapter;    
    // hardware vendor ID
    uint32_t nvidia = 0x10DE;  // NVIDIA Corporation
    uint32_t ati  = 0x1002;    // ATI Technologies Inc. / Advanced Micro Devices, Inc.

    int i = 0;
    int adapterIndex = 0;

    printf("Available DXGIAdapters:\n");
    while(m_pDXGIFactory1->EnumAdapters1(i, &pAdapter) != DXGI_ERROR_NOT_FOUND) 
    {        
        DXGI_ADAPTER_DESC1 descr;
        pAdapter->GetDesc1(&descr);
        wprintf(L"\t%s\n",descr.Description);

        // choose discrete graphics over integrated.
        if(adapterIndex == 0 && (descr.VendorId == nvidia || descr.VendorId == ati))
        {
            adapterIndex = i;
        }
        i++;
        pAdapter->Release();
        pAdapter = NULL;
    }
    
	hr = m_pDXGIFactory1->EnumAdapters1(adapterIndex, &pAdapter);
	if (Logger::IsFailureLog(hr))
	{
         return;
	}

	
    UINT createDeviceFlags = 0;
#ifdef _DEBUG
    createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif

    /*D3D_DRIVER_TYPE driverTypes[] =
    {
        D3D_DRIVER_TYPE_HARDWARE,
        D3D_DRIVER_TYPE_WARP,
        D3D_DRIVER_TYPE_REFERENCE,
		
    };
    UINT numDriverTypes = ARRAYSIZE( driverTypes );*/

    D3D_FEATURE_LEVEL featureLevels[] =
    {
        D3D_FEATURE_LEVEL_11_0,
        D3D_FEATURE_LEVEL_10_1,
        D3D_FEATURE_LEVEL_10_0,
    };
	UINT numFeatureLevels = ARRAYSIZE( featureLevels );

	DXGI_ADAPTER_DESC1 pdescr;
	pAdapter->GetDesc1(&pdescr);
    Logger::Log(OutputMessageType::Info, L"%s\n",pdescr.Description);


    // Note: If you set the pAdapter parameter to a non-NULL value,
    //      you must also set the DriverType parameter 
    //      to the D3D_DRIVER_TYPE_UNKNOWN
    
	// create d3d11 device on the first graphics adapter.
	hr =  D3D11CreateDevice(
			pAdapter,
			D3D_DRIVER_TYPE_UNKNOWN,
			NULL,
			createDeviceFlags,
			featureLevels,
			numFeatureLevels,
			D3D11_SDK_VERSION,
			&m_pd3dDevice,
			NULL,
			&m_pImmediateContext);	
  		
	pAdapter->Release(); // no longer needed.

	if (Logger::IsFailureLog(hr))
	{
		return;
	}
//.........这里部分代码省略.........
开发者ID:EmmetCooper,项目名称:LevelEditor,代码行数:101,代码来源:DeviceManager.cpp

示例11: DetectGpuInfo

void DetectGpuInfo(std::ostream& os)
{
#if defined KLAYGE_PLATFORM_WINDOWS
	typedef HRESULT (WINAPI *CreateDXGIFactory1Func)(REFIID riid, void** ppFactory);

#if defined KLAYGE_PLATFORM_WINDOWS_DESKTOP
	HMODULE dxgi = ::LoadLibraryEx(L"dxgi.dll", nullptr, 0);
	if (!dxgi)
	{
		os << "Unknown GPU";
		return;
	}
	CreateDXGIFactory1Func DynamicCreateDXGIFactory1 = (CreateDXGIFactory1Func)::GetProcAddress(dxgi, "CreateDXGIFactory1");
	if (!DynamicCreateDXGIFactory1)
	{
		os << "Unknown GPU";
		return;
	}
#else
	CreateDXGIFactory1Func DynamicCreateDXGIFactory1 = CreateDXGIFactory1;
#endif

	IDXGIFactory1* factory;
	if (SUCCEEDED((*DynamicCreateDXGIFactory1)(IID_IDXGIFactory1, reinterpret_cast<void**>(&factory))))
	{
		UINT adapter_no = 0;
		IDXGIAdapter1* adapter = nullptr;
		while (factory->EnumAdapters1(adapter_no, &adapter) != DXGI_ERROR_NOT_FOUND)
		{
			if (adapter != nullptr)
			{
				DXGI_ADAPTER_DESC1 adapter_desc;
				adapter->GetDesc1(&adapter_desc);

				IDXGIAdapter2* adapter2;
				adapter->QueryInterface(IID_IDXGIAdapter2, reinterpret_cast<void**>(&adapter2));
				if (adapter2 != nullptr)
				{
					DXGI_ADAPTER_DESC2 desc2;
					adapter2->GetDesc2(&desc2);
					memcpy(adapter_desc.Description, desc2.Description, sizeof(desc2.Description));
					adapter_desc.VendorId = desc2.VendorId;
					adapter_desc.DeviceId = desc2.DeviceId;
					adapter_desc.SubSysId = desc2.SubSysId;
					adapter_desc.Revision = desc2.Revision;
					adapter_desc.DedicatedVideoMemory = desc2.DedicatedVideoMemory;
					adapter_desc.DedicatedSystemMemory = desc2.DedicatedSystemMemory;
					adapter_desc.SharedSystemMemory = desc2.SharedSystemMemory;
					adapter_desc.AdapterLuid = desc2.AdapterLuid;
					adapter_desc.Flags = desc2.Flags;
					adapter2->Release();
				}

				adapter->Release();

				if (adapter_desc.Flags != DXGI_ADAPTER_FLAG_SOFTWARE)
				{
					os << "Adapter " << adapter_no << endl << endl;
					std::string description;
					Convert(description, adapter_desc.Description);
					os << "Brand: " << description << endl;
					os << "Vendor ID: " << std::hex << std::uppercase << adapter_desc.VendorId << endl;
					os << "Device ID: " << std::hex << std::uppercase << adapter_desc.DeviceId << endl;
					os << "Revision: " << std::hex << std::uppercase << adapter_desc.Revision << endl;
					os << "Dedicated video memory: " << std::dec << adapter_desc.DedicatedVideoMemory / 1024 / 1024 << " MB" << endl;
					os << "Dedicated system memory: " << std::dec << adapter_desc.DedicatedSystemMemory / 1024 / 1024 << " MB" << endl;
					os << "Shared system memory: " << std::dec << adapter_desc.SharedSystemMemory / 1024 / 1024 << " MB" << endl;
				}
			}

			++ adapter_no;
		}
	}

#if defined KLAYGE_PLATFORM_WINDOWS_DESKTOP
	::FreeLibrary(dxgi);
#endif
#else
	os << "Unknown GPU" << endl;
#endif
}
开发者ID:BitYorkie,项目名称:KlayGE,代码行数:81,代码来源:HWCollect.cpp


注:本文中的IDXGIAdapter1::GetDesc1方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。