diff --git a/main.cpp b/main.cpp index 8034d76..4ab014f 100644 --- a/main.cpp +++ b/main.cpp @@ -226,14 +226,14 @@ void main() } /** - * @brief Advance the application by one frame: update UI state, handle vertex edits and live shader recompilation, - * and render. + * @brief Advance the application by one frame: update UI, apply vertex edits and live shader recompilation, render, + * and submit GPU work. * - * Processes ImGui frames, applies interactive vertex edits (uploading vertex data when changed), recompiles and - * replaces the vertex shader and graphics pipeline on edits, acquires a GPU command buffer and swapchain texture, - * records a render pass that draws the triangle and ImGui draw lists, and submits the command buffer. + * 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. * - * @return SDL_AppResult SDL_APP_CONTINUE to continue the main loop. + * @return `SDL_APP_CONTINUE` to continue the main loop. */ virtual SDL_AppResult iterate() override { diff --git a/sdl_wrapper/sdl_wrapper.buffer.cpp b/sdl_wrapper/sdl_wrapper.buffer.cpp index 907cfd2..3249bb7 100644 --- a/sdl_wrapper/sdl_wrapper.buffer.cpp +++ b/sdl_wrapper/sdl_wrapper.buffer.cpp @@ -34,12 +34,11 @@ namespace sopho } /** - * @brief Uploads a block of data into the wrapped GPU vertex buffer at the specified offset. + * @brief Uploads a block of data into the wrapped GPU vertex buffer at the specified byte offset. * - * If the internal transfer (staging) buffer is smaller than `p_size`, it will be reallocated - * to accommodate the upload. The function copies `p_size` bytes from `p_data` into the transfer - * buffer and enqueues a GPU copy pass that transfers those bytes into the vertex buffer at - * `p_offset`. + * If the internal staging transfer buffer is smaller than p_size it is reallocated to fit. + * Copies p_size bytes from p_data into the transfer buffer and enqueues a GPU copy pass to transfer them into the + * vertex buffer at p_offset. * * @param p_data Pointer to the source data to upload. * @param p_size Size in bytes of the data to upload. diff --git a/sdl_wrapper/sdl_wrapper.pipeline.cpp b/sdl_wrapper/sdl_wrapper.pipeline.cpp index 5f981f5..5136955 100644 --- a/sdl_wrapper/sdl_wrapper.pipeline.cpp +++ b/sdl_wrapper/sdl_wrapper.pipeline.cpp @@ -9,7 +9,20 @@ import :pipeline; namespace sopho { + /** + * @brief Initializes the PipelineWrapper with the given GPU device wrapper. + * + * @param p_device Shared pointer to a GpuWrapper representing the target GPU device; the wrapper retains this + * reference for its lifetime. + */ PipelineWrapper::PipelineWrapper(std::shared_ptr p_device) : m_device(p_device) {} + /** + * @brief Releases any GPU graphics pipeline owned by this wrapper. + * + * If a graphics pipeline is currently held, it is released using the associated + * device and the stored pipeline handle is cleared so the wrapper no longer + * references the pipeline. + */ PipelineWrapper::~PipelineWrapper() { if (m_graphics_pipeline) @@ -18,6 +31,14 @@ namespace sopho m_graphics_pipeline = nullptr; } } + /** + * @brief Rebuilds the GPU graphics pipeline when the wrapper is marked modified. + * + * If the wrapper's modified flag is set, this clears the flag, attempts to create a new + * graphics pipeline from the stored pipeline info and device, and on success replaces the + * current pipeline (releasing the previous pipeline first). If creation fails, an error + * is logged. + */ auto PipelineWrapper::submit() { if (modified)