CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/Common/GPU/D3D11/D3D11Loader.cpp
Views: 1401
#include "ppsspp_config.h"1#include "Common/GPU/D3D11/D3D11Loader.h"23#if PPSSPP_PLATFORM(UWP)4#error This file should not be compiled for UWP.5#endif67static HMODULE g_DXGIModule;8static HMODULE g_D3D11Module;9static HMODULE g_D3DCompileModule;1011LPCREATEDXGIFACTORY ptr_CreateDXGIFactory;12LPD3D11CREATEDEVICE ptr_D3D11CreateDevice;13pD3DCompile ptr_D3DCompile;1415LoadD3D11Error LoadD3D11() {16if (g_D3D11Module) {17// Already done18return LoadD3D11Error::SUCCESS;19}20g_D3D11Module = LoadLibrary(L"d3d11.dll");21if (g_D3D11Module) {22ptr_D3D11CreateDevice = (LPD3D11CREATEDEVICE)GetProcAddress(g_D3D11Module, "D3D11CreateDevice");23} else {24return LoadD3D11Error::FAIL_NO_D3D11;25}2627g_DXGIModule = LoadLibrary(L"dxgi.dll");28if (g_DXGIModule) {29ptr_CreateDXGIFactory = (LPCREATEDXGIFACTORY)GetProcAddress(g_DXGIModule, "CreateDXGIFactory1");30} else {31FreeLibrary(g_D3D11Module);32g_D3D11Module = nullptr;33return LoadD3D11Error::FAIL_NO_D3D11;34}3536g_D3DCompileModule = LoadLibrary(D3DCOMPILER_DLL);37#if PPSSPP_ARCH(X86)38// Workaround for distributing both 32-bit and 64-bit versions of the DLL.39if (!g_D3DCompileModule)40g_D3DCompileModule = LoadLibrary(L"D3dcompiler_47.x86.dll");41#endif42if (!g_D3DCompileModule)43g_D3DCompileModule = LoadLibrary(L"D3dcompiler_42.dll");4445if (!g_D3DCompileModule) {46FreeLibrary(g_D3D11Module);47g_D3D11Module = nullptr;48FreeLibrary(g_DXGIModule);49g_DXGIModule = nullptr;50return LoadD3D11Error::FAIL_NO_COMPILER;51}52ptr_D3DCompile = (pD3DCompile)GetProcAddress(g_D3DCompileModule, "D3DCompile");5354return LoadD3D11Error::SUCCESS;55}5657bool UnloadD3D11() {58if (!g_D3D11Module)59return false;6061if (g_DXGIModule) {62FreeLibrary(g_DXGIModule);63g_DXGIModule = nullptr;64}65if (g_D3D11Module) {66FreeLibrary(g_D3D11Module);67g_D3D11Module = nullptr;68}69if (g_D3DCompileModule) {70FreeLibrary(g_D3DCompileModule);71g_D3DCompileModule = nullptr;72}7374return true;75}767778