Fix RHI format conversion and add debug logging for D3D12 tests

This commit is contained in:
2026-03-25 17:30:16 +08:00
parent 9c082c72fa
commit 295459067f
10 changed files with 146 additions and 5 deletions

View File

@@ -44,7 +44,50 @@ void RHITestFixture::SetUp() {
ASSERT_TRUE(initResult);
}
void RHITestFixture::WaitForGPU() {
if (mDevice == nullptr) {
return;
}
if (GetParam() == RHIType::D3D12) {
auto* device = static_cast<D3D12Device*>(mDevice);
CommandQueueDesc queueDesc = {};
queueDesc.queueType = static_cast<uint32_t>(CommandQueueType::Direct);
queueDesc.priority = 0;
queueDesc.nodeMask = 0;
queueDesc.flags = 0;
auto* commandQueue = device->CreateCommandQueue(queueDesc);
if (commandQueue) {
FenceDesc fenceDesc = {};
fenceDesc.initialValue = 0;
fenceDesc.flags = 0;
auto* fence = mDevice->CreateFence(fenceDesc);
if (fence) {
commandQueue->Signal(fence, 1);
fence->Wait(1);
for (int i = 0; i < 100; i++) {
if (fence->GetCompletedValue() >= 1) {
break;
}
Sleep(10);
}
fence->Shutdown();
delete fence;
}
commandQueue->Shutdown();
delete commandQueue;
}
Sleep(100);
}
}
void RHITestFixture::TearDown() {
WaitForGPU();
if (mDevice != nullptr) {
mDevice->Shutdown();
delete mDevice;