d3d11/tests: Use CRT allocation functions.

This commit is contained in:
Alex Henrie 2023-10-29 10:17:19 -06:00 committed by Alexandre Julliard
parent b99ea51331
commit f2d1734794

View file

@ -26,7 +26,6 @@
#include "initguid.h"
#include "d3d11_4.h"
#include "winternl.h"
#include "wine/heap.h"
#include "wine/wined3d.h"
#include "wine/test.h"
@ -135,7 +134,7 @@ static void queue_test_entry(const struct test_entry *t)
if (mt_test_count >= mt_tests_size)
{
mt_tests_size = max(16, mt_tests_size * 2);
mt_tests = heap_realloc(mt_tests, mt_tests_size * sizeof(*t));
mt_tests = realloc(mt_tests, mt_tests_size * sizeof(*t));
}
mt_tests[mt_test_count++] = *t;
}
@ -205,7 +204,7 @@ static void run_queued_tests(void)
GetSystemInfo(&si);
thread_count = si.dwNumberOfProcessors;
threads = heap_calloc(thread_count, sizeof(*threads));
threads = calloc(thread_count, sizeof(*threads));
for (i = 0, test_idx = 0; i < thread_count; ++i)
{
threads[i] = CreateThread(NULL, 0, thread_func, &test_idx, 0, NULL);
@ -216,7 +215,7 @@ static void run_queued_tests(void)
{
CloseHandle(threads[i]);
}
heap_free(threads);
free(threads);
}
static void set_box(D3D11_BOX *box, UINT left, UINT top, UINT front, UINT right, UINT bottom, UINT back)
@ -11473,7 +11472,7 @@ static void test_render_target_views(void)
texture_desc.CPUAccessFlags = 0;
texture_desc.MiscFlags = 0;
data = heap_alloc_zero(texture_desc.Width * texture_desc.Height * 4);
data = calloc(texture_desc.Width * texture_desc.Height, 4);
ok(!!data, "Failed to allocate memory.\n");
for (i = 0; i < ARRAY_SIZE(tests); ++i)
@ -11557,7 +11556,7 @@ static void test_render_target_views(void)
ID3D11Resource_Release(resource);
}
heap_free(data);
free(data);
release_test_context(&test_context);
}
@ -15403,7 +15402,7 @@ static void test_resource_access(const D3D_FEATURE_LEVEL feature_level)
data.SysMemPitch = 0;
data.SysMemSlicePitch = 0;
data.pSysMem = heap_alloc(10240);
data.pSysMem = malloc(10240);
ok(!!data.pSysMem, "Failed to allocate memory.\n");
for (i = 0; i < ARRAY_SIZE(tests); ++i)
@ -15588,7 +15587,7 @@ static void test_resource_access(const D3D_FEATURE_LEVEL feature_level)
}
}
heap_free((void *)data.pSysMem);
free((void *)data.pSysMem);
ID3D11DeviceContext_Release(context);
refcount = ID3D11Device_Release(device);
@ -24691,7 +24690,7 @@ static void test_buffer_srv(void)
resource_data.SysMemSlicePitch = 0;
if (current_buffer->data_offset)
{
data = heap_alloc_zero(current_buffer->byte_count);
data = calloc(1, current_buffer->byte_count);
ok(!!data, "Failed to allocate memory.\n");
memcpy(data + current_buffer->data_offset, current_buffer->data,
current_buffer->byte_count - current_buffer->data_offset);
@ -24703,7 +24702,7 @@ static void test_buffer_srv(void)
}
hr = ID3D11Device_CreateBuffer(device, &buffer_desc, &resource_data, &buffer);
ok(hr == S_OK, "Test %u: Got unexpected hr %#lx.\n", i, hr);
heap_free(data);
free(data);
}
else
{
@ -28460,7 +28459,7 @@ static void test_depth_bias(void)
rasterizer_desc.SlopeScaledDepthBias = 0.0f;
rasterizer_desc.DepthClipEnable = TRUE;
depth_values = heap_calloc(swapchain_desc.height, sizeof(*depth_values));
depth_values = calloc(swapchain_desc.height, sizeof(*depth_values));
ok(!!depth_values, "Failed to allocate memory.\n");
for (format_idx = 0; format_idx < ARRAY_SIZE(formats); ++format_idx)
@ -28669,7 +28668,7 @@ static void test_depth_bias(void)
winetest_pop_context();
}
heap_free(depth_values);
free(depth_values);
release_test_context(&test_context);
}
@ -30430,7 +30429,7 @@ static void test_generate_mips(void)
device = test_context.device;
context = test_context.immediate_context;
data = heap_alloc(sizeof(*data) * 32 * 32 * 32);
data = malloc(sizeof(*data) * 32 * 32 * 32);
for (z = 0; z < 32; ++z)
{
@ -30457,7 +30456,7 @@ static void test_generate_mips(void)
}
}
zero_data = heap_alloc_zero(sizeof(*zero_data) * 16 * 16 * 16);
zero_data = calloc(16 * 16 * 16, sizeof(*zero_data));
for (i = 0; i < ARRAY_SIZE(resource_types); ++i)
{
@ -30659,8 +30658,8 @@ static void test_generate_mips(void)
ID3D11Resource_Release(resource);
heap_free(zero_data);
heap_free(data);
free(zero_data);
free(data);
release_test_context(&test_context);
}
@ -33987,7 +33986,7 @@ static void test_texture_compressed_3d(void)
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
/* Simply test all combinations of r0 and r1. */
texture_data = heap_alloc(256 * 256 * sizeof(UINT64));
texture_data = malloc(256 * 256 * sizeof(UINT64));
for (r1 = 0; r1 < 256; ++r1)
{
for (r0 = 0; r0 < 256; ++r0)
@ -34012,7 +34011,7 @@ static void test_texture_compressed_3d(void)
texture_desc.MiscFlags = 0;
hr = ID3D11Device_CreateTexture3D(device, &texture_desc, &resource_data, &texture);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
heap_free(texture_data);
free(texture_data);
hr = ID3D11Device_CreateShaderResourceView(device, (ID3D11Resource *)texture, NULL, &srv);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);