#include "fixtures/D3D12TestFixture.h" TEST_F(D3D12TestFixture, DescriptorHeap_Create_CBV_SRV_UAV) { D3D12_DESCRIPTOR_HEAP_DESC heapDesc = {}; heapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV; heapDesc.NumDescriptors = 10; heapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE; ComPtr descriptorHeap; HRESULT hr = GetDevice()->CreateDescriptorHeap(&heapDesc, IID_PPV_ARGS(&descriptorHeap)); ASSERT_HRESULT_SUCCEEDED(hr); ASSERT_NE(descriptorHeap.Get(), nullptr); D3D12_DESCRIPTOR_HEAP_DESC desc = descriptorHeap->GetDesc(); EXPECT_EQ(desc.Type, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); EXPECT_EQ(desc.NumDescriptors, 10); } TEST_F(D3D12TestFixture, DescriptorHeap_Create_Sampler) { D3D12_DESCRIPTOR_HEAP_DESC heapDesc = {}; heapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER; heapDesc.NumDescriptors = 5; heapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE; ComPtr descriptorHeap; HRESULT hr = GetDevice()->CreateDescriptorHeap(&heapDesc, IID_PPV_ARGS(&descriptorHeap)); ASSERT_HRESULT_SUCCEEDED(hr); D3D12_DESCRIPTOR_HEAP_DESC desc = descriptorHeap->GetDesc(); EXPECT_EQ(desc.Type, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER); } TEST_F(D3D12TestFixture, DescriptorHeap_Create_RTV) { D3D12_DESCRIPTOR_HEAP_DESC heapDesc = {}; heapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV; heapDesc.NumDescriptors = 4; heapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE; ComPtr descriptorHeap; HRESULT hr = GetDevice()->CreateDescriptorHeap(&heapDesc, IID_PPV_ARGS(&descriptorHeap)); ASSERT_HRESULT_SUCCEEDED(hr); D3D12_DESCRIPTOR_HEAP_DESC desc = descriptorHeap->GetDesc(); EXPECT_EQ(desc.Type, D3D12_DESCRIPTOR_HEAP_TYPE_RTV); } TEST_F(D3D12TestFixture, DescriptorHeap_Create_DSV) { D3D12_DESCRIPTOR_HEAP_DESC heapDesc = {}; heapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_DSV; heapDesc.NumDescriptors = 2; heapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE; ComPtr descriptorHeap; HRESULT hr = GetDevice()->CreateDescriptorHeap(&heapDesc, IID_PPV_ARGS(&descriptorHeap)); ASSERT_HRESULT_SUCCEEDED(hr); D3D12_DESCRIPTOR_HEAP_DESC desc = descriptorHeap->GetDesc(); EXPECT_EQ(desc.Type, D3D12_DESCRIPTOR_HEAP_TYPE_DSV); } TEST_F(D3D12TestFixture, DescriptorHeap_Get_HandleIncrementSize) { UINT cbvSrvUavSize = GetDevice()->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); UINT samplerSize = GetDevice()->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER); UINT rtvSize = GetDevice()->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV); UINT dsvSize = GetDevice()->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_DSV); EXPECT_GT(cbvSrvUavSize, 0); EXPECT_GT(samplerSize, 0); EXPECT_GT(rtvSize, 0); EXPECT_GT(dsvSize, 0); }