- 实现 D3D12Device::CreateCommandQueue/CreateCommandList/CreateSwapChain - 修复 Buffer::Map 对 DEFAULT heap 的问题 (Vertex/Index 使用 UPLOAD heap) - 修复 Fence::IsSignaled() 初始值问题 - 修复 Sampler::GetNativeHandle() 返回值 - 修复 RHICapabilities 和 RHIDeviceInfo 初始化 - 修复 Shader 测试 (空 ShaderCompileDesc 预期) - 修复 RHITestFixture 创建窗口句柄 - 重命名 opengl_engine_tests -> rhi_opengl_tests - 添加 tests/RHI/unit/ 到构建系统 测试结果: 22 passed -> 59 passed
50 lines
1.2 KiB
C++
50 lines
1.2 KiB
C++
#include "RHITestFixture.h"
|
|
#include <cstdlib>
|
|
#include <iostream>
|
|
#include <windows.h>
|
|
|
|
namespace XCEngine {
|
|
namespace RHI {
|
|
|
|
RHIType RHITestFixture::mBackendType = RHIType::D3D12;
|
|
|
|
void RHITestFixture::SetUpTestSuite() {
|
|
}
|
|
|
|
void RHITestFixture::TearDownTestSuite() {
|
|
}
|
|
|
|
void RHITestFixture::SetUp() {
|
|
mDevice = RHIFactory::CreateRHIDevice(mBackendType);
|
|
ASSERT_NE(mDevice, nullptr);
|
|
|
|
WNDCLASSEXW wc = {};
|
|
wc.cbSize = sizeof(WNDCLASSEXW);
|
|
wc.lpfnWndProc = DefWindowProcW;
|
|
wc.hInstance = GetModuleHandle(nullptr);
|
|
wc.lpszClassName = L"RHIUnitTestClass";
|
|
RegisterClassExW(&wc);
|
|
|
|
HWND hwnd = CreateWindowExW(0, L"RHIUnitTestClass", L"RHIUnitTest", WS_OVERLAPPEDWINDOW,
|
|
CW_USEDEFAULT, CW_USEDEFAULT, 800, 600, nullptr, nullptr, GetModuleHandle(nullptr), nullptr);
|
|
|
|
RHIDeviceDesc desc = {};
|
|
desc.enableDebugLayer = true;
|
|
desc.appName = L"RHIUnitTest";
|
|
desc.windowHandle = hwnd;
|
|
|
|
bool initResult = mDevice->Initialize(desc);
|
|
ASSERT_TRUE(initResult);
|
|
}
|
|
|
|
void RHITestFixture::TearDown() {
|
|
if (mDevice != nullptr) {
|
|
mDevice->Shutdown();
|
|
delete mDevice;
|
|
mDevice = nullptr;
|
|
}
|
|
}
|
|
|
|
} // namespace RHI
|
|
} // namespace XCEngine
|