D3D12 Resources: - Add descriptor_handle struct with CPU/GPU handles - Add descriptor_heap class for descriptor management - Implement allocate() and free() methods - Add mutex for thread-safe access - Support all D3D12 descriptor heap types D3D12 Core: - Add device() function to expose main device - Add release() template function for COM objects Documentation: - Add changelog for descriptor heap implementation - Update D3D12 Wiki with descriptor heap section - Mark descriptor heap task as completed
49 lines
1.2 KiB
C++
49 lines
1.2 KiB
C++
#pragma once
|
|
#include "D3D12CommonHeader.h"
|
|
|
|
/**
|
|
* @brief Direct3D 12 核心类
|
|
* @details 定义了 Direct3D 12 核心功能的初始化与关闭函数
|
|
*/
|
|
namespace XEngine::graphics::d3d12::core{
|
|
/**
|
|
* @brief 初始化 Direct3D 12 核心功能
|
|
* @details 调用 DXGI 接口,确定要使用的 GPU 并创建 Direct3D 12 设备
|
|
* @return true 如果初始化成功,否则返回 false
|
|
*/
|
|
bool initialize();
|
|
/**
|
|
* @brief 关闭 Direct3D 12 核心功能
|
|
* @details 调用 Direct3D 12 设备的关闭函数,释放所有资源
|
|
*/
|
|
void shutdown();
|
|
/**
|
|
* @brief 渲染 Direct3D 12 核心功能
|
|
* @details 调用 Direct3D 12 设备的渲染函数,渲染当前渲染表面
|
|
*/
|
|
void render();
|
|
|
|
|
|
/**
|
|
* @brief 通用资源释放模板函数
|
|
* @details 用于安全释放 DirectX COM 对象,检查空指针后调用 Release 并置空
|
|
* @tparam T COM 接口类型
|
|
*/
|
|
template<typename T>
|
|
constexpr void release(T*& resource)
|
|
{
|
|
if(resource)
|
|
{
|
|
resource->Release();
|
|
resource = nullptr;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @brief 获取 Direct3D 12 设备
|
|
* @details 返回 Direct3D 12 设备的智能指针
|
|
* @return ID3D12Device* Direct3D 12 设备的智能指针
|
|
*/
|
|
ID3D12Device *const device();
|
|
|
|
}// namespace XEngine::graphics::d3d12
|