mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
General: Convert PanicAlerts over to fmt equivalent
Converts lingering panic alert calls over to the fmt-capable ones.
This commit is contained in:
@@ -267,9 +267,10 @@ public:
|
||||
|
||||
if (mode == PointerWrap::MODE_READ && cookie != arbitraryNumber)
|
||||
{
|
||||
PanicAlertT("Error: After \"%s\", found %d (0x%X) instead of save marker %d (0x%X). Aborting "
|
||||
"savestate load...",
|
||||
prevName.c_str(), cookie, cookie, arbitraryNumber, arbitraryNumber);
|
||||
PanicAlertFmtT(
|
||||
"Error: After \"{0}\", found {1} ({2:#x}) instead of save marker {3} ({4:#x}). Aborting "
|
||||
"savestate load...",
|
||||
prevName, cookie, cookie, arbitraryNumber, arbitraryNumber);
|
||||
mode = PointerWrap::MODE_MEASURE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,27 +277,27 @@ bool GLContextWGL::Initialize(const WindowSystemInfo& wsi, bool stereo, bool cor
|
||||
m_dc = GetDC(m_window_handle);
|
||||
if (!m_dc)
|
||||
{
|
||||
PanicAlert("(1) Can't create an OpenGL Device context. Fail.");
|
||||
PanicAlertFmt("(1) Can't create an OpenGL Device context. Fail.");
|
||||
return false;
|
||||
}
|
||||
|
||||
int pixel_format = ChoosePixelFormat(m_dc, &pfd);
|
||||
if (!pixel_format)
|
||||
const int pixel_format = ChoosePixelFormat(m_dc, &pfd);
|
||||
if (pixel_format == 0)
|
||||
{
|
||||
PanicAlert("(2) Can't find a suitable PixelFormat.");
|
||||
PanicAlertFmt("(2) Can't find a suitable PixelFormat.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!SetPixelFormat(m_dc, pixel_format, &pfd))
|
||||
{
|
||||
PanicAlert("(3) Can't set the PixelFormat.");
|
||||
PanicAlertFmt("(3) Can't set the PixelFormat.");
|
||||
return false;
|
||||
}
|
||||
|
||||
m_rc = wglCreateContext(m_dc);
|
||||
if (!m_rc)
|
||||
{
|
||||
PanicAlert("(4) Can't create an OpenGL rendering context.");
|
||||
PanicAlertFmt("(4) Can't create an OpenGL rendering context.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ bool GLContextWGL::Initialize(const WindowSystemInfo& wsi, bool stereo, bool cor
|
||||
// This is because we need an active context to use wglCreateContextAttribsARB.
|
||||
if (!wglMakeCurrent(m_dc, m_rc))
|
||||
{
|
||||
PanicAlert("(5) Can't make dummy WGL context current.");
|
||||
PanicAlertFmt("(5) Can't make dummy WGL context current.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -324,7 +324,7 @@ bool GLContextWGL::Initialize(const WindowSystemInfo& wsi, bool stereo, bool cor
|
||||
// context. If we didn't get a core context, the caller expects that the context is not current.
|
||||
if (!wglMakeCurrent(m_dc, nullptr))
|
||||
{
|
||||
PanicAlert("(6) Failed to switch out temporary context");
|
||||
PanicAlertFmt("(6) Failed to switch out temporary context");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ u8* MemArena::FindMemoryBase()
|
||||
u8* base = static_cast<u8*>(VirtualAlloc(nullptr, memory_size, MEM_RESERVE, PAGE_READWRITE));
|
||||
if (!base)
|
||||
{
|
||||
PanicAlert("Failed to map enough memory space: %s", GetLastErrorString().c_str());
|
||||
PanicAlertFmt("Failed to map enough memory space: {}", GetLastErrorString());
|
||||
return nullptr;
|
||||
}
|
||||
VirtualFree(base, 0, MEM_RELEASE);
|
||||
@@ -162,7 +162,7 @@ u8* MemArena::FindMemoryBase()
|
||||
void* base = mmap(nullptr, memory_size, PROT_NONE, flags, -1, 0);
|
||||
if (base == MAP_FAILED)
|
||||
{
|
||||
PanicAlert("Failed to map enough memory space: %s", LastStrerrorString().c_str());
|
||||
PanicAlertFmt("Failed to map enough memory space: {}", LastStrerrorString());
|
||||
return nullptr;
|
||||
}
|
||||
munmap(base, memory_size);
|
||||
|
||||
@@ -46,7 +46,7 @@ void* AllocateExecutableMemory(size_t size)
|
||||
#endif
|
||||
|
||||
if (ptr == nullptr)
|
||||
PanicAlert("Failed to allocate executable memory");
|
||||
PanicAlertFmt("Failed to allocate executable memory");
|
||||
|
||||
return ptr;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ void* AllocateMemoryPages(size_t size)
|
||||
#endif
|
||||
|
||||
if (ptr == nullptr)
|
||||
PanicAlert("Failed to allocate raw memory");
|
||||
PanicAlertFmt("Failed to allocate raw memory");
|
||||
|
||||
return ptr;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ void* AllocateAlignedMemory(size_t size, size_t alignment)
|
||||
#endif
|
||||
|
||||
if (ptr == nullptr)
|
||||
PanicAlert("Failed to allocate aligned memory");
|
||||
PanicAlertFmt("Failed to allocate aligned memory");
|
||||
|
||||
return ptr;
|
||||
}
|
||||
@@ -90,10 +90,10 @@ void FreeMemoryPages(void* ptr, size_t size)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (!VirtualFree(ptr, 0, MEM_RELEASE))
|
||||
PanicAlert("FreeMemoryPages failed!\nVirtualFree: %s", GetLastErrorString().c_str());
|
||||
PanicAlertFmt("FreeMemoryPages failed!\nVirtualFree: {}", GetLastErrorString());
|
||||
#else
|
||||
if (munmap(ptr, size) != 0)
|
||||
PanicAlert("FreeMemoryPages failed!\nmunmap: %s", LastStrerrorString().c_str());
|
||||
PanicAlertFmt("FreeMemoryPages failed!\nmunmap: {}", LastStrerrorString());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -115,10 +115,10 @@ void ReadProtectMemory(void* ptr, size_t size)
|
||||
#ifdef _WIN32
|
||||
DWORD oldValue;
|
||||
if (!VirtualProtect(ptr, size, PAGE_NOACCESS, &oldValue))
|
||||
PanicAlert("ReadProtectMemory failed!\nVirtualProtect: %s", GetLastErrorString().c_str());
|
||||
PanicAlertFmt("ReadProtectMemory failed!\nVirtualProtect: {}", GetLastErrorString());
|
||||
#else
|
||||
if (mprotect(ptr, size, PROT_NONE) != 0)
|
||||
PanicAlert("ReadProtectMemory failed!\nmprotect: %s", LastStrerrorString().c_str());
|
||||
PanicAlertFmt("ReadProtectMemory failed!\nmprotect: {}", LastStrerrorString());
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -127,10 +127,10 @@ void WriteProtectMemory(void* ptr, size_t size, bool allowExecute)
|
||||
#ifdef _WIN32
|
||||
DWORD oldValue;
|
||||
if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READ : PAGE_READONLY, &oldValue))
|
||||
PanicAlert("WriteProtectMemory failed!\nVirtualProtect: %s", GetLastErrorString().c_str());
|
||||
PanicAlertFmt("WriteProtectMemory failed!\nVirtualProtect: {}", GetLastErrorString());
|
||||
#else
|
||||
if (mprotect(ptr, size, allowExecute ? (PROT_READ | PROT_EXEC) : PROT_READ) != 0)
|
||||
PanicAlert("WriteProtectMemory failed!\nmprotect: %s", LastStrerrorString().c_str());
|
||||
PanicAlertFmt("WriteProtectMemory failed!\nmprotect: {}", LastStrerrorString());
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -139,12 +139,12 @@ void UnWriteProtectMemory(void* ptr, size_t size, bool allowExecute)
|
||||
#ifdef _WIN32
|
||||
DWORD oldValue;
|
||||
if (!VirtualProtect(ptr, size, allowExecute ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE, &oldValue))
|
||||
PanicAlert("UnWriteProtectMemory failed!\nVirtualProtect: %s", GetLastErrorString().c_str());
|
||||
PanicAlertFmt("UnWriteProtectMemory failed!\nVirtualProtect: {}", GetLastErrorString());
|
||||
#else
|
||||
if (mprotect(ptr, size,
|
||||
allowExecute ? (PROT_READ | PROT_WRITE | PROT_EXEC) : PROT_WRITE | PROT_READ) != 0)
|
||||
{
|
||||
PanicAlert("UnWriteProtectMemory failed!\nmprotect: %s", LastStrerrorString().c_str());
|
||||
PanicAlertFmt("UnWriteProtectMemory failed!\nmprotect: {}", LastStrerrorString());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ void TraversalClient::ConnectToClient(const std::string& host)
|
||||
{
|
||||
if (host.size() > sizeof(TraversalHostId))
|
||||
{
|
||||
PanicAlert("host too long");
|
||||
PanicAlertFmt("Host too long");
|
||||
return;
|
||||
}
|
||||
TraversalPacket packet = {};
|
||||
|
||||
@@ -1028,14 +1028,14 @@ void XEmitter::TZCNT(int bits, X64Reg dest, const OpArg& src)
|
||||
{
|
||||
CheckFlags();
|
||||
if (!cpu_info.bBMI1)
|
||||
PanicAlert("Trying to use BMI1 on a system that doesn't support it. Bad programmer.");
|
||||
PanicAlertFmt("Trying to use BMI1 on a system that doesn't support it. Bad programmer.");
|
||||
WriteBitSearchType(bits, dest, src, 0xBC, true);
|
||||
}
|
||||
void XEmitter::LZCNT(int bits, X64Reg dest, const OpArg& src)
|
||||
{
|
||||
CheckFlags();
|
||||
if (!cpu_info.bLZCNT)
|
||||
PanicAlert("Trying to use LZCNT on a system that doesn't support it. Bad programmer.");
|
||||
PanicAlertFmt("Trying to use LZCNT on a system that doesn't support it. Bad programmer.");
|
||||
WriteBitSearchType(bits, dest, src, 0xBD, true);
|
||||
}
|
||||
|
||||
@@ -1880,7 +1880,7 @@ void XEmitter::WriteAVXOp(u8 opPrefix, u16 op, X64Reg regOp1, X64Reg regOp2, con
|
||||
int W, int extrabytes)
|
||||
{
|
||||
if (!cpu_info.bAVX)
|
||||
PanicAlert("Trying to use AVX on a system that doesn't support it. Bad programmer.");
|
||||
PanicAlertFmt("Trying to use AVX on a system that doesn't support it. Bad programmer.");
|
||||
WriteVEXOp(opPrefix, op, regOp1, regOp2, arg, W, extrabytes);
|
||||
}
|
||||
|
||||
@@ -1888,14 +1888,17 @@ void XEmitter::WriteAVXOp4(u8 opPrefix, u16 op, X64Reg regOp1, X64Reg regOp2, co
|
||||
X64Reg regOp3, int W)
|
||||
{
|
||||
if (!cpu_info.bAVX)
|
||||
PanicAlert("Trying to use AVX on a system that doesn't support it. Bad programmer.");
|
||||
PanicAlertFmt("Trying to use AVX on a system that doesn't support it. Bad programmer.");
|
||||
WriteVEXOp4(opPrefix, op, regOp1, regOp2, arg, regOp3, W);
|
||||
}
|
||||
|
||||
void XEmitter::WriteFMA3Op(u8 op, X64Reg regOp1, X64Reg regOp2, const OpArg& arg, int W)
|
||||
{
|
||||
if (!cpu_info.bFMA)
|
||||
PanicAlert("Trying to use FMA3 on a system that doesn't support it. Computer is v. f'n madd.");
|
||||
{
|
||||
PanicAlertFmt(
|
||||
"Trying to use FMA3 on a system that doesn't support it. Computer is v. f'n madd.");
|
||||
}
|
||||
WriteVEXOp(0x66, 0x3800 | op, regOp1, regOp2, arg, W);
|
||||
}
|
||||
|
||||
@@ -1903,7 +1906,10 @@ void XEmitter::WriteFMA4Op(u8 op, X64Reg dest, X64Reg regOp1, X64Reg regOp2, con
|
||||
int W)
|
||||
{
|
||||
if (!cpu_info.bFMA4)
|
||||
PanicAlert("Trying to use FMA4 on a system that doesn't support it. Computer is v. f'n madd.");
|
||||
{
|
||||
PanicAlertFmt(
|
||||
"Trying to use FMA4 on a system that doesn't support it. Computer is v. f'n madd.");
|
||||
}
|
||||
WriteVEXOp4(0x66, 0x3A00 | op, dest, regOp1, arg, regOp2, W);
|
||||
}
|
||||
|
||||
@@ -1911,10 +1917,10 @@ void XEmitter::WriteBMIOp(int size, u8 opPrefix, u16 op, X64Reg regOp1, X64Reg r
|
||||
const OpArg& arg, int extrabytes)
|
||||
{
|
||||
if (arg.IsImm())
|
||||
PanicAlert("BMI1/2 instructions don't support immediate operands.");
|
||||
PanicAlertFmt("BMI1/2 instructions don't support immediate operands.");
|
||||
if (size != 32 && size != 64)
|
||||
PanicAlert("BMI1/2 instructions only support 32-bit and 64-bit modes!");
|
||||
int W = size == 64;
|
||||
PanicAlertFmt("BMI1/2 instructions only support 32-bit and 64-bit modes!");
|
||||
const int W = size == 64;
|
||||
WriteVEXOp(opPrefix, op, regOp1, regOp2, arg, W, extrabytes);
|
||||
}
|
||||
|
||||
@@ -1923,7 +1929,7 @@ void XEmitter::WriteBMI1Op(int size, u8 opPrefix, u16 op, X64Reg regOp1, X64Reg
|
||||
{
|
||||
CheckFlags();
|
||||
if (!cpu_info.bBMI1)
|
||||
PanicAlert("Trying to use BMI1 on a system that doesn't support it. Bad programmer.");
|
||||
PanicAlertFmt("Trying to use BMI1 on a system that doesn't support it. Bad programmer.");
|
||||
WriteBMIOp(size, opPrefix, op, regOp1, regOp2, arg, extrabytes);
|
||||
}
|
||||
|
||||
@@ -1931,7 +1937,7 @@ void XEmitter::WriteBMI2Op(int size, u8 opPrefix, u16 op, X64Reg regOp1, X64Reg
|
||||
const OpArg& arg, int extrabytes)
|
||||
{
|
||||
if (!cpu_info.bBMI2)
|
||||
PanicAlert("Trying to use BMI2 on a system that doesn't support it. Bad programmer.");
|
||||
PanicAlertFmt("Trying to use BMI2 on a system that doesn't support it. Bad programmer.");
|
||||
WriteBMIOp(size, opPrefix, op, regOp1, regOp2, arg, extrabytes);
|
||||
}
|
||||
|
||||
@@ -2580,7 +2586,7 @@ void XEmitter::PSLLDQ(X64Reg reg, int shift)
|
||||
void XEmitter::PSRAW(X64Reg reg, int shift)
|
||||
{
|
||||
if (reg > 7)
|
||||
PanicAlert("The PSRAW-emitter does not support regs above 7");
|
||||
PanicAlertFmt("The PSRAW-emitter does not support regs above 7");
|
||||
Write8(0x66);
|
||||
Write8(0x0f);
|
||||
Write8(0x71);
|
||||
@@ -2592,7 +2598,7 @@ void XEmitter::PSRAW(X64Reg reg, int shift)
|
||||
void XEmitter::PSRAD(X64Reg reg, int shift)
|
||||
{
|
||||
if (reg > 7)
|
||||
PanicAlert("The PSRAD-emitter does not support regs above 7");
|
||||
PanicAlertFmt("The PSRAD-emitter does not support regs above 7");
|
||||
Write8(0x66);
|
||||
Write8(0x0f);
|
||||
Write8(0x72);
|
||||
@@ -2603,14 +2609,14 @@ void XEmitter::PSRAD(X64Reg reg, int shift)
|
||||
void XEmitter::WriteSSSE3Op(u8 opPrefix, u16 op, X64Reg regOp, const OpArg& arg, int extrabytes)
|
||||
{
|
||||
if (!cpu_info.bSSSE3)
|
||||
PanicAlert("Trying to use SSSE3 on a system that doesn't support it. Bad programmer.");
|
||||
PanicAlertFmt("Trying to use SSSE3 on a system that doesn't support it. Bad programmer.");
|
||||
WriteSSEOp(opPrefix, op, regOp, arg, extrabytes);
|
||||
}
|
||||
|
||||
void XEmitter::WriteSSE41Op(u8 opPrefix, u16 op, X64Reg regOp, const OpArg& arg, int extrabytes)
|
||||
{
|
||||
if (!cpu_info.bSSE4_1)
|
||||
PanicAlert("Trying to use SSE4.1 on a system that doesn't support it. Bad programmer.");
|
||||
PanicAlertFmt("Trying to use SSE4.1 on a system that doesn't support it. Bad programmer.");
|
||||
WriteSSEOp(opPrefix, op, regOp, arg, extrabytes);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ bool Create(u32 adapter_index, bool enable_debug_layer)
|
||||
if (!s_d3d11_library.Open("d3d11.dll") ||
|
||||
!s_d3d11_library.GetSymbol("D3D11CreateDevice", &d3d11_create_device))
|
||||
{
|
||||
PanicAlertT("Failed to load d3d11.dll");
|
||||
PanicAlertFmtT("Failed to load d3d11.dll");
|
||||
s_d3d11_library.Close();
|
||||
return false;
|
||||
}
|
||||
@@ -57,7 +57,7 @@ bool Create(u32 adapter_index, bool enable_debug_layer)
|
||||
dxgi_factory = D3DCommon::CreateDXGIFactory(enable_debug_layer);
|
||||
if (!dxgi_factory)
|
||||
{
|
||||
PanicAlertT("Failed to create DXGI factory");
|
||||
PanicAlertFmtT("Failed to create DXGI factory");
|
||||
D3DCommon::UnloadLibraries();
|
||||
s_d3d11_library.Close();
|
||||
return false;
|
||||
@@ -113,7 +113,7 @@ bool Create(u32 adapter_index, bool enable_debug_layer)
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
PanicAlertT(
|
||||
PanicAlertFmtT(
|
||||
"Failed to initialize Direct3D.\nMake sure your video card supports at least D3D 10.0");
|
||||
dxgi_factory.Reset();
|
||||
D3DCommon::UnloadLibraries();
|
||||
|
||||
@@ -45,8 +45,8 @@ std::unique_ptr<DXTexture> DXTexture::Create(const TextureConfig& config)
|
||||
HRESULT hr = D3D::device->CreateTexture2D(&desc, nullptr, d3d_texture.GetAddressOf());
|
||||
if (FAILED(hr))
|
||||
{
|
||||
PanicAlert("Failed to create %ux%ux%u D3D backing texture", config.width, config.height,
|
||||
config.layers);
|
||||
PanicAlertFmt("Failed to create {}x{}x{} D3D backing texture", config.width, config.height,
|
||||
config.layers);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -92,8 +92,8 @@ bool DXTexture::CreateSRV()
|
||||
HRESULT hr = D3D::device->CreateShaderResourceView(m_texture.Get(), &desc, m_srv.GetAddressOf());
|
||||
if (FAILED(hr))
|
||||
{
|
||||
PanicAlert("Failed to create %ux%ux%u D3D SRV", m_config.width, m_config.height,
|
||||
m_config.layers);
|
||||
PanicAlertFmt("Failed to create {}x{}x{} D3D SRV", m_config.width, m_config.height,
|
||||
m_config.layers);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -109,8 +109,8 @@ bool DXTexture::CreateUAV()
|
||||
HRESULT hr = D3D::device->CreateUnorderedAccessView(m_texture.Get(), &desc, m_uav.GetAddressOf());
|
||||
if (FAILED(hr))
|
||||
{
|
||||
PanicAlert("Failed to create %ux%ux%u D3D UAV", m_config.width, m_config.height,
|
||||
m_config.layers);
|
||||
PanicAlertFmt("Failed to create {}x{}x{} D3D UAV", m_config.width, m_config.height,
|
||||
m_config.layers);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ DXGI_FORMAT VarToD3D(VarType t, int size, bool integer)
|
||||
DXGI_FORMAT retval = d3d_format_lookup[(int)t + 5 * (size - 1) + 5 * 4 * (int)integer];
|
||||
if (retval == DXGI_FORMAT_UNKNOWN)
|
||||
{
|
||||
PanicAlert("VarToD3D: Invalid type/size combo %i , %i, %i", (int)t, size, (int)integer);
|
||||
PanicAlertFmt("VarToD3D: Invalid type/size combo {}, {}, {}", t, size, integer);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
|
||||
std::unique_ptr<SwapChain> swap_chain;
|
||||
if (wsi.render_surface && !(swap_chain = SwapChain::Create(wsi)))
|
||||
{
|
||||
PanicAlertT("Failed to create D3D swap chain");
|
||||
PanicAlertFmtT("Failed to create D3D swap chain");
|
||||
ShutdownShared();
|
||||
D3D::Destroy();
|
||||
return false;
|
||||
|
||||
@@ -152,7 +152,7 @@ void BoundingBox::Flush()
|
||||
Renderer::GetInstance()->ExecuteCommandList(false);
|
||||
if (!m_upload_buffer.ReserveMemory(copy_size, sizeof(ValueType)))
|
||||
{
|
||||
PanicAlert("Failed to allocate bbox stream buffer space");
|
||||
PanicAlertFmt("Failed to allocate bbox stream buffer space");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ bool DXContext::Create(u32 adapter_index, bool enable_debug_layer)
|
||||
!s_d3d12_library.GetSymbol("D3D12GetDebugInterface", &s_d3d12_get_debug_interface) ||
|
||||
!s_d3d12_library.GetSymbol("D3D12SerializeRootSignature", &s_d3d12_serialize_root_signature))
|
||||
{
|
||||
PanicAlertT("d3d12.dll could not be loaded.");
|
||||
PanicAlertFmtT("d3d12.dll could not be loaded.");
|
||||
s_d3d12_library.Close();
|
||||
return false;
|
||||
}
|
||||
@@ -253,7 +253,7 @@ bool DXContext::CreateDescriptorHeaps()
|
||||
|
||||
if (!m_descriptor_heap_manager.Allocate(&m_null_srv_descriptor))
|
||||
{
|
||||
PanicAlert("Failed to allocate null descriptor");
|
||||
PanicAlertFmt("Failed to allocate null descriptor");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -303,8 +303,8 @@ static bool BuildRootSignature(ID3D12Device* device, ID3D12RootSignature** sig_p
|
||||
&root_signature_blob, &root_signature_error_blob);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
PanicAlert("Failed to serialize root signature: %s",
|
||||
static_cast<const char*>(root_signature_error_blob->GetBufferPointer()));
|
||||
PanicAlertFmt("Failed to serialize root signature: {}",
|
||||
static_cast<const char*>(root_signature_error_blob->GetBufferPointer()));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -400,7 +400,7 @@ bool DXContext::CreateTextureUploadBuffer()
|
||||
{
|
||||
if (!m_texture_upload_buffer.AllocateBuffer(TEXTURE_UPLOAD_BUFFER_SIZE))
|
||||
{
|
||||
PanicAlert("Failed to create texture upload buffer");
|
||||
PanicAlertFmt("Failed to create texture upload buffer");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -425,7 +425,7 @@ bool DXContext::CreateCommandLists()
|
||||
nullptr, IID_PPV_ARGS(res.command_list.GetAddressOf()));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
PanicAlert("Failed to create command list.");
|
||||
PanicAlertFmt("Failed to create command list.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -508,7 +508,7 @@ void DXContext::RecreateGXRootSignature()
|
||||
{
|
||||
m_gx_root_signature.Reset();
|
||||
if (!CreateGXRootSignature())
|
||||
PanicAlert("Failed to re-create GX root signature.");
|
||||
PanicAlertFmt("Failed to re-create GX root signature.");
|
||||
}
|
||||
|
||||
void DXContext::DestroyPendingResources(CommandListResources& cmdlist)
|
||||
|
||||
@@ -171,7 +171,7 @@ std::unique_ptr<DXPipeline> DXPipeline::Create(const AbstractPipelineConfig& con
|
||||
desc.pRootSignature = g_dx_context->GetUtilityRootSignature();
|
||||
break;
|
||||
default:
|
||||
PanicAlert("Unknown pipeline layout.");
|
||||
PanicAlertFmt("Unknown pipeline layout.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ std::unique_ptr<DXTexture> DXTexture::CreateAdopted(ID3D12Resource* resource)
|
||||
if (desc.Dimension != D3D12_RESOURCE_DIMENSION_TEXTURE2D ||
|
||||
format == AbstractTextureFormat::Undefined)
|
||||
{
|
||||
PanicAlert("Unknown format for adopted texture");
|
||||
PanicAlertFmt("Unknown format for adopted texture");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ bool DXTexture::CreateSRVDescriptor()
|
||||
{
|
||||
if (!g_dx_context->GetDescriptorHeapManager().Allocate(&m_srv_descriptor))
|
||||
{
|
||||
PanicAlert("Failed to allocate SRV descriptor");
|
||||
PanicAlertFmt("Failed to allocate SRV descriptor");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ bool DXTexture::CreateUAVDescriptor()
|
||||
{
|
||||
if (!g_dx_context->GetDescriptorHeapManager().Allocate(&m_uav_descriptor))
|
||||
{
|
||||
PanicAlert("Failed to allocate UAV descriptor");
|
||||
PanicAlertFmt("Failed to allocate UAV descriptor");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ void DXTexture::Load(u32 level, u32 width, u32 height, u32 row_length, const u8*
|
||||
staging_buffer = CreateTextureUploadBuffer(upload_size);
|
||||
if (!staging_buffer || FAILED(staging_buffer->Map(0, &read_range, &upload_buffer_ptr)))
|
||||
{
|
||||
PanicAlert("Failed to allocate/map temporary texture upload buffer");
|
||||
PanicAlertFmt("Failed to allocate/map temporary texture upload buffer");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ void DXTexture::Load(u32 level, u32 width, u32 height, u32 row_length, const u8*
|
||||
if (!g_dx_context->GetTextureUploadBuffer().ReserveMemory(
|
||||
upload_size, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT))
|
||||
{
|
||||
PanicAlert("Failed to allocate texture upload buffer");
|
||||
PanicAlertFmt("Failed to allocate texture upload buffer");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -436,7 +436,7 @@ bool DXFramebuffer::CreateRTVDescriptor()
|
||||
{
|
||||
if (!g_dx_context->GetRTVHeapManager().Allocate(&m_rtv_descriptor))
|
||||
{
|
||||
PanicAlert("Failed to allocate RTV descriptor");
|
||||
PanicAlertFmt("Failed to allocate RTV descriptor");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -471,7 +471,7 @@ bool DXFramebuffer::CreateDSVDescriptor()
|
||||
{
|
||||
if (!g_dx_context->GetDSVHeapManager().Allocate(&m_dsv_descriptor))
|
||||
{
|
||||
PanicAlert("Failed to allocate RTV descriptor");
|
||||
PanicAlertFmt("Failed to allocate RTV descriptor");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ bool DescriptorHeapManager::Allocate(DescriptorHandle* handle)
|
||||
return true;
|
||||
}
|
||||
|
||||
PanicAlert("Out of fixed descriptors");
|
||||
PanicAlertFmt("Out of fixed descriptors");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,8 +72,8 @@ bool StreamBuffer::ReserveMemory(u32 num_bytes, u32 alignment)
|
||||
// Check for sane allocations
|
||||
if (required_bytes > m_size)
|
||||
{
|
||||
PanicAlert("Attempting to allocate %u bytes from a %u byte stream buffer",
|
||||
static_cast<uint32_t>(num_bytes), static_cast<uint32_t>(m_size));
|
||||
PanicAlertFmt("Attempting to allocate {} bytes from a {} byte stream buffer", num_bytes,
|
||||
m_size);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ bool VertexManager::Initialize()
|
||||
!m_uniform_stream_buffer.AllocateBuffer(UNIFORM_STREAM_BUFFER_SIZE) ||
|
||||
!m_texel_stream_buffer.AllocateBuffer(TEXEL_STREAM_BUFFER_SIZE))
|
||||
{
|
||||
PanicAlert("Failed to allocate streaming buffers");
|
||||
PanicAlertFmt("Failed to allocate streaming buffers");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ bool VertexManager::Initialize()
|
||||
DescriptorHandle& dh = m_texel_buffer_views[it.first];
|
||||
if (!g_dx_context->GetDescriptorHeapManager().Allocate(&dh))
|
||||
{
|
||||
PanicAlert("Failed to allocate descriptor for texel buffer");
|
||||
PanicAlertFmt("Failed to allocate descriptor for texel buffer");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ void VertexManager::ResetBuffer(u32 vertex_stride)
|
||||
|
||||
// If we still failed, that means the allocation was too large and will never succeed, so panic
|
||||
if (!has_vbuffer_allocation || !has_ibuffer_allocation)
|
||||
PanicAlert("Failed to allocate space in streaming buffers for pending draw");
|
||||
PanicAlertFmt("Failed to allocate space in streaming buffers for pending draw");
|
||||
}
|
||||
|
||||
// Update pointers
|
||||
@@ -208,7 +208,7 @@ void VertexManager::UploadAllConstants()
|
||||
if (!m_uniform_stream_buffer.ReserveMemory(allocation_size,
|
||||
D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT))
|
||||
{
|
||||
PanicAlert("Failed to allocate space for constants in streaming buffer");
|
||||
PanicAlertFmt("Failed to allocate space for constants in streaming buffer");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ bool VertexManager::UploadTexelBuffer(const void* data, u32 data_size, TexelBuff
|
||||
Renderer::GetInstance()->ExecuteCommandList(false);
|
||||
if (!m_texel_stream_buffer.ReserveMemory(data_size, elem_size))
|
||||
{
|
||||
PanicAlert("Failed to allocate %u bytes from texel buffer", data_size);
|
||||
PanicAlertFmt("Failed to allocate {} bytes from texel buffer", data_size);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -300,7 +300,7 @@ bool VertexManager::UploadTexelBuffer(const void* data, u32 data_size, TexelBuff
|
||||
Renderer::GetInstance()->ExecuteCommandList(false);
|
||||
if (!m_texel_stream_buffer.ReserveMemory(reserve_size, elem_size))
|
||||
{
|
||||
PanicAlert("Failed to allocate %u bytes from texel buffer", reserve_size);
|
||||
PanicAlertFmt("Failed to allocate {} bytes from texel buffer", reserve_size);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
|
||||
{
|
||||
if (!DXContext::Create(g_Config.iAdapter, g_Config.bEnableValidationLayer))
|
||||
{
|
||||
PanicAlert("Failed to create D3D12 context");
|
||||
PanicAlertFmtT("Failed to create D3D12 context");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
|
||||
|
||||
if (!g_dx_context->CreateGlobalResources())
|
||||
{
|
||||
PanicAlert("Failed to create D3D12 global resources");
|
||||
PanicAlertFmtT("Failed to create D3D12 global resources");
|
||||
DXContext::Destroy();
|
||||
ShutdownShared();
|
||||
return false;
|
||||
@@ -118,7 +118,7 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
|
||||
std::unique_ptr<SwapChain> swap_chain;
|
||||
if (wsi.render_surface && !(swap_chain = SwapChain::Create(wsi)))
|
||||
{
|
||||
PanicAlertT("Failed to create D3D swap chain");
|
||||
PanicAlertFmtT("Failed to create D3D swap chain");
|
||||
DXContext::Destroy();
|
||||
ShutdownShared();
|
||||
return false;
|
||||
@@ -136,7 +136,7 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
|
||||
!g_renderer->Initialize() || !g_framebuffer_manager->Initialize() ||
|
||||
!g_texture_cache->Initialize() || !PerfQuery::GetInstance()->Initialize())
|
||||
{
|
||||
PanicAlert("Failed to initialize renderer classes");
|
||||
PanicAlertFmtT("Failed to initialize renderer classes");
|
||||
Shutdown();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -33,15 +33,15 @@ bool LoadLibraries()
|
||||
|
||||
if (!s_dxgi_library.Open("dxgi.dll"))
|
||||
{
|
||||
PanicAlertT("Failed to load dxgi.dll");
|
||||
PanicAlertFmtT("Failed to load dxgi.dll");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!s_d3dcompiler_library.Open(D3DCOMPILER_DLL_A))
|
||||
{
|
||||
PanicAlertT("Failed to load %s. If you are using Windows 7, try installing the "
|
||||
"KB4019990 update package.",
|
||||
D3DCOMPILER_DLL_A);
|
||||
PanicAlertFmtT("Failed to load {0}. If you are using Windows 7, try installing the "
|
||||
"KB4019990 update package.",
|
||||
D3DCOMPILER_DLL_A);
|
||||
s_dxgi_library.Close();
|
||||
return false;
|
||||
}
|
||||
@@ -50,7 +50,7 @@ bool LoadLibraries()
|
||||
if (!s_d3dcompiler_library.GetSymbol("D3DCompile", &d3d_compile) ||
|
||||
!s_dxgi_library.GetSymbol("CreateDXGIFactory", &create_dxgi_factory))
|
||||
{
|
||||
PanicAlertT("Failed to find one or more D3D symbols");
|
||||
PanicAlertFmtT("Failed to find one or more D3D symbols");
|
||||
s_d3dcompiler_library.Close();
|
||||
s_dxgi_library.Close();
|
||||
return false;
|
||||
@@ -88,7 +88,7 @@ Microsoft::WRL::ComPtr<IDXGIFactory> CreateDXGIFactory(bool debug_device)
|
||||
HRESULT hr = create_dxgi_factory(IID_PPV_ARGS(factory.ReleaseAndGetAddressOf()));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
PanicAlert("CreateDXGIFactory() failed with HRESULT %08X", hr);
|
||||
PanicAlertFmt("CreateDXGIFactory() failed with HRESULT {:08X}", hr);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ DXGI_FORMAT GetDXGIFormatForAbstractFormat(AbstractTextureFormat format, bool ty
|
||||
case AbstractTextureFormat::D32F_S8:
|
||||
return DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS;
|
||||
default:
|
||||
PanicAlert("Unhandled texture format.");
|
||||
PanicAlertFmt("Unhandled texture format.");
|
||||
return DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
}
|
||||
}
|
||||
@@ -180,7 +180,7 @@ DXGI_FORMAT GetSRVFormatForAbstractFormat(AbstractTextureFormat format)
|
||||
case AbstractTextureFormat::D32F_S8:
|
||||
return DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS;
|
||||
default:
|
||||
PanicAlert("Unhandled SRV format");
|
||||
PanicAlertFmt("Unhandled SRV format");
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
}
|
||||
@@ -198,7 +198,7 @@ DXGI_FORMAT GetRTVFormatForAbstractFormat(AbstractTextureFormat format, bool int
|
||||
case AbstractTextureFormat::R32F:
|
||||
return DXGI_FORMAT_R32_FLOAT;
|
||||
default:
|
||||
PanicAlert("Unhandled RTV format");
|
||||
PanicAlertFmt("Unhandled RTV format");
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
}
|
||||
@@ -215,7 +215,7 @@ DXGI_FORMAT GetDSVFormatForAbstractFormat(AbstractTextureFormat format)
|
||||
case AbstractTextureFormat::D32F_S8:
|
||||
return DXGI_FORMAT_D32_FLOAT_S8X24_UINT;
|
||||
default:
|
||||
PanicAlert("Unhandled DSV format");
|
||||
PanicAlertFmt("Unhandled DSV format");
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,8 +119,8 @@ std::optional<Shader::BinaryData> Shader::CompileShader(D3D_FEATURE_LEVEL featur
|
||||
file << "Video Backend: " + g_video_backend->GetDisplayName();
|
||||
file.close();
|
||||
|
||||
PanicAlert("Failed to compile %s:\nDebug info (%s):\n%s", filename.c_str(), target,
|
||||
static_cast<const char*>(errors->GetBufferPointer()));
|
||||
PanicAlertFmt("Failed to compile {}:\nDebug info ({}):\n{}", filename, target,
|
||||
static_cast<const char*>(errors->GetBufferPointer()));
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user