Skip to content

Conversation

SergeyLebedkin
Copy link
Member

by design the gl renderer created offscreen buffers of different sizes based on the scene box size. Because of this different offscreen buffers had their own coordinate system and had to deal with the alignment of offscreen buffers and the window buffer. It also meant having multiple buffer pools for different sizes. This complicates the logic and creates the need to recalculate alignment, viewports and scissors every frame, as well as texture coordinates for shaders.

Now all offscreen buffers have the same size as the window buffer, which simplifies the pool logic, as well as the blending/compositing/effects logic. The number of created buffers is equal to the depth of the scene graph, including temporary buffers for copies of the window buffer

#3698 - Render Targets

by design the gl renderer created offscreen buffers of different sizes based on the scene box size.
Because of this different offscreen buffers had their own coordinate system and
had to deal with the alignment of offscreen buffers and the window buffer.
It also meant having multiple buffer pools for different sizes.
This complicates the logic and creates the need to recalculate alignment,
viewports and scissors every frame, as well as texture coordinates for shaders.

Now all offscreen buffers have the same size as the window buffer,
which simplifies the pool logic, as well as the blending/compositing/effects logic.
The number of created buffers is equal to the depth of the scene graph,
including temporary buffers for copies of the window buffer

#3698 - Render Targets
@SergeyLebedkin SergeyLebedkin requested a review from hermet August 11, 2025 15:46
@SergeyLebedkin SergeyLebedkin self-assigned this Aug 11, 2025
@SergeyLebedkin SergeyLebedkin added refactoring Code refactoring / Exceptional handles gl OpenGL/WebGL render backend labels Aug 11, 2025
@SergeyLebedkin SergeyLebedkin force-pushed the sergii/opengl_use_full_screen_fbos branch from e0657e2 to 4eab777 Compare August 11, 2025 15:52
@hermet hermet requested review from Copilot and tinyjin August 12, 2025 03:02
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the OpenGL renderer to use full-screen intermediate render targets instead of variably-sized buffers based on scene bounding boxes. This simplifies the rendering pipeline by eliminating the need for coordinate system transformations, viewport/scissor recalculations, and multiple buffer pools for different sizes.

  • Consolidates multiple render target pools into a single pool with uniform buffer sizes
  • Removes viewport-based coordinate transformations in shaders and compositing tasks
  • Simplifies buffer management by using window-sized render targets consistently

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tvgGlShaderSrc.cpp Removes viewport uniform blocks and simplifies blur shader coordinate calculations
tvgGlRenderer.h Consolidates multiple render target pools into a single pool
tvgGlRenderer.cpp Updates render target acquisition and simplifies compositing geometry calculations
tvgGlRenderTask.cpp Fixes scissor rectangle dimensions and removes unnecessary viewport setup
tvgGlRenderTarget.h Refactors pool interface to use uniform-sized render targets
tvgGlRenderTarget.cpp Implements new pooling logic with consistent buffer dimensions
tvgGlEffect.h Updates effect rendering signatures to use single pool reference
tvgGlEffect.cpp Adapts effect rendering to new pooling system and adds proper resource cleanup

@hermet
Copy link
Member

hermet commented Aug 12, 2025

@tinyjin Please confirm any regression on the web. Thanks.

@SergeyLebedkin SergeyLebedkin changed the title gl_engine: use full screen intemidiate render targets gl_engine: use full screen intermediate render targets Aug 13, 2025
Copy link
Member

@tinyjin tinyjin left a comment

Choose a reason for hiding this comment

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

CleanShot 2025-08-13 at 18 35 05@2x

It Looks good.

@SergeyLebedkin
Copy link
Member Author

SergeyLebedkin commented Aug 13, 2025

It Looks good.
@tinyjin
Could you please share some performance changes?

For a quick check in a single animation, we can use game_finished.json and guitar.json animation from our standtard animations set. Run web player on the largest resolution as we can and compare performance

Thanx

@SergeyLebedkin SergeyLebedkin marked this pull request as draft August 13, 2025 10:02
@hermet hermet force-pushed the main branch 9 times, most recently from 30c82d7 to 0c3e8ff Compare September 3, 2025 17:59
@hermet hermet force-pushed the main branch 2 times, most recently from 7b0fe6f to 811aac3 Compare September 22, 2025 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gl OpenGL/WebGL render backend refactoring Code refactoring / Exceptional handles
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants