From 93139813aa4b1722314039b9c43c428fe3775f7a Mon Sep 17 00:00:00 2001 From: ssdfasd <2156608475@qq.com> Date: Fri, 20 Mar 2026 20:07:24 +0800 Subject: [PATCH] OpenGL: Use OpenGLCommandList instead of raw GL in minimal test - Replace glViewport() with commandList.SetViewport() - Replace glClearColor()+glClear() with commandList.Clear() - Add OpenGLCommandList include and instance --- tests/RHI/OpenGL/integration/minimal/main.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/RHI/OpenGL/integration/minimal/main.cpp b/tests/RHI/OpenGL/integration/minimal/main.cpp index 571c89e0..cca38e5f 100644 --- a/tests/RHI/OpenGL/integration/minimal/main.cpp +++ b/tests/RHI/OpenGL/integration/minimal/main.cpp @@ -8,6 +8,7 @@ #include "XCEngine/RHI/OpenGL/OpenGLDevice.h" #include "XCEngine/RHI/OpenGL/OpenGLSwapChain.h" +#include "XCEngine/RHI/OpenGL/OpenGLCommandList.h" #include "XCEngine/Debug/Logger.h" #include "XCEngine/Debug/ConsoleLogSink.h" #include "XCEngine/Containers/String.h" @@ -135,6 +136,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine OpenGLSwapChain swapChain; swapChain.Initialize(hwnd, gWidth, gHeight); + // Create command list for rendering commands + OpenGLCommandList commandList; + // Main render loop MSG msg = {}; int frameCount = 0; @@ -148,10 +152,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine TranslateMessage(&msg); DispatchMessageW(&msg); } else { - // Set viewport and clear color for each frame - glViewport(0, 0, gWidth, gHeight); - glClearColor(1.0f, 0.0f, 0.0f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + // Set viewport and clear color using encapsulated command list + commandList.SetViewport(0, 0, gWidth, gHeight); + commandList.Clear(1.0f, 0.0f, 0.0f, 1.0f, 1 | 2); // Present the rendered frame swapChain.Present(0, 0);