Skip to content

Refactor XR Rendering Pipeline: Maintain GPURenderPassEncoder Queue per StereoRenderingFrame #298

@yorkie

Description

@yorkie

Background

To optimize and modularize the XR rendering workflow, propose the following architectural changes:

1. Maintain a vector for each xr::StereoRenderingFrame

  • Each xr::StereoRenderingFrame should own and manage a vector of GPURenderPassEncoder instances.
  • This enables fine-grained control over multiple render passes per frame and prepares the architecture for advanced effects and multi-pass composition.

2. Introduce a New Class (e.g., XRRenderPassQueueBuilder)

  • Design and implement a new class (referred to as A for now), responsible for collecting TrCommandBufferRequest objects and building a queue/vector of GPURenderPassEncoder objects.
  • The class should:
    • Accept input of TrCommandBufferRequest objects (potentially from multiple sources)
    • Generate and maintain an ordered queue/vector of GPURenderPassEncoder for subsequent rendering operations
    • Support efficient queue updates and thread safety if necessary

3. Integrate into TrContentRenderer::onCommandBufferRequestReceived()

  • Refactor TrContentRenderer::onCommandBufferRequestReceived() to utilize the new class (A).
  • Upon receiving a TrCommandBufferRequest, pass it to A to extend/build the GPURenderPassEncoder queue for the current frame.
  • Ensure that the queue is properly consumed during the frame rendering pipeline.

Acceptance Criteria

  • Each xr::StereoRenderingFrame maintains and exposes its own vector of GPURenderPassEncoder.
  • A new class (e.g., XRRenderPassQueueBuilder) exists and can convert a stream of TrCommandBufferRequest into a queue/vector of GPURenderPassEncoder.
  • The command buffer request handling in TrContentRenderer is refactored to use this new queue builder.
  • The design is documented and aligns with JSAR's rendering architecture.

Related Areas

  • xr::StereoRenderingFrame (frame lifecycle and data members)
  • TrContentRenderer (command buffer and rendering integration)
  • Command buffer and rendering pass management

This refactor will improve extensibility and clarity in the XR rendering pipeline, enabling future enhancements such as multi-pass effects, advanced compositing, and better pipeline diagnostics.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions