Test D3D discards with NULL region or rects

This commit is contained in:
baldurk
2020-10-22 15:07:58 +01:00
parent ec73718cf0
commit 8bdd9585f5
2 changed files with 17 additions and 0 deletions
@@ -244,6 +244,11 @@ RD_TEST(D3D11_Discard_Zoo, D3D11GraphicsTest)
MakeTexture(DXGI_FORMAT_R16G16B16A16_FLOAT, 300, 300).Multisampled(4).Array(5).RTV());
DiscardView<ID3D11RenderTargetViewPtr>(MakeRTV(tex).FirstSlice(2).NumSlices(1));
// test with DiscardView1 and NULL rect
TEX_TEST("DiscardAll Slice2",
MakeTexture(DXGI_FORMAT_R16G16B16A16_FLOAT, 300, 300).Multisampled(4).Array(5).RTV());
ctx1->DiscardView1((ID3D11RenderTargetViewPtr)MakeRTV(tex).FirstSlice(2).NumSlices(1), NULL, 0);
// test 1D/3D textures
ctx1->DiscardResource(tex1d);
ctx1->DiscardResource(tex3d);
@@ -402,6 +402,18 @@ float4 main(v2f IN) : SV_Target0
TEX_TEST(L"DiscardAll", MakeTexture(DXGI_FORMAT_BC7_UNORM, 300, 300));
DiscardResource(cmd, tex);
// test with discarding a NULL region
TEX_TEST(L"DiscardAll", MakeTexture(DXGI_FORMAT_R16G16B16A16_FLOAT, 300, 300));
cmd->DiscardResource(tex, NULL);
// and with NULL rects
TEX_TEST(L"DiscardAll", MakeTexture(DXGI_FORMAT_R16G16B16A16_FLOAT, 300, 300));
{
D3D12_DISCARD_REGION reg = {};
reg.FirstSubresource = 0;
reg.NumSubresources = 1;
cmd->DiscardResource(tex, &reg);
}
// test with different mips/array sizes
TEX_TEST(L"DiscardAll", MakeTexture(DXGI_FORMAT_R16G16B16A16_FLOAT, 300, 300).Mips(5));
DiscardResource(cmd, tex);