refactor(RHI): 完成 Shader uniform 设置迁移到 CommandList

- 删除 RHIShader 的 OpenGL 风格 SetMat4/SetVec3/SetInt 等方法
- 添加 UniformInfo 结构体和 GetUniformInfos/GetUniformInfo 接口
- D3D12Shader 和 OpenGLShader 实现 CacheUniformInfos
- RHICommandList 添加 SetUniform*/SetGlobal* 统一接口
- D3D12 实现 D3D12PipelineLayout 管理 root signature 映射
- 修复 D3D12CommandList::SetPipelineStateInternal 在 Reset 后未重新应用 root signature 的问题
- 更新 OpenGL 集成测试使用新的 SetUniform* API
- 所有单元测试和集成测试通过 (8/8 integration tests)
This commit is contained in:
2026-03-24 19:47:22 +08:00
parent 135fe9145b
commit 0f5d018c1a
21 changed files with 578 additions and 54 deletions

View File

@@ -283,10 +283,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
int viewLoc = shader.GetUniformLocation("gViewMatrix");
int projLoc = shader.GetUniformLocation("gProjectionMatrix");
Log("[DEBUG] Uniform locations - gModelMatrix: %d, gViewMatrix: %d, gProjectionMatrix: %d", modelLoc, viewLoc, projLoc);
shader.SetMat4("gModelMatrix", modelMatrix);
shader.SetMat4("gViewMatrix", viewMatrix);
shader.SetMat4("gProjectionMatrix", projectionMatrix);
shader.SetInt("uTexture", 0);
commandList.SetShader(&shader);
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)) {