Skip to content

chore: update docstring#53

Merged
K1ngst0m merged 1 commit intomainfrom
dev/update-docstring
Jan 15, 2026
Merged

chore: update docstring#53
K1ngst0m merged 1 commit intomainfrom
dev/update-docstring

Conversation

@K1ngst0m
Copy link
Copy Markdown
Collaborator

@K1ngst0m K1ngst0m commented Jan 15, 2026

PR Type

Documentation


Description

  • Adds comprehensive Doxygen docstrings to public API declarations

  • Converts informal comments to structured @brief, @param, @return format

  • Improves code clarity for library users and IDE documentation

  • Updates project policies to formalize docstring standards


Diagram Walkthrough

flowchart LR
  A["Public API Declarations"] -->|Add @brief| B["Doxygen Docstrings"]
  A -->|Add @param/@return| B
  C["Project Policies"] -->|Formalize C.8| D["Docstring Standards"]
  B --> E["IDE Documentation"]
  B --> F["Generated API Docs"]
Loading

File Walkthrough

Relevant files
Documentation
37 files
capture_protocol.hpp
Add docstrings to protocol structs and constants                 
+8/-0     
capture_receiver.hpp
Document receiver class and public methods                             
+19/-0   
compositor_capture.hpp
Add docstring and delete specifiers to stub class               
+9/-3     
ipc_socket.hpp
Document socket client class and methods                                 
+22/-0   
vk_capture.hpp
Document capture manager and related structs                         
+19/-0   
vk_dispatch.hpp
Document dispatch table structs and tracker class               
+18/-0   
vk_hooks.hpp
Document all Vulkan layer hook entry points                           
+20/-0   
wsi_virtual.hpp
Document WSI virtualization classes and methods                   
+16/-0   
compositor_server.hpp
Document compositor server class and input methods             
+26/-0   
input_forwarder.hpp
Document input forwarder class and methods                             
+19/-0   
vulkan_backend.hpp
Document renderer class and public methods                             
+16/-0   
vulkan_debug.hpp
Document debug messenger class                                                     
+5/-0     
vulkan_error.hpp
Improve VK_TRY macro documentation                                             
+3/-3     
filter_chain.hpp
Document filter chain class and structs                                   
+15/-0   
filter_pass.hpp
Document filter pass class and config                                       
+9/-0     
frame_history.hpp
Document frame history class methods                                         
+6/-1     
framebuffer.hpp
Document framebuffer class methods                                             
+5/-0     
output_pass.hpp
Document output pass class                                                             
+6/-0     
pass.hpp
Document pass interface and viewport calculation                 
+6/-0     
preset_parser.hpp
Document preset parser and config structs                               
+8/-3     
semantic_binder.hpp
Document semantic binding structs and methods                       
+10/-20 
retroarch_preprocessor.hpp
Document shader preprocessor class                                             
+6/-0     
shader_runtime.hpp
Document shader runtime class                                                       
+9/-1     
slang_reflect.hpp
Document reflection structs and functions                               
+14/-11 
texture_loader.hpp
Document texture loader class                                                       
+8/-0     
imgui_layer.hpp
Document ImGui layer class and methods                                     
+29/-0   
config.hpp
Document config structs and functions                                       
+10/-0   
error.hpp
Document error types and macros                                                   
+12/-3   
job_system.hpp
Document job system class methods                                               
+11/-0   
logging.hpp
Document logging initialization functions                               
+7/-0     
paths.hpp
Convert block comments to docstrings                                         
+41/-77 
profiling.hpp
Document profiling macros                                                               
+3/-10   
queues.hpp
Document SPSC queue class and methods                                       
+17/-0   
serializer.hpp
Document binary reader/writer classes                                       
+20/-1   
unique_fd.hpp
Document file descriptor wrapper class                                     
+9/-0     
util.hpp
Replace stub with umbrella header docstring                           
+4/-6     
project_policies.md
Add section C.8 formalizing docstring standards                   
+11/-1   

Summary by CodeRabbit

  • New Features

    • Added input forwarding for keyboard and mouse injection.
    • Introduced shader preset management with parameter controls and support for RetroParch format.
    • Added rendering scale modes: stretch, integer, and dynamic.
    • Launched interactive UI overlay for shader and preset management.
    • Implemented frame capture and IPC protocol for streaming.
  • Improvements

    • Enhanced error handling with source location tracking.
    • Expanded configuration system with path and logging options.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jan 15, 2026

📝 Walkthrough

Walkthrough

This change introduces comprehensive new public APIs across the codebase's major subsystems: capture protocol and IPC layer interfaces, Vulkan dispatch/hooks for WSI and swapchain management, input and UI frameworks, rendering pipeline infrastructure (shader compilation, texture loading, filter chains), and configuration/utility foundations. Predominantly header-only additions establishing public API surfaces for a major architectural refactor.

Changes

Cohort / File(s) Summary
Documentation & Policy
docs/project_policies.md
Added C.8 Docstrings (Public API) policy block detailing conventions for API documentation using Doxygen-style comments; updated last modified date
Capture Protocol & IPC
src/capture/capture_protocol.hpp, src/capture/capture_receiver.hpp, src/capture/vk_layer/ipc_socket.hpp
Introduced IPC protocol surface with message types, frame/control/semaphore structs; expanded CaptureReceiver with factory create(), poll_frame(), resolution control, and synchronization semaphore accessors; added LayerSocketClient with connect/disconnect, send_texture/semaphores, poll_control methods
Capture Vulkan Layer
src/capture/vk_layer/vk_capture.hpp, src/capture/vk_layer/vk_dispatch.hpp, src/capture/vk_layer/vk_hooks.hpp
Added CaptureManager coordinating swapchain/device lifecycle and async frame capture; expanded VkInstFuncs/VkDeviceFuncs with 30+ Vulkan entry points; introduced VkInstData/VkDeviceData structs and ObjectTracker for instance/device management; added 20+ Vulkan hook entry points for instance/device/surface/swapchain/present operations
WSI Virtualization
src/capture/vk_layer/wsi_virtual.hpp, src/capture/compositor/compositor_capture.hpp
Introduced WsiVirtualizer class with surface/swapchain lifecycle, capability queries, and frame data accessors; added VirtualSurface/VirtualSwapchain/SwapchainFrameData structs; exposed CompositorCapture with explicit default constructor/destructor and deleted copy/move semantics
Input Subsystem
src/input/compositor_server.hpp, src/input/input_forwarder.hpp
Added InputEvent struct and expanded CompositorServer with start()/stop(), display accessors, and key/pointer injection methods; added InputForwarder factory create() and SDL event forwarding methods (forward_key, forward_mouse_*)
Rendering Pipeline: Shader & Texture
src/render/shader/retroarch_preprocessor.hpp, src/render/shader/shader_runtime.hpp, src/render/shader/slang_reflect.hpp, src/render/texture/texture_loader.hpp
Introduced RetroArchPreprocessor for shader preprocessing; added ShaderRuntime with static factory, compile_shader/compile_retroarch_shader, and cache management; added CompiledShader/RetroArchCompiledShader/ShaderMetadata structs; expanded UniformBufferLayout with total_size and stage_flags; introduced TextureLoader with load_from_file factory
Rendering Pipeline: Filter Chain
src/render/chain/filter_chain.hpp, src/render/chain/filter_pass.hpp, src/render/chain/frame_history.hpp, src/render/chain/framebuffer.hpp, src/render/chain/output_pass.hpp, src/render/chain/pass.hpp, src/render/chain/preset_parser.hpp
Added FilterChain factory with load_preset, record, handle_resize, parameter management; expanded FilterPass with lifecycle/recording and UBO methods; introduced FilterPassConfig, OutputPassConfig, PresetParser for RetroArch preset loading; added FrameHistory push/get/shutdown and Framebuffer resize/shutdown; introduced VulkanContext/PassContext/ScaledViewport and calculate_viewport
Rendering Pipeline: Semantics & Backend
src/render/chain/semantic_binder.hpp, src/render/backend/vulkan_backend.hpp, src/render/backend/vulkan_debug.hpp, src/render/backend/vulkan_error.hpp
Added final_viewport_size semantic and SizeVec4 inverse fields; expanded SemanticBinder with alias size management; introduced RenderSettings and expanded VulkanBackend with render_frame/render_clear/handle_resize, shader preset management, sync semaphore import/cleanup; added VulkanDebugMessenger with static factory and validation layer check
UI Framework
src/ui/imgui_layer.hpp
Introduced ImGuiLayer with static factory create(), lifecycle methods (begin_frame, end_frame, record), preset/parameter management, callbacks, and state accessors; added PresetTreeNode, ImGuiConfig, ParameterState, ShaderControlState structs
Configuration & Core Utilities
src/util/config.hpp, src/util/error.hpp, src/util/paths.hpp, src/util/logging.hpp
Expanded ScaleMode enum with stretch/integer/dynamic; added Config nested groups (Paths, Capture, Input, Shader, Render, Logging) and load_config/default_config factories; extended ErrorCode with 20+ domain-specific codes; added source_location tracking to Error; introduced Result/ResultPtr type aliases and helper factories; added AppDirs/PathOverrides with data_dir/cache_dir; added initialize_logger, get_logger, set_log_level, set_log_timestamp_enabled
Core Utilities: Concurrency & Serialization
src/util/job_system.hpp, src/util/serializer.hpp, src/util/unique_fd.hpp, src/util/queues.hpp, src/util/profiling.hpp, src/util/util.hpp
Added JobSystem static API (initialize, submit, shutdown, wait_all, thread_count); introduced BinaryWriter::write_str/write_vec and BinaryReader::read_str/read_vec; added UniqueFd dup_from, dup, get, release, valid accessors; enhanced SPSCQueue with capacity validation and documented methods; simplified util.hpp header

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~90 minutes

Possibly related PRs

Suggested labels

api-surface, capture, rendering, shader-system, wsi-virtualization, refactoring

Poem

🐰 New APIs bloom like carrots in spring,
Capture, render, and input flow,
Through protocols, shaders, and WSI things—
A grand refactor puts on quite a show!
Hop forward, brave reviewers bold,
These headers now the future hold. 🌟

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title 'chore: update docstring' is contradicted by the actual changes. The changeset includes substantial public API additions across 20+ files, extensive new structures, classes, and methods. The title only references updating docstrings, which is a minor documentation aspect, not the main focus of these architectural changes. Revise the title to accurately reflect the main changes, such as 'feat: add comprehensive public API surface for capture, rendering, input, and utilities' or a more specific descriptor of the primary architectural additions.
Docstring Coverage ⚠️ Warning Docstring coverage is 34.55% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@qodo-code-review
Copy link
Copy Markdown

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-code-review
Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/render/chain/semantic_binder.hpp (1)

33-40: Guard against zero dimensions to prevent infinity values.

If width or height is 0, the inverse calculations produce inf, which can cause undefined shader behavior or rendering artifacts.

🔧 Suggested fix
 [[nodiscard]] inline auto make_size_vec4(uint32_t width, uint32_t height) -> SizeVec4 {
+    // Clamp to at least 1 to avoid division by zero producing inf
+    const auto w = std::max(width, 1U);
+    const auto h = std::max(height, 1U);
     return {
-        .width = static_cast<float>(width),
-        .height = static_cast<float>(height),
-        .inv_width = 1.0F / static_cast<float>(width),
-        .inv_height = 1.0F / static_cast<float>(height),
+        .width = static_cast<float>(w),
+        .height = static_cast<float>(h),
+        .inv_width = 1.0F / static_cast<float>(w),
+        .inv_height = 1.0F / static_cast<float>(h),
     };
 }

Alternatively, add an assertion (assert(width > 0 && height > 0)) if zero-size is a programming error that should never occur.

src/capture/capture_protocol.hpp (1)

71-81: Missing static_assert for CaptureFrameMetadata.

All other IPC message structs have a static_assert to verify their size for wire format stability. CaptureFrameMetadata appears to be missing one, which could lead to undetected ABI mismatches if the struct layout changes.

Suggested fix
 struct CaptureFrameMetadata {
     CaptureMessageType type = CaptureMessageType::frame_metadata;
     uint32_t width = 0;
     uint32_t height = 0;
     VkFormat format = VK_FORMAT_UNDEFINED;
     uint32_t stride = 0;
     uint32_t offset = 0;
     uint64_t modifier = 0;
     uint64_t frame_number = 0;
 };
+
+static_assert(sizeof(CaptureFrameMetadata) == 40);
🧹 Nitpick comments (10)
src/input/compositor_server.hpp (1)

13-21: Consider using std::variant or documenting field validity per event type.

The InputEvent struct uses a flat layout where certain fields are only meaningful for specific event types (e.g., code/pressed for key events, x/y for motion, value/horizontal for axis). While this is a common pattern for efficiency, consider adding a brief comment noting which fields apply to which InputEventType, or using a variant for stronger type safety.

📝 Optional: Add field-validity documentation
 /// `@brief` Normalized input event for compositor injection.
+/// Fields used per type:
+/// - key: code, pressed
+/// - pointer_motion: x, y
+/// - pointer_button: code, pressed
+/// - pointer_axis: value, horizontal
 struct InputEvent {
     InputEventType type;
     uint32_t code;
     bool pressed;
     double x, y;
     double value;
     bool horizontal;
 };
docs/project_policies.md (1)

280-289: Good addition - consider explicit error documentation guidance.

The new docstring policy appropriately distinguishes public API contracts from implementation comments (C.7) and provides clear, concise guidelines. The scope limitation to "exported/public declarations only" maintains consistency with the minimal-comment philosophy.

Since the project uses tl::expected<T, Error> throughout (Section A.1), consider adding explicit guidance for documenting error cases:

📝 Suggested addition after line 288
 - Use `@return` for non-`void`; describe what it represents and any special cases.
+- For functions returning `Result<T>` or `ResultPtr<T>`, document expected error codes in `@return`.
 - Do not restate types, avoid jargon, and keep one symbol per docstring.

Example:

/// `@brief` Loads a shader module from the specified file path.
/// `@param` path Absolute path to the SPIR-V shader file.
/// `@return` Compiled shader module on success, or ErrorCode::FILE_NOT_FOUND / ErrorCode::SHADER_COMPILE_FAILED.
[[nodiscard]] auto load_shader(const std::filesystem::path& path) -> Result<ShaderModule>;
src/util/unique_fd.hpp (1)

56-57: Consider adding [[nodiscard]] to release().

Discarding the return value of release() would leak the file descriptor since ownership is transferred to the caller. Adding [[nodiscard]] would catch accidental misuse at compile time.

Suggested change
     /// `@brief` Releases ownership and returns the raw descriptor.
-    int release() { return std::exchange(m_fd, -1); }
+    [[nodiscard]] int release() { return std::exchange(m_fd, -1); }
src/util/serializer.hpp (1)

138-141: Consider distinguishing tellg() failure from empty file.

tellg() returns -1 on error (e.g., if the file couldn't be read), but the current check treats both size == 0 and size < 0 the same way—returning an empty vector. This could mask I/O errors as successful empty reads.

Suggested improvement
     const auto size = file.tellg();
+    if (size < 0) {
+        return make_error<std::vector<char>>(ErrorCode::file_read_failed,
+                                             "Failed to determine file size: " + path.string());
+    }
-    if (size <= 0) {
+    if (size == 0) {
         return std::vector<char>{};
     }
src/render/texture/texture_loader.hpp (1)

70-71: Consider returning Result<uint32_t> from find_memory_type.

If no suitable memory type is found, returning a raw uint32_t could lead to undefined behavior when used. A Result<uint32_t> would allow proper error propagation.

♻️ Suggested signature change
-    [[nodiscard]] auto find_memory_type(uint32_t type_filter, vk::MemoryPropertyFlags properties)
-        -> uint32_t;
+    [[nodiscard]] auto find_memory_type(uint32_t type_filter, vk::MemoryPropertyFlags properties)
+        -> Result<uint32_t>;
src/render/chain/pass.hpp (2)

112-114: Parenthesization differs from fit mode offset calculation.

In fill mode (lines 112-113), the cast to int32_t happens before the division, whereas in fit mode (lines 93-94), the subtraction result is cast first, then divided. For symmetry and consistency, consider matching the parenthesization pattern.

♻️ Suggested fix for consistency
-        result.offset_x = static_cast<int32_t>(target_width - result.width) / 2;
-        result.offset_y = static_cast<int32_t>(target_height - result.height) / 2;
+        result.offset_x = static_cast<int32_t>((target_width - result.width) / 2);
+        result.offset_y = static_cast<int32_t>((target_height - result.height) / 2);

129-130: Same parenthesization inconsistency in integer mode.

This has the same pattern as the fill mode offset calculation.

♻️ Suggested fix for consistency
-        result.offset_x = static_cast<int32_t>(target_width - result.width) / 2;
-        result.offset_y = static_cast<int32_t>(target_height - result.height) / 2;
+        result.offset_x = static_cast<int32_t>((target_width - result.width) / 2);
+        result.offset_y = static_cast<int32_t>((target_height - result.height) / 2);
src/util/config.hpp (1)

39-47: Consider using std::filesystem::path for path fields.

Config::Paths uses std::string while PathOverrides (in paths.hpp) uses std::filesystem::path. For consistency and to avoid unnecessary conversions when calling functions like overrides_from_config, consider using std::filesystem::path here as well.

src/capture/vk_layer/wsi_virtual.hpp (1)

73-94: Consider adding docstrings to remaining public methods for consistency.

Several public methods (get_surface_capabilities, get_surface_formats, get_surface_present_modes, get_surface_support, create_swapchain, get_swapchain_images, acquire_next_image) lack @brief documentation while other methods in the same class have them. For API surface consistency and maintainability, consider documenting these as well.

src/capture/vk_layer/vk_capture.hpp (1)

46-48: Remove redundant inline comment.

Line 47 has a redundant comment that duplicates the @brief on line 46. Consider removing it to avoid documentation drift.

Suggested fix
 /// `@brief` Device-level sync state independent of swapchain lifecycle.
-// Device-level sync state (independent of swapchain lifecycle)
 struct DeviceSyncState {
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b85f5cd and 135c309.

📒 Files selected for processing (37)
  • docs/project_policies.md
  • src/capture/capture_protocol.hpp
  • src/capture/capture_receiver.hpp
  • src/capture/compositor/compositor_capture.hpp
  • src/capture/vk_layer/ipc_socket.hpp
  • src/capture/vk_layer/vk_capture.hpp
  • src/capture/vk_layer/vk_dispatch.hpp
  • src/capture/vk_layer/vk_hooks.hpp
  • src/capture/vk_layer/wsi_virtual.hpp
  • src/input/compositor_server.hpp
  • src/input/input_forwarder.hpp
  • src/render/backend/vulkan_backend.hpp
  • src/render/backend/vulkan_debug.hpp
  • src/render/backend/vulkan_error.hpp
  • src/render/chain/filter_chain.hpp
  • src/render/chain/filter_pass.hpp
  • src/render/chain/frame_history.hpp
  • src/render/chain/framebuffer.hpp
  • src/render/chain/output_pass.hpp
  • src/render/chain/pass.hpp
  • src/render/chain/preset_parser.hpp
  • src/render/chain/semantic_binder.hpp
  • src/render/shader/retroarch_preprocessor.hpp
  • src/render/shader/shader_runtime.hpp
  • src/render/shader/slang_reflect.hpp
  • src/render/texture/texture_loader.hpp
  • src/ui/imgui_layer.hpp
  • src/util/config.hpp
  • src/util/error.hpp
  • src/util/job_system.hpp
  • src/util/logging.hpp
  • src/util/paths.hpp
  • src/util/profiling.hpp
  • src/util/queues.hpp
  • src/util/serializer.hpp
  • src/util/unique_fd.hpp
  • src/util/util.hpp
🧰 Additional context used
🧠 Learnings (48)
📓 Common learnings
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Testing scope: Only non-GPU logic tested initially. In scope: utility functions, configuration parsing, error handling, pipeline graph logic. Out of scope: Vulkan initialization, GPU resource management, rendering, capture layer.
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: openspec/project.md:0-0
Timestamp: 2025-12-29T15:44:30.520Z
Learning: Applies to openspec/src/capture/vk_layer/**/*.{cpp,hpp} : Capture layer (vk_layer/) MUST use raw Vulkan C API, not vulkan-hpp
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/src/render/**/*.{cpp,hpp} : Application code MUST use vulkan-hpp (C++ bindings), NOT raw Vulkan C API. Use `vk::` types (e.g., `vk::Instance`, `vk::Device`). Do not use raw C handles like `VkInstance`, `VkDevice`. Required configuration: `#define VULKAN_HPP_NO_EXCEPTIONS`, `#define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1`, `#include <vulkan/vulkan.hpp>`.
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/src/render/**/*.cpp : Main thread owns: Vulkan instance, device, swapchain lifecycle; queue submission; window events and user input; job coordination. Main thread MUST NOT: block on I/O, perform heavy computation (>1ms), allocate memory in per-frame code paths.
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: openspec/project.md:0-0
Timestamp: 2025-12-29T15:44:30.520Z
Learning: Applies to openspec/src/capture/vk_layer/**/*.{cpp,hpp} : Do not perform blocking operations or file I/O in capture layer performance-critical paths (e.g., vkQueuePresentKHR)
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: openspec/project.md:0-0
Timestamp: 2025-12-29T15:44:30.520Z
Learning: Vulkan capture layer is the primary frame capture method, intercepting rendered frames before presentation for zero-copy access
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/src/capture/vk_layer/**/*.{cpp,hpp} : Capture layer exception: The Vulkan capture layer (`src/capture/vk_layer/`) is exempt and MUST use the raw Vulkan C API because layer dispatch tables require C function pointers and the layer must intercept C API calls.
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/src/capture/vk_layer/**/*.{cpp,hpp} : Vulkan capture layer threading: Hooks execute in calling thread (usually render thread). No blocking in hooks, especially `vkQueuePresentKHR` hot path. Use atomics or locks for thread-safe layer state.
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: openspec/project.md:0-0
Timestamp: 2025-12-29T15:44:30.520Z
Learning: Applies to openspec/src/render/**/*.{cpp,hpp} : Application code MUST use vulkan-hpp with `VULKAN_HPP_NO_EXCEPTIONS` and dynamic dispatch
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/**/*.{cpp,hpp} : Code commenting policy: Code explains what, comments explain why (only when non-obvious). Forbidden patterns: narration comments restating what code does; LLM-style justifications of standard practices; step-by-step tutorials; inline explanations of current line. Required comments: non-obvious constraints (API requirements), workarounds, invariants, section dividers in files >200 lines.

Applied to files:

  • docs/project_policies.md
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/**/*.{cpp,hpp} : Use top-level namespace `goggles`. Use module namespaces `goggles::<module>` (e.g., `goggles::capture`, `goggles::render`). Use sub-module namespaces `goggles::<module>::<submodule>`. Never use `using namespace` in headers. Prefer explicit namespace qualification or scoped `using` declarations.

Applied to files:

  • docs/project_policies.md
  • src/util/logging.hpp
  • src/util/util.hpp
  • src/render/chain/frame_history.hpp
  • src/capture/compositor/compositor_capture.hpp
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/**/*.{cpp,hpp} : Use standard spdlog severity levels: trace, debug, info, warn, error, critical. Define project-specific logging macros (`GOGGLES_LOG_TRACE`, `GOGGLES_LOG_DEBUG`, etc.) wrapping spdlog.

Applied to files:

  • docs/project_policies.md
  • src/util/logging.hpp
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/**/*.{cpp,hpp} : Mark factory functions with `[[nodiscard]]`. Document ownership in function comments when non-obvious. Use move semantics for transferring ownership (prefer `std::move` over copying).

Applied to files:

  • docs/project_policies.md
  • src/util/paths.hpp
  • src/capture/compositor/compositor_capture.hpp
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/**/*.cpp : No raw `new`/`delete` in application code. Prefer `std::unique_ptr` for exclusive ownership. Use `std::shared_ptr` only when multiple owners genuinely needed or object lifetime extends beyond single scope. Prefer `std::make_unique`/`std::make_shared` over explicit `new`.

Applied to files:

  • docs/project_policies.md
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/**/*.{cpp,hpp} : Banned error handling patterns: No `bool` returns for operations that can fail in multiple ways. No `-1`/`0`/`nullptr` as error indicators. No ignored return values - mark all result-returning functions with `[[nodiscard]]`.

Applied to files:

  • docs/project_policies.md
  • src/util/error.hpp
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/**/*.{cpp,hpp} : All resources must be managed via RAII. Wrap Vulkan objects in RAII types. Use RAII wrappers for file handles and sockets. No manual cleanup in destructors unless encapsulated in RAII.

Applied to files:

  • docs/project_policies.md
  • src/render/backend/vulkan_error.hpp
  • src/render/backend/vulkan_debug.hpp
📚 Learning: 2025-12-29T15:44:30.520Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: openspec/project.md:0-0
Timestamp: 2025-12-29T15:44:30.520Z
Learning: Applies to openspec/src/**/*.{cpp,hpp} : Never use raw `new` or `delete`; enforce strict RAII for all resources

Applied to files:

  • docs/project_policies.md
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/src/render/**/*.cpp : Per-frame code paths on main thread MUST NOT: perform dynamic memory allocations (`new`, `malloc`, `std::make_shared`); use blocking synchronization primitives (`std::mutex`, `std::condition_variable`); exceed 8ms CPU time budget (excluding GPU sync).

Applied to files:

  • docs/project_policies.md
  • src/render/shader/shader_runtime.hpp
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/**/*.{cpp,hpp} : All fallible operations must return `tl::expected<T, Error>` from martinmoene/expected-lite library. No exceptions for expected failures (file I/O, resource creation, parsing). Exceptions allowed only for programming errors (assertions, contract violations).

Applied to files:

  • docs/project_policies.md
  • src/util/error.hpp
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/**/*.hpp : Header guidelines: Use `#pragma once` instead of include guards. Minimize includes and forward-declare types when possible. Include order: (1) Corresponding header, (2) C++ standard library, (3) Third-party libraries, (4) Project headers (other modules), (5) Project headers (same module). Sort alphabetically within each group.

Applied to files:

  • docs/project_policies.md
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/**/*.cpp : No silent failures. Every error must be either handled or propagated upward. Log errors exactly once at subsystem boundaries (capture → pipeline). Do not log the same error at every level of the call stack. Prefer monadic operations (`.and_then()`, `.or_else()`, `.transform()`) for chaining.

Applied to files:

  • docs/project_policies.md
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/**/*.cpp : Use `spdlog` as the project-wide logging library. No `std::cout`, `std::cerr`, or `printf` for subsystem logging (only for main app output).

Applied to files:

  • src/util/logging.hpp
📚 Learning: 2025-12-29T15:44:30.520Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: openspec/project.md:0-0
Timestamp: 2025-12-29T15:44:30.520Z
Learning: Applies to openspec/**/*.hpp : Organize namespaces as `goggles` with sub-modules like `goggles::capture`, `goggles::render`; never use `using namespace` in headers

Applied to files:

  • src/util/logging.hpp
  • src/util/util.hpp
  • src/render/chain/frame_history.hpp
  • src/capture/compositor/compositor_capture.hpp
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/**/*.cpp : Initialize logger once at application startup for console output (development) or file output (optional). For capture layer, initialize logger lazily on first `vkCreateInstance` hook.

Applied to files:

  • src/util/logging.hpp
  • src/capture/vk_layer/vk_dispatch.hpp
  • src/capture/vk_layer/vk_hooks.hpp
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/src/capture/vk_layer/**/*.{cpp,hpp} : Vulkan capture layer logging constraints: Use only `error` and `critical` levels. No file I/O or blocking operations in hot paths. Prefix all logs with `[goggles_vklayer]`. Never log in `vkQueuePresentKHR` hot path.

Applied to files:

  • src/util/logging.hpp
  • src/render/backend/vulkan_error.hpp
  • src/capture/vk_layer/wsi_virtual.hpp
  • src/render/backend/vulkan_debug.hpp
  • src/capture/vk_layer/vk_dispatch.hpp
  • src/capture/vk_layer/vk_hooks.hpp
  • src/capture/vk_layer/vk_capture.hpp
  • src/util/error.hpp
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/**/*.cpp : Error handling macros: Use `VK_TRY` for vk::Result early return in Vulkan code. Use `GOGGLES_TRY` for Result<T> propagation (both as statement and expression). Use `GOGGLES_MUST` for internal invariants that should never fail. Use manual pattern for destructors/cleanup functions where propagation is impossible.

Applied to files:

  • src/render/backend/vulkan_error.hpp
  • src/render/backend/vulkan_debug.hpp
  • src/util/error.hpp
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/src/render/**/*.{cpp,hpp} : All vulkan-hpp calls returning `vk::Result` must be explicitly checked. Prohibited pattern: `static_cast<void>(device.waitIdle())`. Use macro `VK_TRY(call, ErrorCode, "message")` for vk::Result early return or manual pattern with error handling.

Applied to files:

  • src/render/backend/vulkan_error.hpp
  • src/render/backend/vulkan_debug.hpp
  • src/util/error.hpp
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/src/render/**/*.{cpp,hpp} : Application code MUST use vulkan-hpp (C++ bindings), NOT raw Vulkan C API. Use `vk::` types (e.g., `vk::Instance`, `vk::Device`). Do not use raw C handles like `VkInstance`, `VkDevice`. Required configuration: `#define VULKAN_HPP_NO_EXCEPTIONS`, `#define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1`, `#include <vulkan/vulkan.hpp>`.

Applied to files:

  • src/render/backend/vulkan_error.hpp
  • src/render/chain/pass.hpp
  • src/render/texture/texture_loader.hpp
  • src/render/backend/vulkan_backend.hpp
  • src/render/shader/shader_runtime.hpp
  • src/capture/vk_layer/wsi_virtual.hpp
  • src/render/backend/vulkan_debug.hpp
  • src/capture/vk_layer/vk_dispatch.hpp
  • src/capture/vk_layer/vk_hooks.hpp
  • src/util/error.hpp
  • src/render/chain/preset_parser.hpp
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/src/render/**/*.{cpp,hpp} : Vulkan resource management: Follow RAII guidelines. Use `vk::Unique*` only for appropriate resource types. Call `device.waitIdle()` or wait on fences before destroying GPU-async resources. Store creation info with resources for debugging/recreation. Never leak Vulkan objects. Member ordering: declare in reverse destruction order (device before instance).

Applied to files:

  • src/render/backend/vulkan_error.hpp
  • src/render/chain/pass.hpp
  • src/render/chain/filter_pass.hpp
  • src/render/texture/texture_loader.hpp
  • src/render/chain/framebuffer.hpp
  • src/render/backend/vulkan_backend.hpp
  • src/render/shader/shader_runtime.hpp
  • src/capture/vk_layer/wsi_virtual.hpp
  • src/render/backend/vulkan_debug.hpp
  • src/capture/vk_layer/vk_dispatch.hpp
  • src/capture/vk_layer/vk_hooks.hpp
  • src/render/chain/output_pass.hpp
  • src/capture/vk_layer/vk_capture.hpp
📚 Learning: 2025-12-29T15:44:30.520Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: openspec/project.md:0-0
Timestamp: 2025-12-29T15:44:30.520Z
Learning: Applies to openspec/src/render/**/*.{cpp,hpp} : Application code MUST use vulkan-hpp with `VULKAN_HPP_NO_EXCEPTIONS` and dynamic dispatch

Applied to files:

  • src/render/backend/vulkan_error.hpp
  • src/render/chain/pass.hpp
  • src/render/shader/shader_runtime.hpp
  • src/render/backend/vulkan_debug.hpp
  • src/capture/vk_layer/vk_dispatch.hpp
  • src/util/error.hpp
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/src/render/**/*.{cpp,hpp} : RAII handle guidelines for Vulkan resources: Use `vk::Unique*` only for appropriate resource types: Instance, Device, Surface (long-lived singletons); Swapchain, Pipelines, Layouts (created once). Use plain `vk::` handles for command buffers (pooled lifetime), per-frame sync primitives (reused), and imported external images (requires explicit sync).

Applied to files:

  • src/render/backend/vulkan_error.hpp
  • src/util/unique_fd.hpp
  • src/render/chain/pass.hpp
  • src/render/texture/texture_loader.hpp
  • src/render/chain/framebuffer.hpp
  • src/render/backend/vulkan_backend.hpp
  • src/capture/vk_layer/wsi_virtual.hpp
  • src/render/backend/vulkan_debug.hpp
  • src/capture/vk_layer/vk_dispatch.hpp
  • src/capture/vk_layer/vk_hooks.hpp
  • src/capture/vk_layer/vk_capture.hpp
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/src/capture/vk_layer/**/*.{cpp,hpp} : Capture layer exception: The Vulkan capture layer (`src/capture/vk_layer/`) is exempt and MUST use the raw Vulkan C API because layer dispatch tables require C function pointers and the layer must intercept C API calls.

Applied to files:

  • src/render/backend/vulkan_error.hpp
  • src/capture/capture_protocol.hpp
  • src/ui/imgui_layer.hpp
  • src/capture/compositor/compositor_capture.hpp
  • src/capture/vk_layer/wsi_virtual.hpp
  • src/render/backend/vulkan_debug.hpp
  • src/capture/vk_layer/vk_dispatch.hpp
  • src/capture/vk_layer/vk_hooks.hpp
  • src/capture/vk_layer/ipc_socket.hpp
  • src/capture/vk_layer/vk_capture.hpp
📚 Learning: 2025-12-29T15:44:30.520Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: openspec/project.md:0-0
Timestamp: 2025-12-29T15:44:30.520Z
Learning: Applies to openspec/src/render/**/*.{cpp,hpp} : Use `vk::Unique*` for long-lived Vulkan resources; use plain handles for per-frame/GPU-async resources

Applied to files:

  • src/render/backend/vulkan_error.hpp
  • src/render/chain/pass.hpp
  • src/render/texture/texture_loader.hpp
  • src/render/chain/framebuffer.hpp
  • src/render/backend/vulkan_backend.hpp
  • src/render/shader/shader_runtime.hpp
  • src/capture/vk_layer/wsi_virtual.hpp
  • src/render/backend/vulkan_debug.hpp
  • src/capture/vk_layer/vk_dispatch.hpp
  • src/render/chain/output_pass.hpp
  • src/capture/vk_layer/vk_capture.hpp
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/**/*.{cpp,hpp} : All real-time inter-thread communication MUST use `goggles::util::SPSCQueue` for fixed producer-consumer pairs (wait-free guarantee). Never use MPMC queues in latency-critical paths. Operations must be non-blocking (`try_push`, `try_pop`). Use pointer passing with pre-allocated buffers.

Applied to files:

  • src/util/queues.hpp
📚 Learning: 2025-12-29T15:44:30.520Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: openspec/project.md:0-0
Timestamp: 2025-12-29T15:44:30.520Z
Learning: Applies to openspec/src/**/*.{cpp,hpp} : Use inter-thread communication via `goggles::util::SPSCQueue` (lock-free SPSC queue) for task parallelism

Applied to files:

  • src/util/queues.hpp
  • src/util/job_system.hpp
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/**/*.{cpp,hpp} : Never use raw `int` file descriptors when possible. Use `goggles::util::UniqueFd` for all owned file descriptors. Raw `int` acceptable only at uncontrollable boundaries (syscall returns, IPC receive). Wrap immediately after receive. API boundaries may use `int` with clear documentation.

Applied to files:

  • src/util/unique_fd.hpp
  • src/util/error.hpp
📚 Learning: 2025-12-29T15:44:30.520Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: openspec/project.md:0-0
Timestamp: 2025-12-29T15:44:30.520Z
Learning: Applies to openspec/src/**/*.{cpp,hpp} : Use `std::unique_ptr` as the default for exclusive ownership; `std::shared_ptr` only when necessary

Applied to files:

  • src/util/unique_fd.hpp
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Testing scope: Only non-GPU logic tested initially. In scope: utility functions, configuration parsing, error handling, pipeline graph logic. Out of scope: Vulkan initialization, GPU resource management, rendering, capture layer.

Applied to files:

  • src/render/chain/pass.hpp
  • src/render/backend/vulkan_backend.hpp
  • src/capture/vk_layer/wsi_virtual.hpp
  • src/capture/vk_layer/vk_dispatch.hpp
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/src/render/**/*.cpp : Main thread owns: Vulkan instance, device, swapchain lifecycle; queue submission; window events and user input; job coordination. Main thread MUST NOT: block on I/O, perform heavy computation (>1ms), allocate memory in per-frame code paths.

Applied to files:

  • src/render/chain/pass.hpp
  • src/render/backend/vulkan_backend.hpp
  • src/capture/vk_layer/wsi_virtual.hpp
  • src/capture/vk_layer/vk_hooks.hpp
  • src/capture/vk_layer/vk_capture.hpp
📚 Learning: 2025-12-29T15:44:30.520Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: openspec/project.md:0-0
Timestamp: 2025-12-29T15:44:30.520Z
Learning: Applies to openspec/src/capture/vk_layer/**/*.{cpp,hpp} : Do not perform blocking operations or file I/O in capture layer performance-critical paths (e.g., vkQueuePresentKHR)

Applied to files:

  • src/render/chain/pass.hpp
  • src/capture/capture_protocol.hpp
  • src/render/backend/vulkan_backend.hpp
  • src/ui/imgui_layer.hpp
  • src/capture/compositor/compositor_capture.hpp
  • src/capture/vk_layer/wsi_virtual.hpp
  • src/capture/vk_layer/vk_dispatch.hpp
  • src/capture/vk_layer/vk_hooks.hpp
  • src/capture/vk_layer/ipc_socket.hpp
  • src/capture/vk_layer/vk_capture.hpp
📚 Learning: 2025-12-29T15:44:30.520Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: openspec/project.md:0-0
Timestamp: 2025-12-29T15:44:30.520Z
Learning: The main thread owns all global Vulkan objects (Instance, Device) and is solely responsible for queue submissions

Applied to files:

  • src/render/chain/pass.hpp
  • src/capture/vk_layer/vk_dispatch.hpp
  • src/capture/vk_layer/vk_capture.hpp
📚 Learning: 2025-12-29T15:44:30.520Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: openspec/project.md:0-0
Timestamp: 2025-12-29T15:44:30.520Z
Learning: Vulkan capture layer is the primary frame capture method, intercepting rendered frames before presentation for zero-copy access

Applied to files:

  • src/render/chain/pass.hpp
  • src/render/backend/vulkan_backend.hpp
  • src/ui/imgui_layer.hpp
  • src/capture/compositor/compositor_capture.hpp
  • src/capture/vk_layer/wsi_virtual.hpp
  • src/capture/vk_layer/vk_dispatch.hpp
  • src/capture/vk_layer/vk_hooks.hpp
  • src/capture/vk_layer/ipc_socket.hpp
  • src/capture/vk_layer/vk_capture.hpp
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/src/capture/vk_layer/**/*.{cpp,hpp} : Vulkan capture layer threading: Hooks execute in calling thread (usually render thread). No blocking in hooks, especially `vkQueuePresentKHR` hot path. Use atomics or locks for thread-safe layer state.

Applied to files:

  • src/render/chain/pass.hpp
  • src/render/backend/vulkan_backend.hpp
  • src/ui/imgui_layer.hpp
  • src/capture/vk_layer/wsi_virtual.hpp
  • src/capture/vk_layer/vk_dispatch.hpp
  • src/capture/vk_layer/vk_hooks.hpp
  • src/capture/vk_layer/ipc_socket.hpp
  • src/capture/vk_layer/vk_capture.hpp
📚 Learning: 2025-12-29T15:44:30.520Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: openspec/project.md:0-0
Timestamp: 2025-12-29T15:44:30.520Z
Learning: Applies to openspec/src/capture/vk_layer/**/*.{cpp,hpp} : Capture layer (vk_layer/) MUST use raw Vulkan C API, not vulkan-hpp

Applied to files:

  • src/capture/capture_protocol.hpp
  • src/ui/imgui_layer.hpp
  • src/capture/compositor/compositor_capture.hpp
  • src/capture/vk_layer/wsi_virtual.hpp
  • src/render/backend/vulkan_debug.hpp
  • src/capture/vk_layer/vk_dispatch.hpp
  • src/capture/vk_layer/vk_hooks.hpp
  • src/capture/vk_layer/ipc_socket.hpp
  • src/capture/vk_layer/vk_capture.hpp
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/**/*.cpp : Configuration loading: Read once at startup (no hot-reload initially). Validate all values after parsing. Provide defaults for all optional values. Fail fast on invalid config (do not silently ignore).

Applied to files:

  • src/util/config.hpp
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/**/*.cpp : All concurrent processing MUST use the project's central job system (`goggles::util::JobSystem`). Phase 1: BS::thread_pool. Phase 2: Taskflow. Direct use of `std::thread` or `std::jthread` for pipeline work is PROHIBITED. Exception: External integration code (networking, IPC) outside real-time path may use `std::jthread` with RAII.

Applied to files:

  • src/util/job_system.hpp
📚 Learning: 2025-12-29T15:44:30.520Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: openspec/project.md:0-0
Timestamp: 2025-12-29T15:44:30.520Z
Learning: Default to single-threaded render loop on main thread; use central job system (goggles::util::JobSystem) for any task parallelism

Applied to files:

  • src/util/job_system.hpp
  • src/render/backend/vulkan_backend.hpp
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/src/render/**/*.cpp : Single-threaded render loop on main thread by default. Render backend (`goggles::render`) runs on main thread. Pipeline execution runs on main thread. Job system for non-render work on worker threads. Threading introduced only when profiling justifies it (main thread CPU consistently >8ms).

Applied to files:

  • src/util/job_system.hpp
  • src/render/backend/vulkan_backend.hpp
  • src/render/chain/frame_history.hpp
  • src/render/shader/shader_runtime.hpp
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/**/*.{cpp,hpp} : Object initialization policy: Use factory pattern `static auto create(...) -> ResultPtr<T>` for: (1) Manager/singleton objects (VulkanBackend, FilterChain), (2) Objects owning multiple interdependent resources, (3) Objects where uninitialized state causes undefined behavior. Banned pattern: No two-phase initialization (no constructor + `init()`).

Applied to files:

  • src/render/backend/vulkan_backend.hpp
📚 Learning: 2025-12-29T15:44:30.520Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: openspec/project.md:0-0
Timestamp: 2025-12-29T15:44:30.520Z
Learning: Support RetroArch shader format for wide compatibility

Applied to files:

  • src/render/shader/retroarch_preprocessor.hpp
  • src/render/chain/semantic_binder.hpp
📚 Learning: 2025-12-29T15:44:30.520Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: openspec/project.md:0-0
Timestamp: 2025-12-29T15:44:30.520Z
Learning: The shader pipeline is a multi-pass model designed for compatibility with RetroArch shader semantics

Applied to files:

  • src/render/shader/retroarch_preprocessor.hpp
  • src/render/shader/shader_runtime.hpp
  • src/render/chain/semantic_binder.hpp
📚 Learning: 2025-12-29T15:44:30.520Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: openspec/project.md:0-0
Timestamp: 2025-12-29T15:44:30.520Z
Learning: Applies to openspec/**/*.{cpp,hpp} : Use `snake_case` for file names (e.g., `shader_runtime.hpp`)

Applied to files:

  • src/render/shader/shader_runtime.hpp
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/**/*.hpp : Define a lightweight `Error` struct with `ErrorCode` enum, `std::string message`, and optional `std::source_location loc` in the `goggles` namespace.

Applied to files:

  • src/util/error.hpp
📚 Learning: 2026-01-07T07:20:57.073Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: docs/project_policies.md:0-0
Timestamp: 2026-01-07T07:20:57.073Z
Learning: Applies to docs/**/*.{cpp,hpp} : Type naming: Classes/Structs use `PascalCase` (e.g., `VulkanBackend`, `ShaderPass`). Enums use `PascalCase` for type and `snake_case` for enumerators (e.g., `enum class ErrorCode { ok, file_not_found }`). Type aliases use `PascalCase` (e.g., `using ShaderHandle = uint32_t;`).

Applied to files:

  • src/util/error.hpp
  • src/render/chain/preset_parser.hpp
📚 Learning: 2025-12-29T15:44:30.520Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: openspec/project.md:0-0
Timestamp: 2025-12-29T15:44:30.520Z
Learning: Applies to openspec/src/**/*.{cpp,hpp} : All fallible operations MUST return `tl::expected<T, Error>` for error handling

Applied to files:

  • src/util/error.hpp
📚 Learning: 2025-12-29T15:44:30.520Z
Learnt from: CR
Repo: K1ngst0m/Goggles PR: 0
File: openspec/project.md:0-0
Timestamp: 2025-12-29T15:44:30.520Z
Learning: Applies to openspec/src/**/*.{cpp,hpp} : Exceptions are only for unrecoverable programming errors; use `tl::expected` for recoverable errors

Applied to files:

  • src/util/error.hpp
🧬 Code graph analysis (10)
src/render/shader/slang_reflect.hpp (1)
src/render/chain/filter_pass.hpp (2)
  • nodiscard (91-93)
  • nodiscard (101-103)
src/util/config.hpp (2)
src/render/chain/pass.hpp (1)
  • nodiscard (60-156)
src/util/error.hpp (1)
  • nodiscard (54-58)
src/util/job_system.hpp (1)
src/util/job_system.cpp (4)
  • thread_count (34-39)
  • thread_count (34-34)
  • ensure_initialized (41-45)
  • ensure_initialized (41-41)
src/render/chain/frame_history.hpp (1)
src/render/chain/filter_chain.hpp (1)
  • extent (98-98)
src/render/shader/retroarch_preprocessor.hpp (2)
src/render/chain/filter_pass.hpp (2)
  • nodiscard (91-93)
  • nodiscard (101-103)
src/render/chain/semantic_binder.hpp (14)
  • nodiscard (28-28)
  • nodiscard (29-29)
  • nodiscard (33-40)
  • nodiscard (54-56)
  • nodiscard (67-69)
  • nodiscard (99-99)
  • nodiscard (102-108)
  • nodiscard (110-110)
  • nodiscard (112-112)
  • nodiscard (114-114)
  • nodiscard (116-116)
  • nodiscard (118-118)
  • nodiscard (120-122)
  • nodiscard (129-135)
src/input/input_forwarder.hpp (1)
src/util/error.hpp (4)
  • nodiscard (54-58)
  • nodiscard (61-63)
  • nodiscard (66-70)
  • nodiscard (73-109)
src/render/chain/filter_chain.hpp (1)
src/render/chain/filter_pass.hpp (9)
  • nodiscard (91-93)
  • nodiscard (101-103)
  • cmd (57-57)
  • frame_index (116-116)
  • name (81-83)
  • name (81-81)
  • name (86-88)
  • name (86-86)
  • name (94-94)
src/capture/vk_layer/vk_hooks.hpp (1)
src/capture/vk_layer/vk_hooks.cpp (32)
  • Goggles_CreateInstance (33-120)
  • Goggles_CreateInstance (33-35)
  • Goggles_DestroyInstance (122-133)
  • Goggles_DestroyInstance (122-123)
  • Goggles_CreateDevice (218-365)
  • Goggles_CreateDevice (218-221)
  • Goggles_DestroyDevice (367-381)
  • Goggles_DestroyDevice (367-367)
  • Goggles_CreateXlibSurfaceKHR (387-401)
  • Goggles_CreateXlibSurfaceKHR (387-390)
  • Goggles_CreateXcbSurfaceKHR (403-417)
  • Goggles_CreateXcbSurfaceKHR (403-406)
  • Goggles_CreateWaylandSurfaceKHR (419-432)
  • Goggles_CreateWaylandSurfaceKHR (419-421)
  • Goggles_DestroySurfaceKHR (434-446)
  • Goggles_DestroySurfaceKHR (434-435)
  • Goggles_GetPhysicalDeviceSurfaceCapabilitiesKHR (448-463)
  • Goggles_GetPhysicalDeviceSurfaceCapabilitiesKHR (448-450)
  • Goggles_GetPhysicalDeviceSurfaceFormatsKHR (465-480)
  • Goggles_GetPhysicalDeviceSurfaceFormatsKHR (465-467)
  • Goggles_GetPhysicalDeviceSurfacePresentModesKHR (482-498)
  • Goggles_GetPhysicalDeviceSurfacePresentModesKHR (482-484)
  • Goggles_GetPhysicalDeviceSurfaceSupportKHR (500-520)
  • Goggles_GetPhysicalDeviceSurfaceSupportKHR (500-503)
  • Goggles_GetPhysicalDeviceSurfaceCapabilities2KHR (522-538)
  • Goggles_GetPhysicalDeviceSurfaceCapabilities2KHR (522-524)
  • Goggles_CreateSwapchainKHR (573-603)
  • Goggles_CreateSwapchainKHR (573-576)
  • Goggles_DestroySwapchainKHR (605-624)
  • Goggles_DestroySwapchainKHR (605-606)
  • Goggles_GetSwapchainImagesKHR (626-640)
  • Goggles_GetSwapchainImagesKHR (626-628)
src/capture/vk_layer/ipc_socket.hpp (3)
src/capture/capture_receiver.hpp (1)
  • data (76-77)
src/util/serializer.hpp (2)
  • data (19-22)
  • data (19-19)
src/render/backend/vulkan_backend.hpp (1)
  • frame_ready_fd (96-97)
src/capture/vk_layer/vk_capture.hpp (2)
src/capture/vk_layer/vk_dispatch.hpp (7)
  • device (121-121)
  • device (126-126)
  • device (128-128)
  • device (132-132)
  • device (137-137)
  • queue (130-130)
  • queue (135-135)
src/capture/vk_layer/wsi_virtual.hpp (7)
  • device (82-83)
  • device (85-85)
  • device (92-94)
  • swapchain (87-87)
  • swapchain (89-89)
  • swapchain (91-91)
  • swapchain (96-96)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Static Analysis (clang-tidy)
  • GitHub Check: Build and Test (test preset)

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@K1ngst0m K1ngst0m merged commit 9bd0184 into main Jan 15, 2026
4 checks passed
@K1ngst0m K1ngst0m deleted the dev/update-docstring branch January 15, 2026 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant