2026-03-17 02:51:34 +08:00
|
|
|
#include "fixtures/D3D12TestFixture.h"
|
|
|
|
|
|
2026-03-20 03:18:30 +08:00
|
|
|
TEST_F(D3D12TestFixture, DescriptorHeap_Create_CBV_SRV_UAV) {
|
Add Phase 4 tests for DescriptorHeap, Shader, RootSignature, PipelineState, Views
- DescriptorHeap: CBV_SRV_UAV, Sampler, RTV, DSV, HandleIncrementSize
- Shader: Vertex/Pixel/Compute profiles
- RootSignature: Empty, with CBV parameter
- PipelineState: Graphics/Compute pipeline desc defaults
- Views: RTV, DSV, CBV descriptor heaps, handle increment
- All 54 tests pass
2026-03-17 04:04:57 +08:00
|
|
|
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<ID3D12DescriptorHeap> 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);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-20 03:18:30 +08:00
|
|
|
TEST_F(D3D12TestFixture, DescriptorHeap_Create_Sampler) {
|
Add Phase 4 tests for DescriptorHeap, Shader, RootSignature, PipelineState, Views
- DescriptorHeap: CBV_SRV_UAV, Sampler, RTV, DSV, HandleIncrementSize
- Shader: Vertex/Pixel/Compute profiles
- RootSignature: Empty, with CBV parameter
- PipelineState: Graphics/Compute pipeline desc defaults
- Views: RTV, DSV, CBV descriptor heaps, handle increment
- All 54 tests pass
2026-03-17 04:04:57 +08:00
|
|
|
D3D12_DESCRIPTOR_HEAP_DESC heapDesc = {};
|
|
|
|
|
heapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER;
|
|
|
|
|
heapDesc.NumDescriptors = 5;
|
|
|
|
|
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_DESCRIPTOR_HEAP_DESC desc = descriptorHeap->GetDesc();
|
|
|
|
|
EXPECT_EQ(desc.Type, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-20 03:18:30 +08:00
|
|
|
TEST_F(D3D12TestFixture, DescriptorHeap_Create_RTV) {
|
Add Phase 4 tests for DescriptorHeap, Shader, RootSignature, PipelineState, Views
- DescriptorHeap: CBV_SRV_UAV, Sampler, RTV, DSV, HandleIncrementSize
- Shader: Vertex/Pixel/Compute profiles
- RootSignature: Empty, with CBV parameter
- PipelineState: Graphics/Compute pipeline desc defaults
- Views: RTV, DSV, CBV descriptor heaps, handle increment
- All 54 tests pass
2026-03-17 04:04:57 +08:00
|
|
|
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_DESCRIPTOR_HEAP_DESC desc = descriptorHeap->GetDesc();
|
|
|
|
|
EXPECT_EQ(desc.Type, D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-20 03:18:30 +08:00
|
|
|
TEST_F(D3D12TestFixture, DescriptorHeap_Create_DSV) {
|
Add Phase 4 tests for DescriptorHeap, Shader, RootSignature, PipelineState, Views
- DescriptorHeap: CBV_SRV_UAV, Sampler, RTV, DSV, HandleIncrementSize
- Shader: Vertex/Pixel/Compute profiles
- RootSignature: Empty, with CBV parameter
- PipelineState: Graphics/Compute pipeline desc defaults
- Views: RTV, DSV, CBV descriptor heaps, handle increment
- All 54 tests pass
2026-03-17 04:04:57 +08:00
|
|
|
D3D12_DESCRIPTOR_HEAP_DESC heapDesc = {};
|
|
|
|
|
heapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_DSV;
|
|
|
|
|
heapDesc.NumDescriptors = 2;
|
|
|
|
|
heapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_NONE;
|
|
|
|
|
|
|
|
|
|
ComPtr<ID3D12DescriptorHeap> 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);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-20 03:18:30 +08:00
|
|
|
TEST_F(D3D12TestFixture, DescriptorHeap_Get_HandleIncrementSize) {
|
Add Phase 4 tests for DescriptorHeap, Shader, RootSignature, PipelineState, Views
- DescriptorHeap: CBV_SRV_UAV, Sampler, RTV, DSV, HandleIncrementSize
- Shader: Vertex/Pixel/Compute profiles
- RootSignature: Empty, with CBV parameter
- PipelineState: Graphics/Compute pipeline desc defaults
- Views: RTV, DSV, CBV descriptor heaps, handle increment
- All 54 tests pass
2026-03-17 04:04:57 +08:00
|
|
|
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);
|
2026-03-17 02:51:34 +08:00
|
|
|
}
|