Skip to content

Commit

Permalink
tests: Simplify test
Browse files Browse the repository at this point in the history
No more caching issues.
  • Loading branch information
jp7677 committed Sep 17, 2023
1 parent 4e994f7 commit 66a009f
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions tests/nvapi_d3d12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,37 +432,21 @@ TEST_CASE("D3D12 methods succeed", "[.d3d12]") {
}

SECTION("Launch CuBIN without ID3D12GraphicsCommandListExt1 returns OK") {
D3D12Vkd3dGraphicsCommandListMock commandList0;
ALLOW_CALL(commandList0, QueryInterface(__uuidof(ID3D12GraphicsCommandList1), _))
.LR_SIDE_EFFECT(*_2 = static_cast<ID3D12GraphicsCommandList1*>(&commandList0))
.LR_SIDE_EFFECT(commandListRefCount++)
.RETURN(S_OK);
ALLOW_CALL(commandList0, QueryInterface(ID3D12GraphicsCommandListExt::guid, _))
.LR_SIDE_EFFECT(*_2 = static_cast<ID3D12GraphicsCommandListExt*>(&commandList0))
.LR_SIDE_EFFECT(commandListRefCount++)
.RETURN(S_OK);
ALLOW_CALL(commandList0, QueryInterface(ID3D12GraphicsCommandListExt1::guid, _))
ALLOW_CALL(commandList, QueryInterface(ID3D12GraphicsCommandListExt1::guid, _))
.RETURN(E_NOINTERFACE);
ALLOW_CALL(commandList0, AddRef())
.LR_SIDE_EFFECT(commandListRefCount++)
.RETURN(commandListRefCount);
ALLOW_CALL(commandList0, Release())
.LR_SIDE_EFFECT(commandListRefCount--)
.RETURN(commandListRefCount);

auto shaderHandle = reinterpret_cast<D3D12_CUBIN_DATA_HANDLE*>(0xbadcf00d);
auto blockX = 1U;
auto blockY = 2U;
auto blockZ = 3U;
const void* params = nullptr;
auto paramSize = 4U;

REQUIRE_CALL(commandList0, LaunchCubinShader(shaderHandle, blockX, blockY, blockZ, params, paramSize))
REQUIRE_CALL(commandList, LaunchCubinShader(shaderHandle, blockX, blockY, blockZ, params, paramSize))
.RETURN(S_OK)
.TIMES(1);
FORBID_CALL(commandList0, LaunchCubinShaderEx(_, _, _, _, _, _, _, _, _));
FORBID_CALL(commandList, LaunchCubinShaderEx(_, _, _, _, _, _, _, _, _));

REQUIRE(NvAPI_D3D12_LaunchCubinShader(static_cast<ID3D12GraphicsCommandList*>(&commandList0), reinterpret_cast<NVDX_ObjectHandle>(shaderHandle), blockX, blockY, blockZ, params, paramSize) == NVAPI_OK);
REQUIRE(NvAPI_D3D12_LaunchCubinShader(static_cast<ID3D12GraphicsCommandList*>(&commandList), reinterpret_cast<NVDX_ObjectHandle>(shaderHandle), blockX, blockY, blockZ, params, paramSize) == NVAPI_OK);
REQUIRE(deviceRefCount == 0);
REQUIRE(commandListRefCount == 0);
}
Expand Down

0 comments on commit 66a009f

Please sign in to comment.