D3D11 Parameter Zoo tests for tiled resource handling

CreateTexture2D(), CreateTexture2D1(), CreateBuffer() should fail
CheckFeatureSupport() with D3D11_FEATURE_DATA_D3D11_OPTIONS1 or D3D11_FEATURE_DATA_D3D11_OPTIONS2 should return D3D11_TILED_RESOURCES_NOT_SUPPORTED
This commit is contained in:
Jake Turner
2024-01-09 12:44:14 +00:00
parent edbcbe53e2
commit b820a46605
2 changed files with 69 additions and 19 deletions
+57 -19
View File
@@ -60,9 +60,39 @@ RD_TEST(D3D11_Parameter_Zoo, D3D11GraphicsTest)
ctx1->SwapDeviceContextState(ctxstate_off, NULL);
std::string features1_tiled_resources("Features1: D3D11_TILED_RESOURCES_SUPPORTED");
std::string features2_tiled_resources("Features2: D3D11_TILED_RESOURCES_SUPPORTED");
std::string create_tiled_buffer("CreateTiledBuffer: Passed");
std::string create_tile_pool_buffer("CreateTile_PoolBuffer: Passed");
std::string create_tiled_texture2D("CreateTiledTexture2D: Passed");
std::string create_tiled_texture2D1("CreateTiledTexture2D1: Passed");
if(dev2)
{
// Test GetResourceTiling returns correct parameters for wrapped textures
D3D11_FEATURE_DATA_D3D11_OPTIONS1 features1;
CHECK_HR(dev2->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS1, &features1, sizeof(features1)));
if(features1.TiledResourcesTier == D3D11_TILED_RESOURCES_NOT_SUPPORTED)
features1_tiled_resources = "Features1: D3D11_TILED_RESOURCES_NOT_SUPPORTED";
D3D11_FEATURE_DATA_D3D11_OPTIONS2 features2;
CHECK_HR(dev2->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS2, &features2, sizeof(features2)));
if(features2.TiledResourcesTier == D3D11_TILED_RESOURCES_NOT_SUPPORTED)
features2_tiled_resources = "Features2: D3D11_TILED_RESOURCES_NOT_SUPPORTED";
// Check trying to create tiled resources fails
D3D11_BUFFER_DESC bufDesc = {};
bufDesc.ByteWidth = 1024;
bufDesc.Usage = D3D11_USAGE_DEFAULT;
bufDesc.StructureByteStride = 1;
bufDesc.CPUAccessFlags = 0;
bufDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
bufDesc.MiscFlags = D3D11_RESOURCE_MISC_TILED;
if(FAILED(dev2->CreateBuffer(&bufDesc, NULL, NULL)))
create_tiled_buffer = "CreateTiledBuffer: Failed";
bufDesc.MiscFlags = D3D11_RESOURCE_MISC_TILE_POOL;
if(FAILED(dev2->CreateBuffer(&bufDesc, NULL, NULL)))
create_tile_pool_buffer = "CreateTile_PoolBuffer: Failed";
D3D11_TEXTURE2D_DESC texDesc = {};
texDesc.Width = 8;
texDesc.Height = 8;
@@ -75,24 +105,25 @@ RD_TEST(D3D11_Parameter_Zoo, D3D11GraphicsTest)
texDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
texDesc.CPUAccessFlags = 0;
texDesc.MiscFlags = D3D11_RESOURCE_MISC_TILED;
ID3D11Texture2DPtr tiledTexture;
CHECK_HR(dev2->CreateTexture2D(&texDesc, NULL, &tiledTexture));
uint32_t numTiles;
D3D11_PACKED_MIP_DESC packed;
D3D11_TILE_SHAPE tileShape;
uint32_t numSubTiles = 1;
uint32_t firstSubTile = 0;
D3D11_SUBRESOURCE_TILING subTiling;
dev2->GetResourceTiling(tiledTexture, &numTiles, &packed, &tileShape, &numSubTiles,
firstSubTile, &subTiling);
if(tileShape.WidthInTexels == 0)
TEST_FATAL("WidthInTexels is zero");
if(tileShape.HeightInTexels == 0)
TEST_FATAL("HeightInTexels is zero");
if(tileShape.DepthInTexels == 0)
TEST_FATAL("DepthInTexels is zero");
if(FAILED(dev2->CreateTexture2D(&texDesc, NULL, NULL)))
create_tiled_texture2D = "CreateTiledTexture2D: Failed";
}
if(dev3)
{
D3D11_TEXTURE2D_DESC1 texDesc = {};
texDesc.Width = 8;
texDesc.Height = 8;
texDesc.MipLevels = 1;
texDesc.ArraySize = 1;
texDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
texDesc.SampleDesc.Count = 1;
texDesc.SampleDesc.Quality = 0;
texDesc.Usage = D3D11_USAGE_DEFAULT;
texDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
texDesc.CPUAccessFlags = 0;
texDesc.MiscFlags = D3D11_RESOURCE_MISC_TILED;
if(FAILED(dev3->CreateTexture2D1(&texDesc, NULL, NULL)))
create_tiled_texture2D1 = "CreateTiledTexture2D1: Failed";
}
while(Running())
@@ -134,6 +165,13 @@ RD_TEST(D3D11_Parameter_Zoo, D3D11GraphicsTest)
ctx->Draw(3, 0);
setMarker(features1_tiled_resources);
setMarker(features2_tiled_resources);
setMarker(create_tiled_buffer);
setMarker(create_tile_pool_buffer);
setMarker(create_tiled_texture2D);
setMarker(create_tiled_texture2D1);
Present();
// get back to how we should be with a handle to ctxstate and ctxstate_off bound
@@ -34,6 +34,18 @@ class D3D11_Parameter_Zoo(rdtest.TestCase):
self.check_pixel_value(overlay_id, int(0.5 * v.width), int(0.5 * v.height), [0.8, 0.1, 0.8, 1.0],
eps=1.0 / 256.0)
expected_markers = [
"Features1: D3D11_TILED_RESOURCES_NOT_SUPPORTED",
"Features2: D3D11_TILED_RESOURCES_NOT_SUPPORTED",
"CreateTiledBuffer: Failed",
"CreateTile_PoolBuffer: Failed",
"CreateTiledTexture2D: Failed",
"CreateTiledTexture2D1: Failed",
]
for marker in expected_markers:
if self.find_action(marker) == None:
raise rdtest.TestFailureException("Failed to find marker `{}`".format(marker))
out.Shutdown()
rdtest.log.success("Overlay color is as expected")