Files
XCEngine/engine/include/XCEngine/RHI/D3D12/D3D12DescriptorHeap.h
ssdfasd f427699ac6 refactor: improve test infrastructure and fix OpenGL GLAD initialization
- Rename D3D12Enum.h to D3D12Enums.h for naming consistency
- Fix OpenGL unit test GLAD initialization by using gladLoadGL()
  instead of gladLoadGLLoader(wglGetProcAddress) for fallback support
- Migrate remaining tests to use gtest_discover_tests for granular
  test discovery (math, core, containers, memory, threading, debug,
  components, scene, resources, input, opengl)
- Remove obsolete TEST_RESOURCES_DIR and copy_directory commands
  from OpenGL unit test CMakeLists (minimal/Res doesn't exist)
- Update TEST_SPEC.md with performance metrics and per-module
  build/test commands for faster development workflow
- Update CMake path references to use lowercase paths
2026-03-23 00:43:02 +08:00

51 lines
1.5 KiB
C++

#pragma once
#include <d3d12.h>
#include <wrl/client.h>
#include "../RHIEnums.h"
#include "../RHITypes.h"
#include "../RHIDescriptorPool.h"
#include "D3D12Enums.h"
using Microsoft::WRL::ComPtr;
namespace XCEngine {
namespace RHI {
class D3D12DescriptorHeap : public RHIDescriptorPool {
public:
D3D12DescriptorHeap();
~D3D12DescriptorHeap() override;
bool Initialize(ID3D12Device* device, DescriptorHeapType type, uint32_t numDescriptors, bool shaderVisible = false);
void Shutdown() override;
bool Initialize(const DescriptorPoolDesc& desc) override;
ID3D12DescriptorHeap* GetDescriptorHeap() const { return m_descriptorHeap.Get(); }
CPUDescriptorHandle GetCPUDescriptorHandle(uint32_t index);
GPUDescriptorHandle GetGPUDescriptorHandle(uint32_t index);
uint32_t GetDescriptorCount() const override;
DescriptorHeapType GetType() const override;
uint32_t GetDescriptorSize() const { return m_descriptorSize; }
D3D12_CPU_DESCRIPTOR_HANDLE GetCPUDescriptorHandleForHeapStart() const;
D3D12_GPU_DESCRIPTOR_HANDLE GetGPUDescriptorHandleForHeapStart() const;
void* GetNativeHandle() override { return m_descriptorHeap.Get(); }
static D3D12_DESCRIPTOR_HEAP_DESC CreateDesc(DescriptorHeapType type, uint32_t numDescriptors, bool shaderVisible = false);
private:
ComPtr<ID3D12DescriptorHeap> m_descriptorHeap;
DescriptorHeapType m_type;
uint32_t m_numDescriptors;
uint32_t m_descriptorSize;
bool m_shaderVisible;
};
} // namespace RHI
} // namespace XCEngine