From 7f55a49a51a43aa72d5c055358602b0b110c0dab Mon Sep 17 00:00:00 2001 From: "coderabbitai[bot]" <136622811+coderabbitai[bot]@users.noreply.github.com> Date: Sat, 15 Nov 2025 01:23:10 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=93=9D=20Add=20docstrings=20to=20`tic?= =?UTF-8?q?k=5Fdraw`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Docstrings generation was requested by @WSQS. * https://github.com/WSQS/sdl_test/pull/27#issuecomment-3535276739 The following files were modified: * `main.cpp` --- main.cpp | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/main.cpp b/main.cpp index af710d6..a54561d 100644 --- a/main.cpp +++ b/main.cpp @@ -114,6 +114,15 @@ void main() return SDL_APP_CONTINUE; } + /** + * @brief Advance the UI frame, present interactive editors for triangle vertices and shader source, and apply edits. + * + * Presents a NodeEditor with draggable 3D position editors for each vertex and a SourceEditor with a multiline + * shader text editor. If a vertex position is modified, the vertex buffer is updated with the new vertex data. + * If the shader source is modified, the pipeline's vertex shader source is updated. + * + * @return SDL_AppResult SDL_APP_CONTINUE to indicate the application should continue running. + */ SDL_AppResult tick() { ImGui_ImplSDLGPU3_NewFrame(); @@ -151,6 +160,16 @@ void main() return SDL_APP_CONTINUE; } + /** + * @brief Render ImGui draw data and the application's triangle to the GPU, then present the swapchain texture. + * + * Prepares ImGui draw data, submits the graphics pipeline, acquires a GPU command buffer and the current + * swapchain texture, records rendering commands (including binding the pipeline and vertex buffer and issuing + * a draw call), executes ImGui rendering into the render pass, and submits the command buffer for presentation. + * If no swapchain texture is available the function still submits the command buffer and continues. + * + * @return SDL_AppResult `SDL_APP_CONTINUE` to continue the application main loop. + */ SDL_AppResult draw() { ImGui::Render(); @@ -210,14 +229,12 @@ void main() } /** - * @brief Advance the application by one frame: update UI, apply vertex edits and live shader recompilation, render, - * and submit GPU work. + * @brief Advance the application one iteration by performing per-frame updates and rendering. * - * Processes ImGui frames, uploads vertex data when edited, recompiles and replaces the vertex shader and graphics - * pipeline on shader edits, records a render pass that draws the triangle and ImGui draw lists, and submits the GPU - * command buffer for presentation. + * Performs per-frame UI and state updates; if those updates indicate continuation, executes rendering and submits + * GPU work for presentation. * - * @return `SDL_APP_CONTINUE` to continue the main loop. + * @return `SDL_APP_CONTINUE` to continue the main loop, or another `SDL_AppResult` to terminate. */ virtual SDL_AppResult iterate() override { @@ -273,4 +290,4 @@ void main() * @return sopho::App* Pointer to a heap-allocated application object; the caller takes ownership and is responsible for * deleting it. */ -sopho::App* create_app(int argc, char** argv) { return new UserApp(); } +sopho::App* create_app(int argc, char** argv) { return new UserApp(); } \ No newline at end of file From 122fd830584a4b2f26d9d5fdd0172c4d96698d5a Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Sat, 15 Nov 2025 01:23:30 +0000 Subject: [PATCH 2/2] style: format code with ClangFormat This commit fixes the style issues introduced in 7f55a49 according to the output from ClangFormat. Details: https://github.com/WSQS/sdl_test/pull/28 --- main.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index a54561d..3e70027 100644 --- a/main.cpp +++ b/main.cpp @@ -115,7 +115,8 @@ void main() } /** - * @brief Advance the UI frame, present interactive editors for triangle vertices and shader source, and apply edits. + * @brief Advance the UI frame, present interactive editors for triangle vertices and shader source, and apply + * edits. * * Presents a NodeEditor with draggable 3D position editors for each vertex and a SourceEditor with a multiline * shader text editor. If a vertex position is modified, the vertex buffer is updated with the new vertex data. @@ -290,4 +291,4 @@ void main() * @return sopho::App* Pointer to a heap-allocated application object; the caller takes ownership and is responsible for * deleting it. */ -sopho::App* create_app(int argc, char** argv) { return new UserApp(); } \ No newline at end of file +sopho::App* create_app(int argc, char** argv) { return new UserApp(); }