- Move test_*.cpp and fixtures/ to tests/RHI/D3D12/unit/ - Create unit/CMakeLists.txt with proper test configuration - Simplify parent CMakeLists.txt to use add_subdirectory - Integration tests remain in integration/ folder
67 lines
2.5 KiB
C++
67 lines
2.5 KiB
C++
#include "fixtures/D3D12TestFixture.h"
|
|
|
|
TEST_F(D3D12TestFixture, Views_Placeholder) {
|
|
ASSERT_NE(GetDevice(), nullptr);
|
|
}
|
|
|
|
TEST_F(D3D12TestFixture, Views_CreateRTVDescriptorHeap) {
|
|
D3D12_DESCRIPTOR_HEAP_DESC heapDesc = {};
|
|
heapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV;
|
|
heapDesc.NumDescriptors = 1;
|
|
heapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE;
|
|
|
|
ComPtr<ID3D12DescriptorHeap> descriptorHeap;
|
|
HRESULT hr = GetDevice()->CreateDescriptorHeap(&heapDesc, IID_PPV_ARGS(&descriptorHeap));
|
|
ASSERT_HRESULT_SUCCEEDED(hr);
|
|
|
|
D3D12_CPU_DESCRIPTOR_HANDLE handle = descriptorHeap->GetCPUDescriptorHandleForHeapStart();
|
|
EXPECT_NE(handle.ptr, 0);
|
|
}
|
|
|
|
TEST_F(D3D12TestFixture, Views_CreateDSVDescriptorHeap) {
|
|
D3D12_DESCRIPTOR_HEAP_DESC heapDesc = {};
|
|
heapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_DSV;
|
|
heapDesc.NumDescriptors = 1;
|
|
heapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE;
|
|
|
|
ComPtr<ID3D12DescriptorHeap> descriptorHeap;
|
|
HRESULT hr = GetDevice()->CreateDescriptorHeap(&heapDesc, IID_PPV_ARGS(&descriptorHeap));
|
|
ASSERT_HRESULT_SUCCEEDED(hr);
|
|
|
|
D3D12_CPU_DESCRIPTOR_HANDLE handle = descriptorHeap->GetCPUDescriptorHandleForHeapStart();
|
|
EXPECT_NE(handle.ptr, 0);
|
|
}
|
|
|
|
TEST_F(D3D12TestFixture, Views_CreateCBVDescriptorHeap) {
|
|
D3D12_DESCRIPTOR_HEAP_DESC heapDesc = {};
|
|
heapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV;
|
|
heapDesc.NumDescriptors = 1;
|
|
heapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE;
|
|
|
|
ComPtr<ID3D12DescriptorHeap> descriptorHeap;
|
|
HRESULT hr = GetDevice()->CreateDescriptorHeap(&heapDesc, IID_PPV_ARGS(&descriptorHeap));
|
|
ASSERT_HRESULT_SUCCEEDED(hr);
|
|
|
|
D3D12_CPU_DESCRIPTOR_HANDLE handle = descriptorHeap->GetCPUDescriptorHandleForHeapStart();
|
|
EXPECT_NE(handle.ptr, 0);
|
|
}
|
|
|
|
TEST_F(D3D12TestFixture, Views_RTVDescriptorHandleIncrement) {
|
|
UINT rtvSize = GetDevice()->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
|
|
|
|
D3D12_DESCRIPTOR_HEAP_DESC heapDesc = {};
|
|
heapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV;
|
|
heapDesc.NumDescriptors = 4;
|
|
heapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE;
|
|
|
|
ComPtr<ID3D12DescriptorHeap> descriptorHeap;
|
|
HRESULT hr = GetDevice()->CreateDescriptorHeap(&heapDesc, IID_PPV_ARGS(&descriptorHeap));
|
|
ASSERT_HRESULT_SUCCEEDED(hr);
|
|
|
|
D3D12_CPU_DESCRIPTOR_HANDLE handle1 = descriptorHeap->GetCPUDescriptorHandleForHeapStart();
|
|
D3D12_CPU_DESCRIPTOR_HANDLE handle2 = handle1;
|
|
handle2.ptr += rtvSize;
|
|
|
|
EXPECT_NE(handle1.ptr, handle2.ptr);
|
|
}
|