#include "fixtures/D3D12TestFixture.h" TEST_F(D3D12TestFixture, Views_Create_RTVDescriptorHeap) { D3D12_DESCRIPTOR_HEAP_DESC heapDesc = {}; heapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_RTV; heapDesc.NumDescriptors = 1; heapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE; ComPtr 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_Create_DSVDescriptorHeap) { D3D12_DESCRIPTOR_HEAP_DESC heapDesc = {}; heapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_DSV; heapDesc.NumDescriptors = 1; heapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE; ComPtr 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_Create_CBVDescriptorHeap) { 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 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_Get_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 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); }