From e41640dcde3e7f9dab083021644b1fb7058f2ddf Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Fri, 28 Feb 2020 01:03:34 +0000 Subject: [PATCH] [d3d9] Make nullptr/oob checks in GetBackBuffer unlikely --- src/d3d9/d3d9_swapchain.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/d3d9/d3d9_swapchain.cpp b/src/d3d9/d3d9_swapchain.cpp index 0619af3a..00e804e3 100644 --- a/src/d3d9/d3d9_swapchain.cpp +++ b/src/d3d9/d3d9_swapchain.cpp @@ -331,10 +331,10 @@ namespace dxvk { UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9** ppBackBuffer) { - if (ppBackBuffer == nullptr) + if (unlikely(ppBackBuffer == nullptr)) return D3DERR_INVALIDCALL; - if (iBackBuffer >= m_presentParams.BackBufferCount) { + if (unlikely(iBackBuffer >= m_presentParams.BackBufferCount)) { Logger::err(str::format("D3D9: GetBackBuffer: Invalid back buffer index: ", iBackBuffer)); return D3DERR_INVALIDCALL; }