Skip to content

Make RHI usable for complex 3D scenarios - #181

Open
kunitoki wants to merge 2 commits into
mainfrom
dev/rhi_perfection
Open

Make RHI usable for complex 3D scenarios#181
kunitoki wants to merge 2 commits into
mainfrom
dev/rhi_perfection

Conversation

@kunitoki

@kunitoki kunitoki commented Sep 6, 2026

Copy link
Copy Markdown
Owner
yup_rhi_pbr yup_rhi_fluid

This pull request introduces major improvements and new features to the graphics rendering infrastructure, with a focus on GPU resource management, rendering performance, and new demo content. The changes include backend optimizations, expanded API capabilities, new demos, and documentation updates to reflect the latest features and fixes.

Graphics Backend and API Enhancements

  • GpuTexture now caches backend texture views by view descriptor, reducing redundant allocations and improving performance, especially on Metal.
  • GpuRenderPass now encodes all draws in a pass into a single backend render pass, avoiding expensive per-draw encoder creation and improving frame efficiency.
  • GpuFrame no longer blocks on the GPU at scope end, reducing pipeline stalls and relying on backend-specific resource management. Frame numbers are now correctly reported to the ore context for better resource reclamation.
  • Added GpuTexture::create() and upload() for direct texture allocation and pixel upload, supporting all backend formats and shapes. Added GpuSampler and GpuRenderPass::setSampler() for customizable sampling. [1] [2]
  • GpuRenderPass now supports multiple color attachments, explicit depth/stencil, MSAA resolve, and expanded draw/viewport/scissor/blend operations. Bind groups are validated and errors are reported. [1] [2]

New Features and Demos

  • Added a PBR IBL demo (physically based rendering with image-based lighting) and a Fluid Simulation demo (Navier-Stokes solver with GPU post-processing and bloom) to the graphics example app. [1] [2]

Performance and Synchronization Improvements

  • Component effect paths now reuse offscreen GpuCanvas across frames for efficiency.
  • New ComponentNative::vsync flag (with Options::withVSync()) synchronizes presentation to display refresh, improving pacing and avoiding timer conflicts.
  • Fixed render loop hang when framerateRedraw is very high and improved timer precision on macOS.

Documentation Updates

  • Updated documentation for new texture allocation and upload APIs, sampler usage, and expanded pass/draw operations. Clarified compute shader availability on WebGL2/Emscripten. [1] [2] [3]

Bug Fixes

  • ShaderTranspiler now defaults to precision highp float; for GLSL ES fragment output, fixing math corruption on OpenGL ES.
  • Fixed data races in KMeterState by making all relevant fields atomic and updating thread ownership.
  • Various fixes for context/thread handling in SDL and GL, and improvements to resource cleanup and error reporting. [1] [2]

These changes significantly enhance the graphics subsystem's flexibility, performance, and reliability, while providing new demos and clearer documentation for advanced rendering features.

@codecov

codecov Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.47887% with 238 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.50%. Comparing base (7bb7105) to head (e2bbbe3).

Files with missing lines Patch % Lines
modules/yup_rhi/rhi/yup_GpuRenderPass.cpp 58.82% 84 Missing ⚠️
modules/yup_rhi/rhi/yup_GpuPipeline.cpp 54.10% 67 Missing ⚠️
modules/yup_rhi/context/yup_GpuDevice.cpp 40.67% 35 Missing ⚠️
modules/yup_rhi/rhi/yup_GpuTexture.cpp 83.58% 22 Missing ⚠️
modules/yup_rhi/rhi/yup_ShaderBindingMap.cpp 40.00% 12 Missing ⚠️
modules/yup_rhi/rhi/yup_GpuTarget.cpp 77.77% 8 Missing ⚠️
modules/yup_rhi/rhi/yup_GpuSampler.cpp 83.33% 5 Missing ⚠️
modules/yup_rhi/context/yup_GpuDevice.h 0.00% 2 Missing ⚠️
modules/yup_rhi/rhi/yup_GpuSampler.h 33.33% 2 Missing ⚠️
modules/yup_rhi/rhi/yup_GpuFrame.cpp 97.14% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #181      +/-   ##
==========================================
- Coverage   81.60%   81.50%   -0.11%     
==========================================
  Files         796      798       +2     
  Lines       82713    83336     +623     
==========================================
+ Hits        67497    67920     +423     
- Misses      15216    15416     +200     
Files with missing lines Coverage Δ
modules/yup_core/threads/yup_WaitableTimer.cpp 100.00% <100.00%> (+6.66%) ⬆️
modules/yup_gui/component/yup_ComponentNative.cpp 100.00% <100.00%> (ø)
modules/yup_gui/component/yup_ComponentNative.h 33.33% <ø> (ø)
modules/yup_rhi/rhi/yup_GpuFrame.h 50.00% <ø> (ø)
modules/yup_rhi/rhi/yup_GpuRenderPass.h 50.00% <ø> (ø)
modules/yup_rhi/rhi/yup_GpuTarget.h 75.00% <ø> (ø)
modules/yup_rhi/rhi/yup_GpuTexture.h 50.00% <ø> (ø)
modules/yup_rhi/rhi/yup_GpuTypes.h 100.00% <100.00%> (ø)
...dules/yup_shading/shading/yup_ShaderTranspiler.cpp 85.42% <100.00%> (+0.06%) ⬆️
modules/yup_rhi/rhi/yup_GpuFrame.cpp 96.25% <97.14%> (-0.18%) ⬇️
... and 9 more

... and 14 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7bb7105...e2bbbe3. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant