Barebones antilag 2 support for dx12

This commit is contained in:
FakeMichau
2024-09-06 00:46:49 +02:00
parent ddcfc835f3
commit de523f7fcb
2 changed files with 23 additions and 1 deletions
+20
View File
@@ -307,10 +307,30 @@ namespace nvd {
}
NvAPI_Status __cdecl NvAPI_D3D_SetLatencyMarker(IUnknown* pDev, NV_LATENCY_MARKER_PARAMS* pSetLatencyMarkerParams) {
if (!pDev)
return Error();
if (!al2_context.m_pAntiLagAPI) {
ID3D12Device* device = nullptr;
HRESULT hr = pDev->QueryInterface(__uuidof(ID3D12Device), reinterpret_cast<void**>(&device));
auto res = AMD::AntiLag2DX12::Initialize(&al2_context, device);
log(std::format("AL2 Init: {}", S_OK == res));
}
if (pSetLatencyMarkerParams->markerType == SIMULATION_START) {
AMD::AntiLag2DX12::Update(&al2_context, true, 0);
}
return Ok();
}
NvAPI_Status __cdecl NvAPI_D3D_Sleep(IUnknown* pDevice) {
if (!pDevice)
return Error();
if (!al2_context.m_pAntiLagAPI) {
ID3D12Device* device = nullptr;
HRESULT hr = pDevice->QueryInterface(__uuidof(ID3D12Device), reinterpret_cast<void**>(&device));
auto res = AMD::AntiLag2DX12::Initialize(&al2_context, device);
log(std::format("AL2 Init: {}", S_OK == res));
}
AMD::AntiLag2DX12::Update(&al2_context, true, 0);
return Ok();
}
+3 -1
View File
@@ -11,6 +11,7 @@
#endif
#include <vector>
#include "../include/ffx_antilag2_dx12.h"
#include "util.h"
#include "spoofInfo.h"
#include "log.h"
@@ -20,13 +21,14 @@ namespace nvd {
static auto drsSession = reinterpret_cast<NvDRSSessionHandle>(&drs);
static auto drsProfile = reinterpret_cast<NvDRSProfileHandle>(&drs);
static LUID luid;
static UINT deviceId;
static UINT vendorId;
static UINT subSysId;
static UINT revisionId;
static AMD::AntiLag2DX12::Context al2_context = {};
NvAPI_Status __cdecl NvAPI_Initialize();
NvAPI_Status __cdecl NvAPI_GetInterfaceVersionString(NvAPI_ShortString desc);
NvAPI_Status __cdecl NvAPI_EnumPhysicalGPUs(NvPhysicalGpuHandle handles[NVAPI_MAX_PHYSICAL_GPUS], NvU32* count);