Skip to content

Commit

Permalink
nvapi-d3d: Add NvAPI_D3D_ImplicitSLIControl
Browse files Browse the repository at this point in the history
  • Loading branch information
jp7677 committed Jan 27, 2022
1 parent 04b9dbd commit 1644008
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/nvapi_d3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ extern "C" {
return Ok(n, alreadyLoggedOk);
}

NvAPI_Status __cdecl NvAPI_D3D_ImplicitSLIControl(IMPLICIT_SLI_CONTROL implicitSLIControl) {
constexpr auto n = __func__;

if (implicitSLIControl == ENABLE_IMPLICIT_SLI)
return Error(n); // No SLI with this implementation

return Ok(n);
}

NvAPI_Status __cdecl NvAPI_D3D1x_GetGraphicsCapabilities(IUnknown *pDevice,
NvU32 structVersion,
NV_D3D1x_GRAPHICS_CAPS *pGraphicsCaps) {
Expand Down
1 change: 1 addition & 0 deletions src/nvapi_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ extern "C" {
INSERT_AND_RETURN_WHEN_EQUALS(NvAPI_D3D_GetObjectHandleForResource)
INSERT_AND_RETURN_WHEN_EQUALS(NvAPI_D3D_SetResourceHint)
INSERT_AND_RETURN_WHEN_EQUALS(NvAPI_D3D_GetCurrentSLIState)
INSERT_AND_RETURN_WHEN_EQUALS(NvAPI_D3D_ImplicitSLIControl)
INSERT_AND_RETURN_WHEN_EQUALS(NvAPI_D3D_BeginResourceRendering)
INSERT_AND_RETURN_WHEN_EQUALS(NvAPI_D3D_EndResourceRendering)
INSERT_AND_RETURN_WHEN_EQUALS(NvAPI_GPU_GetGPUType)
Expand Down
10 changes: 9 additions & 1 deletion tests/nvapi_d3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ TEST_CASE("D3D methods succeed", "[.d3d]") {
REQUIRE(NvAPI_D3D_SetResourceHint(&unknown, NVDX_ObjectHandle(), NVAPI_D3D_SRH_CATEGORY_SLI, 1, &value) == NVAPI_NO_IMPLEMENTATION);
}

SECTION("SetResourceHint returns NoImplementation") {
SECTION("SetResourceHint returns no-implementation") {
REQUIRE(NvAPI_D3D_SetResourceHint(&unknown, NVDX_ObjectHandle(), NVAPI_D3D_SRH_CATEGORY_SLI, 0, nullptr) == NVAPI_NO_IMPLEMENTATION);
}

Expand All @@ -38,6 +38,14 @@ TEST_CASE("D3D methods succeed", "[.d3d]") {
REQUIRE(state.numVRSLIGpus == 0);
}

SECTION("ImplicitSLIControl returns OK") {
REQUIRE(NvAPI_D3D_ImplicitSLIControl(DISABLE_IMPLICIT_SLI) == NVAPI_OK);
}

SECTION("ImplicitSLIControl returns error when enabling SLI") {
REQUIRE(NvAPI_D3D_ImplicitSLIControl(ENABLE_IMPLICIT_SLI) == NVAPI_ERROR);
}

SECTION("GetGraphicsCapabilities (V1) returns OK") {
NV_D3D1x_GRAPHICS_CAPS_V1 caps;
REQUIRE(NvAPI_D3D1x_GetGraphicsCapabilities(&unknown, NV_D3D1x_GRAPHICS_CAPS_VER1, reinterpret_cast<NV_D3D1x_GRAPHICS_CAPS*>(&caps)) == NVAPI_OK);
Expand Down

0 comments on commit 1644008

Please sign in to comment.