test: Add RHI integration tests and update unit tests

- Add CommandQueue unit tests for WaitForIdle and synchronization
- Add SwapChain unit tests for Present and buffer operations
- Add Texture unit tests for various texture types and mipmaps
- Fix RHIIntegrationFixture with proper logging and debug output
- Update minimal integration test with RHI abstraction layer
- Add GT reference image for minimal test
- Update TEST_SPEC.md documentation
This commit is contained in:
2026-03-25 20:50:49 +08:00
parent 04a80d10e7
commit a9b9a6ebfc
12 changed files with 731 additions and 129 deletions

View File

@@ -281,7 +281,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
commandList.SetUniformMat4("gModelMatrix", modelMatrix);
commandList.SetUniformMat4("gViewMatrix", viewMatrix);
commandList.SetUniformMat4("gProjectionMatrix", projectionMatrix);
commandList.SetUniformInt("uTexture", 0);
OpenGLTexture texture;
if (!texture.LoadFromFile("Res/Image/earth.png", true)) {
@@ -332,6 +331,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
indexBuffer.Bind();
vertexArray.Bind();
commandList.SetUniformInt("uTexture", 0);
texture.Bind(0);
sampler.Bind(0);

View File

@@ -83,40 +83,3 @@ TEST_F(OpenGLTestFixture, Shader_Compile_InvalidSource) {
shader.Shutdown();
}
TEST_F(OpenGLTestFixture, Shader_SetUniforms) {
const char* vs = R"(
#version 330 core
void main() { gl_Position = vec4(0.0); }
)";
const char* fs = R"(
#version 330 core
uniform int uIntValue;
uniform float uFloatValue;
uniform vec3 uVec3Value;
uniform mat4 uMat4Value;
out vec4 FragColor;
void main() { FragColor = vec4(1.0); }
)";
OpenGLShader shader;
shader.Compile(vs, fs);
ASSERT_TRUE(shader.IsValid());
auto cmdList = static_cast<OpenGLCommandList*>(GetDevice()->CreateCommandList(CommandListDesc{}));
ASSERT_NE(cmdList, nullptr);
cmdList->SetShader(&shader);
cmdList->SetUniformInt("uIntValue", 42);
cmdList->SetUniformFloat("uFloatValue", 3.14f);
cmdList->SetUniformVec3("uVec3Value", 1.0f, 2.0f, 3.0f);
float mat[16] = {};
mat[0] = 1.0f; mat[5] = 1.0f; mat[10] = 1.0f; mat[15] = 1.0f;
cmdList->SetUniformMat4("uMat4Value", mat);
GLenum error = glGetError();
EXPECT_EQ(error, GL_NO_ERROR);
shader.Shutdown();
}