-
Notifications
You must be signed in to change notification settings - Fork 3
Implement WebGL2 framebufferTextureLayer for layered texture rendering #417
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
- Add FRAMEBUFFER_TEXTURE_LAYER command buffer request to macros - Implement FramebufferTextureLayerCommandBufferRequest class - Implement framebufferTextureLayer C++ backend method - Add JavaScript binding for framebufferTextureLayer - Add OpenGL renderer handler for framebufferTextureLayer - Pass C++ formatting checks Co-authored-by: EndlessJour9527 <155411404+EndlessJour9527@users.noreply.github.com>
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 implements the missing WebGL2 framebufferTextureLayer API, which allows rendering to specific layers of 3D textures and texture arrays. The implementation follows established patterns in the codebase and correctly threads the functionality from JavaScript bindings through the command buffer system to the OpenGL backend.
- Adds command buffer infrastructure for
FRAMEBUFFER_TEXTURE_LAYERrequests - Implements JavaScript binding with proper argument validation for all 5 parameters
- Routes calls to OpenGL via
glFramebufferTextureLayerin the rendering backend
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/common/command_buffers/shared.hpp | Adds COMMAND_BUFFER_FRAMEBUFFER_TEXTURE_LAYER_REQ enum constant for the new command type |
| src/common/command_buffers/macros.hpp | Registers the FRAMEBUFFER_TEXTURE_LAYER command buffer macro with class name and debug label |
| src/common/command_buffers/details/buffer.hpp | Defines FramebufferTextureLayerCommandBufferRequest class with 5 parameters (target, attachment, texture, level, layer) |
| src/renderer/render_api_opengles.cpp | Implements OnFramebufferTextureLayer handler that extracts texture ID from object manager and calls glFramebufferTextureLayer |
| src/client/script_bindings/webgl/webgl2_rendering_context.hpp | Declares FramebufferTextureLayer method in WebGL2RenderingContext class |
| src/client/script_bindings/webgl/webgl2_rendering_context.cpp | Implements JavaScript binding with comprehensive argument validation and WebGLTexture null handling |
| src/client/graphics/webgl_context.cpp | Creates and sends command buffer request, replacing NOT_IMPLEMENTED() stub |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
WebGL2 contexts were throwing
TypeError: gl.framebufferTextureLayer is not a functiondue to missing implementation. This blocked rendering to texture array layers and 3D texture slices, breaking WebGL2 conformance.Changes
Command buffer infrastructure
FRAMEBUFFER_TEXTURE_LAYERrequest type to command buffer macrosFramebufferTextureLayerCommandBufferRequestclass (target, attachment, texture, level, layer)Backend implementation
NOT_IMPLEMENTED()stub inWebGL2Context::framebufferTextureLayerglFramebufferTextureLayer(target, attachment, texture, level, layer)JavaScript bindings
framebufferTextureLayermethod onWebGL2RenderingContextUsage
Enables rendering to
GL_TEXTURE_2D_ARRAYandGL_TEXTURE_3Dlayers per WebGL 2.0 §5.19.8.case
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.