Skip to content

Commit

Permalink
nvapi-d3d: Stub NvAPI_D3D_RegisterDevice()
Browse files Browse the repository at this point in the history
  • Loading branch information
jp7677 committed Jan 27, 2025
1 parent 430c503 commit fc92fb9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/nvapi_d3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
extern "C" {
using namespace dxvk;

NvAPI_Status __cdecl NvAPI_D3D_RegisterDevice(IUnknown* pDev) {
constexpr auto n = __func__;

if (log::tracing())
log::trace(n, log::fmt::ptr(pDev));

// Just acknowledge the request since there is nothing to do here
return Ok(n);
}

NvAPI_Status __cdecl NvAPI_D3D_GetObjectHandleForResource(IUnknown* pDevice, IUnknown* pResource, NVDX_ObjectHandle* pHandle) {
constexpr auto n = __func__;
thread_local bool alreadyLogged = false;
Expand Down
1 change: 1 addition & 0 deletions src/nvapi_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ extern "C" {
INSERT_AND_RETURN_WHEN_EQUALS(NvAPI_D3D12_BuildRaytracingAccelerationStructureEx)
INSERT_AND_RETURN_WHEN_EQUALS(NvAPI_D3D12_NotifyOutOfBandCommandQueue)
INSERT_AND_RETURN_WHEN_EQUALS(NvAPI_D3D12_SetAsyncFrameMarker)
INSERT_AND_RETURN_WHEN_EQUALS(NvAPI_D3D_RegisterDevice)
INSERT_AND_RETURN_WHEN_EQUALS(NvAPI_D3D_GetObjectHandleForResource)
INSERT_AND_RETURN_WHEN_EQUALS(NvAPI_D3D_SetResourceHint)
INSERT_AND_RETURN_WHEN_EQUALS(NvAPI_D3D_GetCurrentSLIState)
Expand Down
4 changes: 4 additions & 0 deletions tests/nvapi_d3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ using namespace trompeloeil;
TEST_CASE("D3D methods succeed", "[.d3d]") {
UnknownMock unknown;

SECTION("RegisterDevice returns OK") {
REQUIRE(NvAPI_D3D_RegisterDevice(&unknown) == NVAPI_OK);
}

SECTION("GetObjectHandleForResource returns OK") {
NVDX_ObjectHandle handle;
REQUIRE(NvAPI_D3D_GetObjectHandleForResource(&unknown, &unknown, &handle) == NVAPI_OK);
Expand Down

0 comments on commit fc92fb9

Please sign in to comment.