D3D12 Core: - Add d3d12_command class for command queue management - Support Direct/Compute/Copy command queue types - Implement multi-frame buffering (frame_buffer_count=3) - Add begin_frame/end_frame rendering cycle - Add NAME_D3D12_OBJECT_INDEXED macro Platform Interface: - Add render function pointer to platform_interface - Implement render() in Renderer Documentation: - Add changelog for command queue implementation - Update D3D12 Wiki with multi-frame buffering section - Mark command queue task as completed
62 lines
1.2 KiB
C++
62 lines
1.2 KiB
C++
#include "Renderer.h"
|
|
#include "GraphicsPlatformInterface.h"
|
|
#include "Direct3D12/D3D12Interface.h"
|
|
|
|
namespace XEngine::graphics {
|
|
namespace {
|
|
platform_interface gfx{};
|
|
|
|
/**
|
|
* @brief 设置图形渲染平台的接口
|
|
* @details 根据指定的平台类型,调用对应的初始化与关闭函数指针
|
|
* @param platform 图形渲染平台类型
|
|
* @return true 如果初始化成功,否则返回 false
|
|
*/
|
|
bool
|
|
set_platform_interface(graphics_platform platform)
|
|
{
|
|
switch (platform)
|
|
{
|
|
case graphics_platform::direct3d12:
|
|
d3d12::get_platform_interface(gfx);
|
|
break;
|
|
case graphics_platform::vulkan:
|
|
//vulkan::get_platform_interface(gfx);
|
|
break;
|
|
case graphics_platform::opengl:
|
|
//opengl::get_platform_interface(gfx);
|
|
break;
|
|
default:
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
}// anonymous namespace
|
|
|
|
/**
|
|
* @brief 初始化图形渲染平台
|
|
* @details 调用设置平台接口函数,初始化指定的图形渲染平台
|
|
* @param platform 图形渲染平台类型
|
|
* @return true 如果初始化成功,否则返回 false
|
|
*/
|
|
bool
|
|
initialize(graphics_platform platform)
|
|
{
|
|
return set_platform_interface(platform) && gfx.initialize();
|
|
}
|
|
|
|
void
|
|
shutdown()
|
|
{
|
|
gfx.shutdown();
|
|
}
|
|
|
|
void
|
|
render()
|
|
{
|
|
gfx.render();
|
|
}
|
|
|
|
|
|
}// namespace XEngine::graphics
|