Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
9 changes: 4 additions & 5 deletions sdl_wrapper/sdl_wrapper.buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
21 changes: 21 additions & 0 deletions sdl_wrapper/sdl_wrapper.pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<GpuWrapper> 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)
Expand All @@ -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)
Expand Down
Loading