-
Notifications
You must be signed in to change notification settings - Fork 3
Add WebGPU backend to support the record/submit draw calls on render textures #94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 adds WebGPU backend support to the graphics system by implementing infrastructure for recording and submitting draw calls on render textures. The changes focus on introducing a new RHI abstraction layer, refactoring the existing OpenGL code, and implementing WebGPU command buffer patterns.
Key changes:
- Introduces TrRenderHardwareInterface (RHI) abstraction to replace the existing RenderAPI system, providing better support for multiple graphics backends including WebGPU
- Implements GPU command buffer infrastructure with WebGPU-style command encoders, render pass encoders, and command execution patterns
- Refactors rendering pipeline to support multiple execution passes (default frame, XR frame, offscreen pass) and improved context management
Reviewed Changes
Copilot reviewed 88 out of 89 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/renderer/render_api.hpp/cpp | Core RHI abstraction layer replacing RenderAPI with factory pattern |
| src/renderer/gles/* | OpenGL ES implementation of GPU command buffer system |
| src/renderer/renderer.hpp/cpp | Updated renderer to use RHI and support multiple rendering passes |
| src/renderer/content_renderer.hpp/cpp | Enhanced content renderer with offscreen pass support |
| src/common/command_buffers/gpu/* | New WebGPU-style command buffer infrastructure |
| src/common/command_buffers/details/* | Updated command buffer requests with copy constructors |
Comments suppressed due to low confidence (1)
src/runtime/unity_entry.cpp
Outdated
| if (__system_property_get("jsar.renderer.clear_stencil", disableStencilClearStr) >= 0) | ||
| { | ||
| if (strcmp(disableStencilClearStr, "no") == 0 || | ||
| strcmp(disableStencilClearStr, "disable")) |
Copilot
AI
Jul 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing equality comparison operator in the second strcmp call. Should be strcmp(disableStencilClearStr, "disable") == 0 to properly check if the string equals "disable".
| strcmp(disableStencilClearStr, "disable")) | |
| strcmp(disableStencilClearStr, "disable") == 0) |
| GL_TEXTURE_INTERNAL_FORMAT, | ||
| &attachment_object->texture_internal_format_); | ||
| GLenum textarget = attachment_object->texture_target_; | ||
| glGetIntegerv(textarget, ¤t_texture_binding); |
Copilot
AI
Jul 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect use of glGetIntegerv with texture target. Should use the appropriate binding constant like GL_TEXTURE_BINDING_2D instead of the texture target enum directly.
| glGetIntegerv(textarget, ¤t_texture_binding); | |
| GLenum binding_constant = 0; | |
| if (textarget == GL_TEXTURE_2D) | |
| binding_constant = GL_TEXTURE_BINDING_2D; | |
| else if (textarget == GL_TEXTURE_2D_ARRAY) | |
| binding_constant = GL_TEXTURE_BINDING_2D_ARRAY; | |
| else if (textarget == GL_TEXTURE_2D_MULTISAMPLE) | |
| binding_constant = GL_TEXTURE_BINDING_2D_MULTISAMPLE; | |
| else | |
| assert(false && "Unsupported texture target."); | |
| glGetIntegerv(binding_constant, ¤t_texture_binding); |
src/renderer/gles/context_app.cpp
Outdated
| return *contentRenderer; | ||
| } | ||
|
|
||
| bool ContextGLApp::shouleExecuteDrawOnCurrent(GLsizei count) |
Copilot
AI
Jul 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in method name: 'shouleExecuteDrawOnCurrent' should be 'shouldExecuteDrawOnCurrent'.
| bool ContextGLApp::shouleExecuteDrawOnCurrent(GLsizei count) | |
| bool ContextGLApp::shouldExecuteDrawOnCurrent(GLsizei count) |
No description provided.