feat: add gfx pipeline abstraction with render targets

Add cbt/gfx layer (pipeline + render_target) inspired by Sokol but
C++-friendly with RAII and pipeline_desc. Supports building full
graphics pipelines (VS/IA/raster/PS/OM), render-to-texture (FBO),
and post-processing steps (scene -> RT -> fullscreen quad with
sampler + vignette).

- Depth/state/viewport/texture cleanup for reliable scene switching.
- Updated cube/sphere to demonstrate (sphere uses RT+post).
- Vulkan backend easy via PIMPL in impl (same public API).
- Fixed depth test, viewport restore, and state leakage on switch.

Followed coding conventions (snake_case, trailing returns, east const,
include order, no ; after ns/class, etc.).
This commit is contained in:
2026-05-06 00:43:00 +02:00
parent 98673b57ff
commit 5ec8cfc735
7 changed files with 565 additions and 163 deletions
+2 -1
View File
@@ -28,12 +28,13 @@ add_library(cbt_opengl STATIC
"cbt/opengl/descriptor.cpp"
"cbt/opengl/shader.cpp"
"cbt/opengl/vao.cpp"
"cbt/gfx.cpp"
)
target_include_directories(cbt_opengl PRIVATE ".")
target_compile_features(cbt_opengl PRIVATE cxx_std_23)
target_compile_options(cbt_opengl PRIVATE ${BASE_OPTIONS})
target_compile_definitions(cbt_opengl PRIVATE ${BASE_DEFINITIONS})
target_link_libraries(cbt_opengl PUBLIC fmt::fmt glfw::glfw glad::glad stb::stb)
target_link_libraries(cbt_opengl PUBLIC fmt::fmt glfw::glfw glad::glad stb::stb glm::glm)
# Scene base library
add_library(cbt_scene STATIC