Workaround for retroarch's buildserver using an old SDK

This commit is contained in:
Henrik Rydgård 2025-02-14 19:06:00 -06:00
parent 863530fac8
commit 359f58be69
2 changed files with 10 additions and 1 deletions

View file

@ -18,7 +18,9 @@
#include <cfloat>
#include <D3Dcommon.h>
#ifndef __LIBRETRO__ // their build server uses an old SDK
#include <dxgi1_5.h>
#endif
#include <d3d11.h>
#include <d3d11_1.h>
#include <D3Dcompiler.h>
@ -369,6 +371,7 @@ D3D11DrawContext::D3D11DrawContext(ID3D11Device *device, ID3D11DeviceContext *de
caps_.supportsD3D9 = false;
}
#ifndef __LIBRETRO__ // their build server uses an old SDK
if (swapChain_) {
DXGI_SWAP_CHAIN_DESC swapChainDesc;
swapChain_->GetDesc(&swapChainDesc);
@ -377,7 +380,7 @@ D3D11DrawContext::D3D11DrawContext(ID3D11Device *device, ID3D11DeviceContext *de
swapChainTearingSupported_ = true;
}
}
#endif
// Temp texture for read-back of small images. Custom textures are created on demand for larger ones.
// TODO: Should really benchmark if this extra complexity has any benefit.
D3D11_TEXTURE2D_DESC packDesc{};
@ -496,7 +499,9 @@ void D3D11DrawContext::Present(PresentMode presentMode, int vblanks) {
uint32_t flags = 0;
if (presentMode != PresentMode::FIFO) {
interval = 0;
#ifndef __LIBRETRO__ // their build server uses an old SDK
flags |= swapChainTearingSupported_ ? DXGI_PRESENT_ALLOW_TEARING : 0; // Assume "vsync off" also means "allow tearing"
#endif
}
swapChain_->Present(interval, flags);
}

View file

@ -1,7 +1,9 @@
#include "ppsspp_config.h"
#include "Common/CommonWindows.h"
#ifndef __LIBRETRO__ // their build server uses an old SDK
#include <dxgi1_5.h>
#endif
#include <d3d11.h>
#include <WinError.h>
@ -178,6 +180,7 @@ bool D3D11Context::Init(HINSTANCE hInst, HWND wnd, std::string *error_message) {
swapChainDesc_.Windowed = TRUE;
swapChainDesc_.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
#ifndef __LIBRETRO__ // their build server uses an old SDK
IDXGIFactory5 *dxgiFactory5 = nullptr;
hr = dxgiFactory->QueryInterface(__uuidof(IDXGIFactory5), (void**)&dxgiFactory5);
if (SUCCEEDED(hr)) {
@ -191,6 +194,7 @@ bool D3D11Context::Init(HINSTANCE hInst, HWND wnd, std::string *error_message) {
}
dxgiFactory5->Release();
}
#endif
hr = dxgiFactory->CreateSwapChain(device_, &swapChainDesc_, &swapChain_);
dxgiFactory->MakeWindowAssociation(hWnd_, DXGI_MWA_NO_ALT_ENTER);