您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CreateDXGIFactory1函数代码示例

51自学网 2021-06-01 20:14:16
  C++
这篇教程C++ CreateDXGIFactory1函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中CreateDXGIFactory1函数的典型用法代码示例。如果您正苦于以下问题:C++ CreateDXGIFactory1函数的具体用法?C++ CreateDXGIFactory1怎么用?C++ CreateDXGIFactory1使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

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

示例1: main

int main(int argc, char** argv){	IDXGIFactory1* factory = 0;	CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)&factory);	IDXGIAdapter* adapter = NULL;	for (unsigned int index = 0; SUCCEEDED(factory->EnumAdapters(index, &adapter)); ++index)	{		DXGI_ADAPTER_DESC ad = {};		adapter->GetDesc(&ad);		if (ad.VendorId == 0x1414 && ad.DeviceId == 0x8c)			continue; // Skip Microsoft Basic Render Driver		printf("// GPU %d: %S (Vendor %04x Device %04x)/n", index, ad.Description, ad.VendorId, ad.DeviceId);		if (argc == 1)		{			testCache(adapter);		}		else if (argc > 1 && strcmp(argv[1], "--") == 0)		{			testCacheSequence(adapter, argc, argv);		}		else		{			testCacheMeshes(adapter, argc, argv);		}	}}
开发者ID:MikePopoloski,项目名称:bgfx,代码行数:30,


示例2: CHECKED

void DesktopDuplication::init(){	IDXGIFactory1* dxgiFactory = nullptr;	CHECKED(hr, CreateDXGIFactory1(__uuidof(IDXGIFactory1), reinterpret_cast<void**>(&dxgiFactory)));	IDXGIAdapter1* dxgiAdapter = nullptr;	CHECKED(hr, dxgiFactory->EnumAdapters1(adapter, &dxgiAdapter));	dxgiFactory->Release();	CHECKED(hr, D3D11CreateDevice(dxgiAdapter,		D3D_DRIVER_TYPE_UNKNOWN,		NULL,		NULL,		NULL,		NULL,		D3D11_SDK_VERSION,		&d3dDevice,		NULL,		&d3dContext));	IDXGIOutput* dxgiOutput = nullptr;	CHECKED(hr, dxgiAdapter->EnumOutputs(output, &dxgiOutput));	dxgiAdapter->Release();	IDXGIOutput1* dxgiOutput1 = nullptr;	CHECKED(hr, dxgiOutput->QueryInterface(__uuidof(dxgiOutput1), reinterpret_cast<void**>(&dxgiOutput1)));	dxgiOutput->Release();	IDXGIDevice* dxgiDevice = nullptr;	CHECKED(hr, d3dDevice->QueryInterface(__uuidof(IDXGIDevice), reinterpret_cast<void**>(&dxgiDevice)));	CHECKED(hr, dxgiOutput1->DuplicateOutput(dxgiDevice, &outputDuplication));	dxgiOutput1->Release();	dxgiDevice->Release();}
开发者ID:filinger,项目名称:blitzle,代码行数:35,


示例3: EnumD3DAdapters

static inline void EnumD3DAdapters(		bool (*callback)(void*, const char*, uint32_t),		void *param){	ComPtr<IDXGIFactory1> factory;	ComPtr<IDXGIAdapter1> adapter;	HRESULT hr;	UINT i = 0;	IID factoryIID = (GetWinVer() >= 0x602) ? dxgiFactory2 :		__uuidof(IDXGIFactory1);	hr = CreateDXGIFactory1(factoryIID, (void**)factory.Assign());	if (FAILED(hr))		throw HRError("Failed to create DXGIFactory", hr);	while (factory->EnumAdapters1(i++, adapter.Assign()) == S_OK) {		DXGI_ADAPTER_DESC desc;		char name[512] = "";		hr = adapter->GetDesc(&desc);		if (FAILED(hr))			continue;		/* ignore microsoft's 'basic' renderer' */		if (desc.VendorId == 0x1414 && desc.DeviceId == 0x8c)			continue;		os_wcs_to_utf8(desc.Description, 0, name, sizeof(name));		if (!callback(param, name, i - 1))			break;	}}
开发者ID:Glought,项目名称:obs-studio,代码行数:34,


示例4: printf

IDXGIAdapter* spoutDirectX::GetAdapterPointer(int index){	// printf("spoutDirectX::GetAdapterPointer(%d)/n", index);	// Enum Adapters first : multiple video cards	IDXGIFactory1*	_dxgi_factory1;	if ( FAILED( CreateDXGIFactory1( __uuidof(IDXGIFactory1), (void**)&_dxgi_factory1 ) ) )	{		printf( "    Could not create CreateDXGIFactory1/n" );		return nullptr;	}	IDXGIAdapter* adapter1_ptr = nullptr;	for ( UINT32 i = 0; _dxgi_factory1->EnumAdapters( i, &adapter1_ptr ) != DXGI_ERROR_NOT_FOUND; i++ )	{		if ( index == (int)i ) {			// printf("   Adapter %d matches/n", i);			// Now we have the requested adapter, but does it support the required extensions			_dxgi_factory1->Release();			return adapter1_ptr;		}		else {			// printf("   Adapter %d found/n", i);		}		adapter1_ptr->Release();	}	// printf("   Adapter %d not found/n", index);	_dxgi_factory1->Release();	return nullptr;}
开发者ID:sheridanis,项目名称:ofxSpout2,代码行数:31,


示例5: __uuidof

bool CDuplicateOutputDx11::GetSpecificAdapter(int idAdapter, IDXGIAdapter** pAdapter){	HRESULT err = S_OK;	if (!pAdapter)	{		return false;	}	REFIID iidVal = __uuidof(IDXGIFactory1);	UINT adapterID = 0;	// adapter index	IDXGIFactory1* pFactory = NULL;	if (FAILED(err = CreateDXGIFactory1(iidVal, (void**)&pFactory)))	{		return 	false;	}	UINT i = 0;	UINT adapterDeviceID = idAdapter;		// if device id equal zero, use the first device	DXGI_ADAPTER_DESC dxgiDesc;	IDXGIAdapter1 *giAdapter = NULL;	if (pFactory->EnumAdapters1(i, &giAdapter) != S_OK)	{		return false;	}	if (pFactory)pFactory->Release();	*pAdapter = giAdapter;	return true;}
开发者ID:wp4398151,项目名称:TestProjectJar,代码行数:29,


示例6: GetAdapterName

// Get an adapter namebool spoutDirectX::GetAdapterName(int index, char *adaptername, int maxchars){	IDXGIFactory1* _dxgi_factory1;	IDXGIAdapter* adapter1_ptr = nullptr;	UINT32 i;	if ( FAILED( CreateDXGIFactory1( __uuidof(IDXGIFactory1), (void**)&_dxgi_factory1 ) ) )		return false;		for ( i = 0; _dxgi_factory1->EnumAdapters( i, &adapter1_ptr ) != DXGI_ERROR_NOT_FOUND; i++ ) {		if((int)i == index) {			DXGI_ADAPTER_DESC	desc;			adapter1_ptr->GetDesc( &desc );			adapter1_ptr->Release();			size_t charsConverted = 0;			wcstombs_s(&charsConverted, adaptername, maxchars, desc.Description, maxchars-1);			// Is the adapter compatible ?			// TODO : test for Intel graphics version ?			// 11.08.15 - removed for use with Intel HD4400/5000 graphics			// if(strstr(adaptername, "Intel")) {				// printf("Intel graphics not supported/n");				// return false;			// }			_dxgi_factory1->Release();			return true;		}	}	_dxgi_factory1->Release();	return false;}
开发者ID:sheridanis,项目名称:ofxSpout2,代码行数:33,


示例7: GetAdapterInfo

bool spoutDirectX::GetAdapterInfo(char *adapter, char *display, int maxchars){	IDXGIFactory1* _dxgi_factory1;	IDXGIAdapter* adapter1_ptr = nullptr;	UINT32 i;	size_t charsConverted = 0;		// Enum Adapters first : multiple video cards	if ( FAILED( CreateDXGIFactory1( __uuidof(IDXGIFactory1), (void**)&_dxgi_factory1 ) ) )		return false;	for ( i = 0; _dxgi_factory1->EnumAdapters( i, &adapter1_ptr ) != DXGI_ERROR_NOT_FOUND; i++ )	{		DXGI_ADAPTER_DESC	desc;		adapter1_ptr->GetDesc( &desc );		// Return the current adapter - max of 2 assumed		wcstombs_s(&charsConverted, adapter, maxchars, desc.Description, maxchars-1);		IDXGIOutput*	p_output = nullptr;		for ( UINT32 j = 0; adapter1_ptr->EnumOutputs( j, &p_output ) != DXGI_ERROR_NOT_FOUND; j++ ) {			DXGI_OUTPUT_DESC	desc_out;			p_output->GetDesc( &desc_out );			if(desc_out.AttachedToDesktop)				wcstombs_s(&charsConverted, display, maxchars, desc.Description, maxchars-1);			if( p_output )				p_output->Release();		}	}	_dxgi_factory1->Release();	return true;}
开发者ID:jonburgstrom,项目名称:Spout2,代码行数:34,


示例8:

CD3DRenderer::CD3DRenderer(HWND& window){	m_hWnd = window;	if(FAILED(CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)&m_pdxgiFactory)))		g_pDebug->printError("Failed to create DXGI Factory.");	IDXGIAdapter1 * pAdapter;	for (UINT i = 0;		m_pdxgiFactory->EnumAdapters1(i, &pAdapter) != DXGI_ERROR_NOT_FOUND;		++i)		m_vAdapters.push_back(pAdapter);		IDXGIOutput *pOutput;	m_vAdapters[m_uiCurrentAdapter]->EnumOutputs(0, &pOutput);		UINT modeCount;	pOutput->GetDisplayModeList(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_ENUM_MODES_INTERLACED, &modeCount, nullptr);	DXGI_MODE_DESC *descArr = new DXGI_MODE_DESC[modeCount];	pOutput->GetDisplayModeList(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_ENUM_MODES_INTERLACED, &modeCount, descArr);	for (UINT i = 0; i < modeCount; i++)	{		if (descArr[i].RefreshRate.Numerator / descArr[i].RefreshRate.Denominator <= 60)			m_vAdapterModes.push_back(descArr[i]);	}	pOutput->Release();	delete[] descArr;}
开发者ID:petrgeorgievsky,项目名称:gtaRenderHook,代码行数:28,


示例9: create_device

BOOL CALLBACK create_device(PINIT_ONCE ignored, void *ignored2,    void **ignored3) {  debug_log("creating device");  HRESULT hr;  hr = CreateDXGIFactory1(__uuidof(IDXGIFactory2), (void **)&dxgi_factory);  assert(hr == S_OK);  hr = dxgi_factory->EnumAdapters1(0, &dxgi_adapter);  assert(hr == S_OK);  hr = dxgi_adapter->EnumOutputs(0, &dxgi_output);  assert(hr == S_OK);  hr = dxgi_output->QueryInterface(__uuidof(IDXGIOutput1),      (void **)&dxgi_output1);  assert(hr == S_OK);  const D3D_FEATURE_LEVEL levels[] = { D3D_FEATURE_LEVEL_11_0 };  D3D_FEATURE_LEVEL out_level;  UINT flags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;#ifndef NDEBUG  flags |= D3D11_CREATE_DEVICE_DEBUG;#endif  hr = D3D11CreateDevice(dxgi_adapter, D3D_DRIVER_TYPE_UNKNOWN, NULL, flags,      levels, 1, D3D11_SDK_VERSION, &device, &out_level, &context);  assert(hr == S_OK);  hr = dxgi_output1->DuplicateOutput(device, &dxgi_output_duplication);  assert(hr == S_OK);  InitializeCriticalSection(&directx_critical_section);  return TRUE;}
开发者ID:mammon163,项目名称:latency-benchmark,代码行数:27,


示例10: find_output

static HRESULT find_output(){	CComPtr<IDXGIFactory1> pFactory;	HRESULT hr = CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void **)(&pFactory));	for (UINT i = 0; ; i++) {		CComPtr<IDXGIAdapter1> pAdapter;		if (S_OK != (hr = pFactory->EnumAdapters1(i, &pAdapter))) {			break;		}		aslog::info(L"Found adapter %d", i);		for (UINT j = 0; ; j++) {			CComPtr<IDXGIOutput> pOutput;			if (S_OK != (hr = pAdapter->EnumOutputs(j, &pOutput))) {				break;			}			aslog::info(L"Found output %d-%d", i, j);			DXGI_OUTPUT_DESC desc;			pOutput->GetDesc(&desc);			aslog::info(L"Output %d-%d name: %s", i, j, desc.DeviceName);			aslog::info(L"Output %d-%d attached to desktop: %s", i, j, desc.AttachedToDesktop ? L"true" : L"false");			g_pAdapter = pAdapter;			g_pOutput = pOutput;			hr = D3D11CreateDevice(pAdapter, D3D_DRIVER_TYPE_UNKNOWN, NULL, D3D11_CREATE_DEVICE_DEBUG, NULL, 0, D3D11_SDK_VERSION, &g_pDevice, NULL, &g_pContext);			return hr;		}	}	return hr;}
开发者ID:smmckay,项目名称:auto-screengrab,代码行数:32,


示例11: GetDisplayDevices

void GetDisplayDevices(DeviceOutputs &deviceList){    HRESULT err;    deviceList.ClearData();#ifdef USE_DXGI1_2    REFIID iidVal = OSGetVersion() >= 8 ? __uuidof(IDXGIFactory2) : __uuidof(IDXGIFactory1);#else    REFIIF iidVal = __uuidof(IDXGIFactory1);#endif    IDXGIFactory1 *factory;    if(SUCCEEDED(err = CreateDXGIFactory1(iidVal, (void**)&factory)))    {        UINT i=0;        IDXGIAdapter1 *giAdapter;        while(factory->EnumAdapters1(i++, &giAdapter) == S_OK)        {            Log(TEXT("------------------------------------------"));            DXGI_ADAPTER_DESC adapterDesc;            if(SUCCEEDED(err = giAdapter->GetDesc(&adapterDesc)))            {                if (adapterDesc.DedicatedVideoMemory != 0) {                    DeviceOutputData &deviceData = *deviceList.devices.CreateNew();                    deviceData.strDevice = adapterDesc.Description;                    UINT j=0;                    IDXGIOutput *giOutput;                    while(giAdapter->EnumOutputs(j++, &giOutput) == S_OK)                    {                        DXGI_OUTPUT_DESC outputDesc;                        if(SUCCEEDED(giOutput->GetDesc(&outputDesc)))                        {                            if(outputDesc.AttachedToDesktop)                            {                                deviceData.monitorNameList << outputDesc.DeviceName;                                MonitorInfo &monitorInfo = *deviceData.monitors.CreateNew();                                monitorInfo.hMonitor = outputDesc.Monitor;                                mcpy(&monitorInfo.rect, &outputDesc.DesktopCoordinates, sizeof(RECT));                            }                        }                        giOutput->Release();                    }                }            }            else                AppWarning(TEXT("Could not query adapter %u"), i);            giAdapter->Release();        }        factory->Release();    }}
开发者ID:Soopah,项目名称:OBS,代码行数:59,


示例12: CreateWindowsAdapter

std::unique_ptr< WindowsAdapter > CreateWindowsAdapter( const int id ) noexcept {	ComPtr< IDXGIFactory1 > factory;	auto hresult = CreateDXGIFactory1( __uuidof( IDXGIFactory1 ), reinterpret_cast< void** >( &factory ) );	if ( FAILED( hresult ) ) {		return nullptr;	}	return CreateAdapter( factory, id );}
开发者ID:richardcervinka,项目名称:world,代码行数:8,


示例13: HookDXGIFactory

HRESULT WINAPI HookDXGIFactory(REFIID riid, void **ppFactory){	// We need shared texture support for OpenVR, so force DXGI 1.0 games to use DXGI 1.1	IDXGIFactory1* pDXGIFactory;	HRESULT hr = CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void **)&pDXGIFactory);	if (FAILED(hr))		return hr;	return pDXGIFactory->QueryInterface(riid, ppFactory);}
开发者ID:Stal1tm,项目名称:Revive,代码行数:9,


示例14: FindNVIDIA

// LJ DEBUGbool spoutDirectX::FindNVIDIA(int &nAdapter){	IDXGIFactory1* _dxgi_factory1;	IDXGIAdapter* adapter1_ptr = nullptr;	DXGI_ADAPTER_DESC desc;	// DXGI_OUTPUT_DESC desc_out;	UINT32 i;	bool bFound = false;	if ( FAILED( CreateDXGIFactory1( __uuidof(IDXGIFactory1), (void**)&_dxgi_factory1 ) ) )		return false;	for ( i = 0; _dxgi_factory1->EnumAdapters( i, &adapter1_ptr ) != DXGI_ERROR_NOT_FOUND; i++ )	{		adapter1_ptr->GetDesc( &desc );		printf( "Adapter(%d) : %S/n", i, desc.Description );		/*		IDXGIOutput* p_output = nullptr;		if(adapter1_ptr->EnumOutputs(0, &p_output ) == DXGI_ERROR_NOT_FOUND) {			printf("  No outputs/n");			continue;		}		for ( UINT32 j = 0; adapter1_ptr->EnumOutputs( j, &p_output ) != DXGI_ERROR_NOT_FOUND; j++ ) {			p_output->GetDesc( &desc_out );			// printf( "  Output : %d/n", j );			// printf( "    Name %S/n", desc_out.DeviceName );			// printf( "    Attached to desktop : (%d) %s/n", desc_out.AttachedToDesktop, desc_out.AttachedToDesktop ? "yes" : "no" );			// printf( "    Rotation : %d/n", desc_out.Rotation );			// printf( "    Left     : %d/n", desc_out.DesktopCoordinates.left );			// printf( "    Top      : %d/n", desc_out.DesktopCoordinates.top );			// printf( "    Right    : %d/n", desc_out.DesktopCoordinates.right );			// printf( "    Bottom   : %d/n", desc_out.DesktopCoordinates.bottom );			if( p_output )				p_output->Release();		}		*/		if(wcsstr(desc.Description, L"NVIDIA")) {			// printf("Found NVIDIA adapter %d (%S)/n", i, desc.Description);			bFound = true;			break;		}	}	_dxgi_factory1->Release();	if(bFound) {		printf("Found NVIDIA adapter %d (%S)/n", i, desc.Description);		nAdapter = i;		return true;	}	return false;}
开发者ID:jonburgstrom,项目名称:Spout2,代码行数:57,


示例15: GetNumAdapters

// Get the number of graphics adapters in the systemint spoutDirectX::GetNumAdapters(){	IDXGIFactory1* _dxgi_factory1;	IDXGIAdapter* adapter1_ptr = nullptr;	UINT32 i;	// printf("spoutDirectX::GetNumAdapters/n");	// Enum Adapters first : multiple video cards	if ( FAILED( CreateDXGIFactory1( __uuidof(IDXGIFactory1), (void**)&_dxgi_factory1 ) ) )		return 0;	for ( i = 0; _dxgi_factory1->EnumAdapters( i, &adapter1_ptr ) != DXGI_ERROR_NOT_FOUND; i++ )	{		// DXGI_ADAPTER_DESC	desc;		// adapter1_ptr->GetDesc( &desc );		// printf( "Adapter : %S/n", desc.Description );		// adapter1_ptr->Release();		// printf( "bdd_spout : D3D11 Adapter %d found/n", i );		DXGI_ADAPTER_DESC	desc;		adapter1_ptr->GetDesc( &desc );		printf( "Adapter(%d) : %S/n", i, desc.Description );		printf( "  Vendor Id : %d/n", desc.VendorId );		// printf( "  Dedicated System Memory : %.0f MiB/n", (float)desc.DedicatedSystemMemory / (1024.f * 1024.f) );		// printf( "  Dedicated Video Memory : %.0f MiB/n", (float)desc.DedicatedVideoMemory / (1024.f * 1024.f) );		// printf( "  Shared System Memory : %.0f MiB/n", (float)desc.SharedSystemMemory / (1024.f * 1024.f) );				IDXGIOutput* p_output = nullptr;		if(adapter1_ptr->EnumOutputs(0, &p_output ) == DXGI_ERROR_NOT_FOUND) {			printf("  No outputs/n");		}		for ( UINT32 j = 0; adapter1_ptr->EnumOutputs( j, &p_output ) != DXGI_ERROR_NOT_FOUND; j++ ) {			DXGI_OUTPUT_DESC	desc_out;			p_output->GetDesc( &desc_out );			printf( "  Output : %d/n", j );			printf( "    Name %S/n", desc_out.DeviceName );			printf( "    Attached to desktop : (%d) %s/n", desc_out.AttachedToDesktop, desc_out.AttachedToDesktop ? "yes" : "no" );			printf( "    Rotation : %d/n", desc_out.Rotation );			printf( "    Left     : %d/n", desc_out.DesktopCoordinates.left );			printf( "    Top      : %d/n", desc_out.DesktopCoordinates.top );			printf( "    Right    : %d/n", desc_out.DesktopCoordinates.right );			printf( "    Bottom   : %d/n", desc_out.DesktopCoordinates.bottom );			if( p_output )				p_output->Release();		}	}	_dxgi_factory1->Release();	return (int)i;}
开发者ID:sheridanis,项目名称:ofxSpout2,代码行数:55,


示例16: ThrowIfFailed

/// Overriden in derived class to initialize the graphics required for a render loop. The render loop acts as a message pump to the user clients./// /return True if success, false if failurebool DX12Player::InitializeGraphics(){    ID3D12Device* graphicsDevice = nullptr;    UINT frameCount = 2;    // Initialize all pipeline components necessary to render a frame.    /// Invoking these calls will allow the DXGI/DX12Server plugins to be injected into our player application.    // @TODO: In the future, the following commands will invoked by loaded a capture file,    // initializing, and executing all captured calls. Spinning on the target frame will beat    // the DX12Server's message loop, allowing communicate with GPUPerfServer.    IDXGIFactory4* factory = nullptr;    ThrowIfFailed(CreateDXGIFactory1(IID_PPV_ARGS(&factory)));    ThrowIfFailed(D3D12CreateDevice(nullptr, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&graphicsDevice)));    // Describe and create the command queue.    D3D12_COMMAND_QUEUE_DESC queueDesc = {};    queueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;    queueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT;    ID3D12CommandQueue* commandQueue = nullptr;    ThrowIfFailed(graphicsDevice->CreateCommandQueue(&queueDesc, IID_PPV_ARGS(&commandQueue)));    // Describe and create the swap chain.    DXGI_SWAP_CHAIN_DESC swapChainDesc = {};    swapChainDesc.BufferCount = frameCount;    swapChainDesc.BufferDesc.Width = m_pPlayerWindow->GetWindowWidth();    swapChainDesc.BufferDesc.Height = m_pPlayerWindow->GetWindowHeight();    swapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;    swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;    swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;    // The window handle must be set before being used here.    swapChainDesc.OutputWindow = m_pPlayerWindow->GetWindowHandle();    swapChainDesc.SampleDesc.Count = 1;    swapChainDesc.Windowed = TRUE;    HRESULT res = factory->CreateSwapChain(commandQueue, &swapChainDesc, (IDXGISwapChain**)&m_swapchain);    ThrowIfFailed(res);    if (res != S_OK)    {        return false;    }    else    {        return true;    }}
开发者ID:imace,项目名称:CodeXL,代码行数:55,


示例17: D3D12CreateDevice

HRESULT AppTest::CreateDeviceAndSwapChain(IDXGIAdapter * adapter,										  D3D_DRIVER_TYPE driverType, 										  D3D_FEATURE_LEVEL minFeatureLevel, 										  CONST DXGI_SWAP_CHAIN_DESC * swapChainDesc, 										  REFIID riidSwapChain, 										  void ** ppSwapChain, 										  REFIID riidDevice, 										  void ** ppDevice, 										  REFIID riidQueue,										  void ** ppQueue){	ComPtr<ID3D12Device> device;	ComPtr<IDXGIFactory> dxgiFactory;	ComPtr<IDXGISwapChain> swapChain;	ComPtr<ID3D12CommandQueue> queue;	HRESULT hr = D3D12CreateDevice(adapter, minFeatureLevel, IID_PPV_ARGS(device.GetAddressOf()));	if (FAILED(hr))		return hr;	D3D12_COMMAND_QUEUE_DESC queueDesc;	ZeroMemory(&queueDesc, sizeof(queueDesc));	queueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;	queueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT;	hr = device->CreateCommandQueue(&queueDesc, IID_PPV_ARGS(queue.GetAddressOf()));	hr = CreateDXGIFactory1(IID_PPV_ARGS(dxgiFactory.GetAddressOf()));	if (FAILED(hr))		return hr;	DXGI_SWAP_CHAIN_DESC localSwapChainDesc = *swapChainDesc;	hr = dxgiFactory->CreateSwapChain(queue.Get(), &localSwapChainDesc, &swapChain);	if (FAILED(hr))		return hr;	hr = device.Get()->QueryInterface(riidDevice, ppDevice);	if (FAILED(hr))		return hr;	hr = queue.Get()->QueryInterface(riidQueue, ppQueue);	if (FAILED(hr))		return hr;	hr = swapChain.Get()->QueryInterface(riidSwapChain, ppSwapChain);	if (FAILED(hr))	{		reinterpret_cast<IUnknown*>(*ppDevice)->Release();		return hr;	}	return S_OK;}
开发者ID:LeifNode,项目名称:Novus-Engine-2,代码行数:53,


示例18: LogVideoCardStats

void LogVideoCardStats(){    HRESULT err;#ifdef USE_DXGI1_2    REFIID iidVal = OSGetVersion() >= 8 ? __uuidof(IDXGIFactory2) : __uuidof(IDXGIFactory1);#else    REFIIF iidVal = __uuidof(IDXGIFactory1);#endif    IDXGIFactory1 *factory;    if(SUCCEEDED(err = CreateDXGIFactory1(iidVal, (void**)&factory)))    {        UINT i=0;        IDXGIAdapter1 *giAdapter;        while(factory->EnumAdapters1(i++, &giAdapter) == S_OK)        {            DXGI_ADAPTER_DESC adapterDesc;            if(SUCCEEDED(err = giAdapter->GetDesc(&adapterDesc)))            {                if (!(adapterDesc.VendorId == 0x1414 && adapterDesc.DeviceId == 0x8c)) { // Ignore Microsoft Basic Render Driver                    Log(TEXT("------------------------------------------"));                    Log(TEXT("Adapter %u"), i);                    Log(TEXT("  Video Adapter: %s"), adapterDesc.Description);                    Log(TEXT("  Video Adapter Dedicated Video Memory: %u"), adapterDesc.DedicatedVideoMemory);                    Log(TEXT("  Video Adapter Shared System Memory: %u"), adapterDesc.SharedSystemMemory);                    UINT j = 0;                    IDXGIOutput *output;                    while(SUCCEEDED(giAdapter->EnumOutputs(j++, &output)))                    {                        DXGI_OUTPUT_DESC desc;                        if(SUCCEEDED(output->GetDesc(&desc)))                            Log(TEXT("  Video Adapter Output %u: pos={%d, %d}, size={%d, %d}, attached=%s"), j,                                desc.DesktopCoordinates.left, desc.DesktopCoordinates.top,                                desc.DesktopCoordinates.right-desc.DesktopCoordinates.left, desc.DesktopCoordinates.bottom-desc.DesktopCoordinates.top,                                desc.AttachedToDesktop ? L"true" : L"false");                        output->Release();                    }                }            }            else                AppWarning(TEXT("Could not query adapter %u"), i);            giAdapter->Release();        }        factory->Release();    }}
开发者ID:neilzar,项目名称:OBS,代码行数:51,


示例19: __uuidof

void gs_device::InitFactory(uint32_t adapterIdx, IDXGIAdapter1 **padapter){	HRESULT hr;	IID factoryIID = (GetWinVer() >= 0x602) ? dxgiFactory2 :		__uuidof(IDXGIFactory1);	hr = CreateDXGIFactory1(factoryIID, (void**)factory.Assign());	if (FAILED(hr))		throw UnsupportedHWError("Failed to create DXGIFactory", hr);	hr = factory->EnumAdapters1(adapterIdx, padapter);	if (FAILED(hr))		throw UnsupportedHWError("Failed to enumerate DXGIAdapter", hr);}
开发者ID:ArnoldSchiller,项目名称:obs-studio,代码行数:14,


示例20: d3d_call

    bool Device::apiInit(const Desc& desc)    {        DeviceApiData* pData = new DeviceApiData;        mpApiData = pData;        if (desc.enableDebugLayer)        {            ID3D12DebugPtr pDebug;            if (SUCCEEDED(D3D12GetDebugInterface(IID_PPV_ARGS(&pDebug))))            {                pDebug->EnableDebugLayer();            }        }        // Create the DXGI factory        d3d_call(CreateDXGIFactory1(IID_PPV_ARGS(&mpApiData->pDxgiFactory)));        mApiHandle = createDevice(mpApiData->pDxgiFactory, getD3DFeatureLevel(desc.apiMajorVersion, desc.apiMinorVersion), desc.createDeviceFunc, mRgb32FloatSupported);        if (mApiHandle == nullptr)        {            return false;        }        for (uint32_t i = 0; i < kQueueTypeCount; i++)        {            for (uint32_t j = 0; j < desc.cmdQueues[i]; j++)            {                // Create the command queue                D3D12_COMMAND_QUEUE_DESC cqDesc = {};                cqDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;                cqDesc.Type = getApiCommandQueueType((LowLevelContextData::CommandQueueType)i);                ID3D12CommandQueuePtr pQueue;                if (FAILED(mApiHandle->CreateCommandQueue(&cqDesc, IID_PPV_ARGS(&pQueue))))                {                    logError("Failed to create command queue");                    return nullptr;                }                mCmdQueues[i].push_back(pQueue);            }        }        uint64_t freq;        d3d_call(getCommandQueueHandle(LowLevelContextData::CommandQueueType::Direct, 0)->GetTimestampFrequency(&freq));        mGpuTimestampFrequency = 1000.0 / (double)freq;        return true;    }
开发者ID:Junios,项目名称:Falcor,代码行数:49,


示例21:

	IDXGIAdapter1	*D3D11Renderer::GetPrimaryAdaptor()	{		IDXGIFactory1	*factory = 0;		if (CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void **)&factory) == S_OK)		{			IDXGIAdapter1	*adapter = 0;							factory->EnumAdapters1(0, &adapter);			memory::SafeRelease(&factory);			memory::SafeRelease(&adapter);			return adapter;		}		memory::SafeRelease(&factory);		return 0;	}
开发者ID:dotminic,项目名称:code,代码行数:16,


示例22: 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,


示例23: CreateDXGIFactory1

    bool SystemCheck::CheckVRAMSize()    {        HRESULT hr;        D3D_FEATURE_LEVEL FeatureLevel;        CComPtr<IDXGIFactory1> DXGIFactory;        hr = CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)&DXGIFactory);        if(SUCCEEDED(hr))        {            CComPtr<IDXGIAdapter1> Adapter;            hr = DXGIFactory->EnumAdapters1(0, &Adapter);            if(SUCCEEDED(hr))            {                CComPtr<ID3D11Device> Device;                CComPtr<ID3D11DeviceContext> DeviceContext;                hr = D3D11CreateDevice(Adapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr,                    D3D11_CREATE_DEVICE_BGRA_SUPPORT, nullptr, 0, D3D11_SDK_VERSION,                    &Device, &FeatureLevel, &DeviceContext);                if(SUCCEEDED(hr))                {                    DXGI_ADAPTER_DESC adapterDesc;                    Adapter->GetDesc(&adapterDesc);                    std::wstring Description = adapterDesc.Description;                    INT64 VideoRam = adapterDesc.DedicatedVideoMemory;                    INT64 SystemRam = adapterDesc.DedicatedSystemMemory;                    INT64 SharedRam = adapterDesc.SharedSystemMemory;                    std::wcout << "***************** GRAPHICS ADAPTER DETAILS ***********************" << endl;;                    std::wcout << "Adapter Description: " << Description << endl;                    std::wcout << "Dedicated Video RAM: " << VideoRam << endl;                    std::wcout << "Dedicated System RAM: " << SystemRam << endl;                    std::wcout << "Shared System RAM: " << SharedRam << endl;                    std::wcout << "PCI ID: " << Description << endl;                    std::wcout << "Feature Level: " << FeatureLevel << endl;                }            }        }            return true;    }
开发者ID:BrennenTaylor,项目名称:WaveParticle,代码行数:45,


示例24: device_

/** * コンストラクタ * * @param hwnd					ウィンドウハンドル * @param w						バックバッファの幅 * @param h						バックバッファの高さ * @param full_screen			フルスクリ
C++ CreateDialog函数代码示例
C++ CreateDIBitmap函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。