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

@@ -53,9 +53,14 @@ TEST_P(RHITestFixture, Device_CreateTexture_ReturnsValid) {
TextureDesc desc = {};
desc.width = 512;
desc.height = 512;
desc.depth = 1;
desc.mipLevels = 1;
desc.arraySize = 1;
desc.format = static_cast<uint32_t>(Format::R8G8B8A8_UNorm);
desc.textureType = static_cast<uint32_t>(TextureType::Texture2D);
desc.sampleCount = 1;
desc.sampleQuality = 0;
desc.flags = 0;
RHITexture* texture = GetDevice()->CreateTexture(desc);
ASSERT_NE(texture, nullptr);

View File

@@ -38,6 +38,8 @@ TEST_P(RHITestFixture, Texture_Create_Texture3D) {
desc.mipLevels = 1;
desc.format = static_cast<uint32_t>(Format::R16_Float);
desc.textureType = static_cast<uint32_t>(TextureType::Texture3D);
desc.sampleCount = 1;
desc.sampleQuality = 0;
RHITexture* texture = GetDevice()->CreateTexture(desc);
ASSERT_NE(texture, nullptr);
@@ -55,8 +57,14 @@ TEST_P(RHITestFixture, Texture_StateManagement) {
TextureDesc desc = {};
desc.width = 256;
desc.height = 256;
desc.depth = 1;
desc.mipLevels = 1;
desc.arraySize = 1;
desc.format = static_cast<uint32_t>(Format::R8G8B8A8_UNorm);
desc.textureType = static_cast<uint32_t>(TextureType::Texture2D);
desc.sampleCount = 1;
desc.sampleQuality = 0;
desc.flags = 0;
RHITexture* texture = GetDevice()->CreateTexture(desc);
ASSERT_NE(texture, nullptr);
@@ -73,8 +81,14 @@ TEST_P(RHITestFixture, Texture_Naming) {
TextureDesc desc = {};
desc.width = 256;
desc.height = 256;
desc.depth = 1;
desc.mipLevels = 1;
desc.arraySize = 1;
desc.format = static_cast<uint32_t>(Format::R8G8B8A8_UNorm);
desc.textureType = static_cast<uint32_t>(TextureType::Texture2D);
desc.sampleCount = 1;
desc.sampleQuality = 0;
desc.flags = 0;
RHITexture* texture = GetDevice()->CreateTexture(desc);
ASSERT_NE(texture, nullptr);
@@ -90,8 +104,14 @@ TEST_P(RHITestFixture, Texture_GetNativeHandle) {
TextureDesc desc = {};
desc.width = 256;
desc.height = 256;
desc.depth = 1;
desc.mipLevels = 1;
desc.arraySize = 1;
desc.format = static_cast<uint32_t>(Format::R8G8B8A8_UNorm);
desc.textureType = static_cast<uint32_t>(TextureType::Texture2D);
desc.sampleCount = 1;
desc.sampleQuality = 0;
desc.flags = 0;
RHITexture* texture = GetDevice()->CreateTexture(desc);
ASSERT_NE(texture, nullptr);