mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
clang-modernize -use-nullptr
and s/\bNULL\b/nullptr/g for *.cpp/h/mm files not compiled on my machine
This commit is contained in:
@ -11,29 +11,29 @@
|
||||
namespace DX11
|
||||
{
|
||||
|
||||
HINSTANCE hD3DCompilerDll = NULL;
|
||||
D3DREFLECT PD3DReflect = NULL;
|
||||
pD3DCompile PD3DCompile = NULL;
|
||||
HINSTANCE hD3DCompilerDll = nullptr;
|
||||
D3DREFLECT PD3DReflect = nullptr;
|
||||
pD3DCompile PD3DCompile = nullptr;
|
||||
int d3dcompiler_dll_ref = 0;
|
||||
|
||||
CREATEDXGIFACTORY PCreateDXGIFactory = NULL;
|
||||
HINSTANCE hDXGIDll = NULL;
|
||||
CREATEDXGIFACTORY PCreateDXGIFactory = nullptr;
|
||||
HINSTANCE hDXGIDll = nullptr;
|
||||
int dxgi_dll_ref = 0;
|
||||
|
||||
typedef HRESULT (WINAPI* D3D11CREATEDEVICEANDSWAPCHAIN)(IDXGIAdapter*, D3D_DRIVER_TYPE, HMODULE, UINT, CONST D3D_FEATURE_LEVEL*, UINT, UINT, CONST DXGI_SWAP_CHAIN_DESC*, IDXGISwapChain**, ID3D11Device**, D3D_FEATURE_LEVEL*, ID3D11DeviceContext**);
|
||||
D3D11CREATEDEVICE PD3D11CreateDevice = NULL;
|
||||
D3D11CREATEDEVICEANDSWAPCHAIN PD3D11CreateDeviceAndSwapChain = NULL;
|
||||
HINSTANCE hD3DDll = NULL;
|
||||
D3D11CREATEDEVICE PD3D11CreateDevice = nullptr;
|
||||
D3D11CREATEDEVICEANDSWAPCHAIN PD3D11CreateDeviceAndSwapChain = nullptr;
|
||||
HINSTANCE hD3DDll = nullptr;
|
||||
int d3d_dll_ref = 0;
|
||||
|
||||
namespace D3D
|
||||
{
|
||||
|
||||
ID3D11Device* device = NULL;
|
||||
ID3D11DeviceContext* context = NULL;
|
||||
IDXGISwapChain* swapchain = NULL;
|
||||
ID3D11Device* device = nullptr;
|
||||
ID3D11DeviceContext* context = nullptr;
|
||||
IDXGISwapChain* swapchain = nullptr;
|
||||
D3D_FEATURE_LEVEL featlevel;
|
||||
D3DTexture2D* backbuf = NULL;
|
||||
D3DTexture2D* backbuf = nullptr;
|
||||
HWND hWnd;
|
||||
|
||||
std::vector<DXGI_SAMPLE_DESC> aa_modes; // supported AA modes of the current adapter
|
||||
@ -59,12 +59,12 @@ HRESULT LoadDXGI()
|
||||
hDXGIDll = LoadLibraryA("dxgi.dll");
|
||||
if (!hDXGIDll)
|
||||
{
|
||||
MessageBoxA(NULL, "Failed to load dxgi.dll", "Critical error", MB_OK | MB_ICONERROR);
|
||||
MessageBoxA(nullptr, "Failed to load dxgi.dll", "Critical error", MB_OK | MB_ICONERROR);
|
||||
--dxgi_dll_ref;
|
||||
return E_FAIL;
|
||||
}
|
||||
PCreateDXGIFactory = (CREATEDXGIFACTORY)GetProcAddress(hDXGIDll, "CreateDXGIFactory");
|
||||
if (PCreateDXGIFactory == NULL) MessageBoxA(NULL, "GetProcAddress failed for CreateDXGIFactory!", "Critical error", MB_OK | MB_ICONERROR);
|
||||
if (PCreateDXGIFactory == nullptr) MessageBoxA(nullptr, "GetProcAddress failed for CreateDXGIFactory!", "Critical error", MB_OK | MB_ICONERROR);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@ -77,15 +77,15 @@ HRESULT LoadD3D()
|
||||
hD3DDll = LoadLibraryA("d3d11.dll");
|
||||
if (!hD3DDll)
|
||||
{
|
||||
MessageBoxA(NULL, "Failed to load d3d11.dll", "Critical error", MB_OK | MB_ICONERROR);
|
||||
MessageBoxA(nullptr, "Failed to load d3d11.dll", "Critical error", MB_OK | MB_ICONERROR);
|
||||
--d3d_dll_ref;
|
||||
return E_FAIL;
|
||||
}
|
||||
PD3D11CreateDevice = (D3D11CREATEDEVICE)GetProcAddress(hD3DDll, "D3D11CreateDevice");
|
||||
if (PD3D11CreateDevice == NULL) MessageBoxA(NULL, "GetProcAddress failed for D3D11CreateDevice!", "Critical error", MB_OK | MB_ICONERROR);
|
||||
if (PD3D11CreateDevice == nullptr) MessageBoxA(nullptr, "GetProcAddress failed for D3D11CreateDevice!", "Critical error", MB_OK | MB_ICONERROR);
|
||||
|
||||
PD3D11CreateDeviceAndSwapChain = (D3D11CREATEDEVICEANDSWAPCHAIN)GetProcAddress(hD3DDll, "D3D11CreateDeviceAndSwapChain");
|
||||
if (PD3D11CreateDeviceAndSwapChain == NULL) MessageBoxA(NULL, "GetProcAddress failed for D3D11CreateDeviceAndSwapChain!", "Critical error", MB_OK | MB_ICONERROR);
|
||||
if (PD3D11CreateDeviceAndSwapChain == nullptr) MessageBoxA(nullptr, "GetProcAddress failed for D3D11CreateDeviceAndSwapChain!", "Critical error", MB_OK | MB_ICONERROR);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@ -104,7 +104,7 @@ HRESULT LoadD3DCompiler()
|
||||
hD3DCompilerDll = LoadLibraryA("D3DCompiler_42.dll");
|
||||
if (!hD3DCompilerDll)
|
||||
{
|
||||
MessageBoxA(NULL, "Failed to load D3DCompiler_42.dll, update your DX11 runtime, please", "Critical error", MB_OK | MB_ICONERROR);
|
||||
MessageBoxA(nullptr, "Failed to load D3DCompiler_42.dll, update your DX11 runtime, please", "Critical error", MB_OK | MB_ICONERROR);
|
||||
return E_FAIL;
|
||||
}
|
||||
else
|
||||
@ -114,9 +114,9 @@ HRESULT LoadD3DCompiler()
|
||||
}
|
||||
|
||||
PD3DReflect = (D3DREFLECT)GetProcAddress(hD3DCompilerDll, "D3DReflect");
|
||||
if (PD3DReflect == NULL) MessageBoxA(NULL, "GetProcAddress failed for D3DReflect!", "Critical error", MB_OK | MB_ICONERROR);
|
||||
if (PD3DReflect == nullptr) MessageBoxA(nullptr, "GetProcAddress failed for D3DReflect!", "Critical error", MB_OK | MB_ICONERROR);
|
||||
PD3DCompile = (pD3DCompile)GetProcAddress(hD3DCompilerDll, "D3DCompile");
|
||||
if (PD3DCompile == NULL) MessageBoxA(NULL, "GetProcAddress failed for D3DCompile!", "Critical error", MB_OK | MB_ICONERROR);
|
||||
if (PD3DCompile == nullptr) MessageBoxA(nullptr, "GetProcAddress failed for D3DCompile!", "Critical error", MB_OK | MB_ICONERROR);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@ -127,8 +127,8 @@ void UnloadDXGI()
|
||||
if (--dxgi_dll_ref != 0) return;
|
||||
|
||||
if(hDXGIDll) FreeLibrary(hDXGIDll);
|
||||
hDXGIDll = NULL;
|
||||
PCreateDXGIFactory = NULL;
|
||||
hDXGIDll = nullptr;
|
||||
PCreateDXGIFactory = nullptr;
|
||||
}
|
||||
|
||||
void UnloadD3D()
|
||||
@ -137,9 +137,9 @@ void UnloadD3D()
|
||||
if (--d3d_dll_ref != 0) return;
|
||||
|
||||
if(hD3DDll) FreeLibrary(hD3DDll);
|
||||
hD3DDll = NULL;
|
||||
PD3D11CreateDevice = NULL;
|
||||
PD3D11CreateDeviceAndSwapChain = NULL;
|
||||
hD3DDll = nullptr;
|
||||
PD3D11CreateDevice = nullptr;
|
||||
PD3D11CreateDeviceAndSwapChain = nullptr;
|
||||
}
|
||||
|
||||
void UnloadD3DCompiler()
|
||||
@ -148,8 +148,8 @@ void UnloadD3DCompiler()
|
||||
if (--d3dcompiler_dll_ref != 0) return;
|
||||
|
||||
if (hD3DCompilerDll) FreeLibrary(hD3DCompilerDll);
|
||||
hD3DCompilerDll = NULL;
|
||||
PD3DReflect = NULL;
|
||||
hD3DCompilerDll = nullptr;
|
||||
PD3DReflect = nullptr;
|
||||
}
|
||||
|
||||
std::vector<DXGI_SAMPLE_DESC> EnumAAModes(IDXGIAdapter* adapter)
|
||||
@ -161,7 +161,7 @@ std::vector<DXGI_SAMPLE_DESC> EnumAAModes(IDXGIAdapter* adapter)
|
||||
ID3D11Device* device;
|
||||
ID3D11DeviceContext* context;
|
||||
D3D_FEATURE_LEVEL feat_level;
|
||||
HRESULT hr = PD3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, NULL, D3D11_CREATE_DEVICE_SINGLETHREADED, supported_feature_levels, NUM_SUPPORTED_FEATURE_LEVELS, D3D11_SDK_VERSION, &device, &feat_level, &context);
|
||||
HRESULT hr = PD3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr, D3D11_CREATE_DEVICE_SINGLETHREADED, supported_feature_levels, NUM_SUPPORTED_FEATURE_LEVELS, D3D11_SDK_VERSION, &device, &feat_level, &context);
|
||||
if (FAILED(hr) || feat_level == D3D_FEATURE_LEVEL_10_0)
|
||||
{
|
||||
DXGI_SAMPLE_DESC desc;
|
||||
@ -193,7 +193,7 @@ std::vector<DXGI_SAMPLE_DESC> EnumAAModes(IDXGIAdapter* adapter)
|
||||
D3D_FEATURE_LEVEL GetFeatureLevel(IDXGIAdapter* adapter)
|
||||
{
|
||||
D3D_FEATURE_LEVEL feat_level = D3D_FEATURE_LEVEL_9_1;
|
||||
PD3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, NULL, D3D11_CREATE_DEVICE_SINGLETHREADED, supported_feature_levels, NUM_SUPPORTED_FEATURE_LEVELS, D3D11_SDK_VERSION, NULL, &feat_level, NULL);
|
||||
PD3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr, D3D11_CREATE_DEVICE_SINGLETHREADED, supported_feature_levels, NUM_SUPPORTED_FEATURE_LEVELS, D3D11_SDK_VERSION, nullptr, &feat_level, nullptr);
|
||||
return feat_level;
|
||||
}
|
||||
|
||||
@ -269,7 +269,7 @@ HRESULT Create(HWND wnd)
|
||||
mode_desc.Height = yres;
|
||||
mode_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
mode_desc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
|
||||
hr = output->FindClosestMatchingMode(&mode_desc, &swap_chain_desc.BufferDesc, NULL);
|
||||
hr = output->FindClosestMatchingMode(&mode_desc, &swap_chain_desc.BufferDesc, nullptr);
|
||||
if (FAILED(hr)) MessageBox(wnd, _T("Failed to find a supported video mode"), _T("Dolphin Direct3D 11 backend"), MB_OK | MB_ICONERROR);
|
||||
|
||||
// forcing buffer resolution to xres and yres.. TODO: The new video mode might not actually be supported!
|
||||
@ -280,7 +280,7 @@ HRESULT Create(HWND wnd)
|
||||
// Creating debug devices can sometimes fail if the user doesn't have the correct
|
||||
// version of the DirectX SDK. If it does, simply fallback to a non-debug device.
|
||||
{
|
||||
hr = PD3D11CreateDeviceAndSwapChain(adapter, D3D_DRIVER_TYPE_UNKNOWN, NULL,
|
||||
hr = PD3D11CreateDeviceAndSwapChain(adapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr,
|
||||
D3D11_CREATE_DEVICE_SINGLETHREADED | D3D11_CREATE_DEVICE_DEBUG,
|
||||
supported_feature_levels, NUM_SUPPORTED_FEATURE_LEVELS,
|
||||
D3D11_SDK_VERSION, &swap_chain_desc, &swapchain, &device,
|
||||
@ -290,7 +290,7 @@ HRESULT Create(HWND wnd)
|
||||
if (FAILED(hr))
|
||||
#endif
|
||||
{
|
||||
hr = PD3D11CreateDeviceAndSwapChain(adapter, D3D_DRIVER_TYPE_UNKNOWN, NULL,
|
||||
hr = PD3D11CreateDeviceAndSwapChain(adapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr,
|
||||
D3D11_CREATE_DEVICE_SINGLETHREADED,
|
||||
supported_feature_levels, NUM_SUPPORTED_FEATURE_LEVELS,
|
||||
D3D11_SDK_VERSION, &swap_chain_desc, &swapchain, &device,
|
||||
@ -322,11 +322,11 @@ HRESULT Create(HWND wnd)
|
||||
}
|
||||
backbuf = new D3DTexture2D(buf, D3D11_BIND_RENDER_TARGET);
|
||||
SAFE_RELEASE(buf);
|
||||
CHECK(backbuf!=NULL, "Create back buffer texture");
|
||||
CHECK(backbuf!=nullptr, "Create back buffer texture");
|
||||
SetDebugObjectName((ID3D11DeviceChild*)backbuf->GetTex(), "backbuffer texture");
|
||||
SetDebugObjectName((ID3D11DeviceChild*)backbuf->GetRTV(), "backbuffer render target view");
|
||||
|
||||
context->OMSetRenderTargets(1, &backbuf->GetRTV(), NULL);
|
||||
context->OMSetRenderTargets(1, &backbuf->GetRTV(), nullptr);
|
||||
|
||||
// BGRA textures are easier to deal with in TextureCache, but might not be supported by the hardware
|
||||
UINT format_support;
|
||||
@ -356,7 +356,7 @@ void Close()
|
||||
{
|
||||
NOTICE_LOG(VIDEO, "Successfully released all device references!");
|
||||
}
|
||||
device = NULL;
|
||||
device = nullptr;
|
||||
|
||||
// unload DLLs
|
||||
UnloadD3D();
|
||||
@ -439,7 +439,7 @@ void Reset()
|
||||
}
|
||||
backbuf = new D3DTexture2D(buf, D3D11_BIND_RENDER_TARGET);
|
||||
SAFE_RELEASE(buf);
|
||||
CHECK(backbuf!=NULL, "Create back buffer texture");
|
||||
CHECK(backbuf!=nullptr, "Create back buffer texture");
|
||||
SetDebugObjectName((ID3D11DeviceChild*)backbuf->GetTex(), "backbuffer texture");
|
||||
SetDebugObjectName((ID3D11DeviceChild*)backbuf->GetRTV(), "backbuffer render target view");
|
||||
}
|
||||
@ -452,7 +452,7 @@ bool BeginFrame()
|
||||
return false;
|
||||
}
|
||||
bFrameInProgress = true;
|
||||
return (device != NULL);
|
||||
return (device != nullptr);
|
||||
}
|
||||
|
||||
void EndFrame()
|
||||
|
Reference in New Issue
Block a user