2026-03-17 02:51:34 +08:00
|
|
|
#include "fixtures/D3D12TestFixture.h"
|
|
|
|
|
|
2026-03-17 03:29:39 +08:00
|
|
|
TEST_F(D3D12TestFixture, CommandAllocator_Placeholder) {
|
2026-03-17 03:47:51 +08:00
|
|
|
ASSERT_NE(GetCommandAllocator(), nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(D3D12TestFixture, CommandAllocator_Reset) {
|
|
|
|
|
ComPtr<ID3D12CommandAllocator> allocator;
|
|
|
|
|
HRESULT hr = GetDevice()->CreateCommandAllocator(
|
|
|
|
|
D3D12_COMMAND_LIST_TYPE_DIRECT,
|
|
|
|
|
IID_PPV_ARGS(&allocator)
|
|
|
|
|
);
|
|
|
|
|
ASSERT_HRESULT_SUCCEEDED(hr);
|
|
|
|
|
|
|
|
|
|
hr = allocator->Reset();
|
|
|
|
|
ASSERT_HRESULT_SUCCEEDED(hr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(D3D12TestFixture, CommandAllocator_MultipleReset) {
|
|
|
|
|
ComPtr<ID3D12CommandAllocator> allocator;
|
|
|
|
|
HRESULT hr = GetDevice()->CreateCommandAllocator(
|
|
|
|
|
D3D12_COMMAND_LIST_TYPE_DIRECT,
|
|
|
|
|
IID_PPV_ARGS(&allocator)
|
|
|
|
|
);
|
|
|
|
|
ASSERT_HRESULT_SUCCEEDED(hr);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 10; ++i) {
|
|
|
|
|
hr = allocator->Reset();
|
|
|
|
|
ASSERT_HRESULT_SUCCEEDED(hr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(D3D12TestFixture, CommandAllocator_DifferentTypes) {
|
|
|
|
|
D3D12_COMMAND_LIST_TYPE types[] = {
|
|
|
|
|
D3D12_COMMAND_LIST_TYPE_DIRECT,
|
|
|
|
|
D3D12_COMMAND_LIST_TYPE_COMPUTE,
|
|
|
|
|
D3D12_COMMAND_LIST_TYPE_COPY
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
for (auto type : types) {
|
|
|
|
|
ComPtr<ID3D12CommandAllocator> allocator;
|
|
|
|
|
HRESULT hr = GetDevice()->CreateCommandAllocator(type, IID_PPV_ARGS(&allocator));
|
|
|
|
|
ASSERT_HRESULT_SUCCEEDED(hr);
|
|
|
|
|
}
|
2026-03-17 02:51:34 +08:00
|
|
|
}
|