tests: Add simple stress test for UPLOAD allocation.

Try to allocate a lot of memory at once. Useful for seeing if fallbacks
work as intended.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This commit is contained in:
Hans-Kristian Arntzen 2021-10-04 14:40:21 +02:00
parent 26dc9e7da5
commit a2f350117f
2 changed files with 37 additions and 0 deletions

View File

@ -2784,6 +2784,42 @@ void test_stress_suballocation_thread(void *userdata)
#undef rand_r
}
void test_stress_suballocation_rebar(void)
{
ID3D12Resource *resources_suballocate[4096];
ID3D12Resource *resources_direct[1024];
struct test_context context;
unsigned int i;
if (!init_compute_test_context(&context))
return;
/* Spam allocate enough that we should either exhaust small BAR, or our budget.
* Verify that we don't collapse in such a situation. */
for (i = 0; i < ARRAY_SIZE(resources_suballocate); i++)
{
resources_suballocate[i] = create_upload_buffer(context.device, 256 * 1024, NULL);
ok(!!resources_suballocate[i], "Failed to create buffer.\n");
}
for (i = 0; i < ARRAY_SIZE(resources_suballocate); i++)
if (resources_suballocate[i])
ID3D12Resource_Release(resources_suballocate[i]);
for (i = 0; i < ARRAY_SIZE(resources_direct); i++)
{
resources_direct[i] = create_upload_buffer(context.device, 2 * 1024 * 1024, NULL);
ok(!!resources_direct[i], "Failed to create buffer.\n");
}
for (i = 0; i < ARRAY_SIZE(resources_direct); i++)
if (resources_direct[i])
ID3D12Resource_Release(resources_direct[i]);
destroy_test_context(&context);
}
void test_stress_suballocation(void)
{
struct suballocation_thread_data data;

View File

@ -252,6 +252,7 @@ decl_test(test_vrs_dxil);
decl_test(test_vrs_image);
decl_test(test_stress_suballocation);
decl_test(test_stress_suballocation_multithread);
decl_test(test_stress_suballocation_rebar);
decl_test(test_placed_image_alignment);
decl_test(test_root_parameter_preservation);
decl_test(test_cbv_hoisting_sm51);