Fix RHI unit test failures and OpenGL backend issues

- Fix D3D12Texture::GetTextureType() to return correct type based on D3D12 resource dimension
- Fix OpenGL CommandQueue::Signal() to properly call fence->Signal()
- Fix OpenGL CommandQueue::GetTimestampFrequency() using GL_TIMESTAMP
- Fix OpenGL Device::GetNativeDevice() to return m_hglrc
- Fix OpenGL Fence::Signal() to create GL sync object and update completedValue
- Fix OpenGL Fence::Wait() to properly wait for fence
- Fix OpenGL Fence::GetNativeHandle() to create sync on first call
- Fix OpenGL SwapChain::GetCurrentBackBuffer() to return backbuffer texture
- Fix OpenGL SwapChain::Initialize() to create backbuffer texture
- Fix OpenGL SwapChain::Shutdown() to cleanup backbuffer texture
- Fix RHI unit tests: add missing sampleCount/sampleQuality/depth/arraySize fields
- Fix RHI unit tests: add complete TextureDesc fields where needed
This commit is contained in:
2026-03-23 21:09:15 +08:00
parent bc6b47ffcf
commit 0fa4f2e3a8
10 changed files with 86 additions and 21 deletions

View File

@@ -1,4 +1,6 @@
#include "XCEngine/RHI/OpenGL/OpenGLCommandQueue.h"
#include "XCEngine/RHI/RHIFence.h"
#include <glad/glad.h>
namespace XCEngine {
namespace RHI {
@@ -17,6 +19,10 @@ void OpenGLCommandQueue::ExecuteCommandLists(uint32_t count, void** lists) {
}
void OpenGLCommandQueue::Signal(RHIFence* fence, uint64_t value) {
if (fence) {
fence->Signal(value);
}
glFlush();
}
void OpenGLCommandQueue::Wait(RHIFence* fence, uint64_t value) {
@@ -27,6 +33,13 @@ uint64_t OpenGLCommandQueue::GetCompletedValue() {
}
void OpenGLCommandQueue::WaitForIdle() {
glFinish();
}
uint64_t OpenGLCommandQueue::GetTimestampFrequency() const {
GLint64 frequency = 0;
glGetInteger64v(GL_TIMESTAMP, &frequency);
return frequency > 0 ? static_cast<uint64_t>(frequency) : 1000000000;
}
} // namespace RHI