Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 25, 2025

Introduces a RenderPass abstraction layer to route command buffers to different render passes (Opaque/Transparent/Offscreen) based on rendering state, enabling future WebGPU integration.

Changes

New RenderPass Infrastructure (src/renderer/render_pass.hpp/cpp)

  • RenderPassType enum: kOpaque, kTransparent, kOffscreen
  • TrRenderPass class wrapping GPURenderPassEncoder for command buffer management
  • TrRenderPassCollection managing per-content-renderer passes

Command Buffer Routing (TrContentRenderer)

  • determineRenderPassType() routes based on:
    • Non-default framebuffer binding → Offscreen
    • Blending enabled + draw call → Transparent
    • Default → Opaque
  • State tracking for isBlendingEnabled_ and currentBoundFramebuffer_

Render Pass Execution

  • onTransparentsRenderPass() executes transparent pass command buffers
  • onOffscreenRenderPass() integrated with render pass collection
  • onStartFrame() resets pass collection and state tracking

State Tracking in RHI (render_api_opengles.cpp)

  • OnEnable/OnDisable track GL_BLEND state
  • OnBindFramebuffer tracks current framebuffer binding

Usage

// Routing decision during execution
RenderPassType passType = contentRenderer->determineRenderPassType(commandBuffer);
auto* pass = renderPassCollection_.getOrCreatePass(passType);
pass->addCommandBuffer(commandBuffer);

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • registry.npmmirror.com
    • Triggering command: /usr/local/bin/node node /usr/local/bin/npm ci (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

选择的分支它主要实现以下功能:重构 renderer 的 RHI,使用 WebGPU 作为 RHI 的具体实现,使得客户端提交的渲染指令我们可以自由的安排在不同的 RenderPass 中,如 OpaqueRenderPass/TransparentRenderPass/OffscreenRenderPass。

请基于目前已经实现的部分,继续实现:

  1. 在 Renderer 中添加一个 RenderPass 的类,它内部基于 GPURenderPassEncoder 用于维护每个 Content Renderer 中的不同 RenderPass,比如 OpaqueRenderPass/TransparentRenderPass/OffscreenRenderPass
  2. 在 TrContentRenderer::onCommandBufferRequestReceived 中,根据一些规则来添加对不同的 RenderPass 中,比如 framebuffer 如果不在当前 fbo 那么就添加到 offscreen renderpass,如果开启了 blending 那么就添加到 transparent renderpass 等
  3. 在 TrContentRenderer 中,不同的 on*RenderPass 时,调用对应的 GPURenderPassEncoder 去执行 commandbuffer(但具体的执行逻辑是在 renderer/gles 中使用 GLES API 实现)

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 5 commits November 25, 2025 12:38
Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
…r pass management

Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
…onTransparentsRenderPass

Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
…ting logic

Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
…mplementation

Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor RHI in renderer to use WebGPU for render passes Refactor renderer RHI with WebGPU-style RenderPass management Nov 25, 2025
Copilot AI requested a review from yorkie November 25, 2025 12:57
Copilot finished work on behalf of yorkie November 25, 2025 12:57
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.

2 participants