Skip to content

Implement GLSL rendering for M420 and NV12#14913

Merged
Nir-Az merged 2 commits into
realsenseai:developmentfrom
Nir-Az:nir/nv12-platform-camera
Apr 9, 2026
Merged

Implement GLSL rendering for M420 and NV12#14913
Nir-Az merged 2 commits into
realsenseai:developmentfrom
Nir-Az:nir/nv12-platform-camera

Conversation

@Nir-Az

@Nir-Az Nir-Az commented Apr 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Implement working GLSL fragment shader for M420 format (was previously throwing "cannot be rendered with GLSL yet")
  • Add new NV12 GLSL renderer with full pipeline: shader, C/C++ API, dual processing block with CPU fallback
  • Add M420 and NV12 rendering cases to the viewer upload path
  • Remove M420 and NV12 from the "rendering not supported" list

Test plan

  • Verified NV12 GLSL rendering with platform camera — image displays correctly
  • Verified M420 GLSL rendering — image displays correctly
  • Confirmed GLSL shader is active by injecting deliberate color change
  • Verified CPU fallback works when GLSL for rendering is unchecked
  • Build passes on Windows (Debug)

M420 on D585S
image

NV12 on platform camera
image

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings April 9, 2026 12:17
Comment thread include/librealsense2-gl/rs_processing_gl.hpp
Comment thread src/gl/nv12-to-rgb-gl.cpp

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 GPU (GLSL) color conversion/rendering support for the M420 and NV12 formats in the RealSense GL pipeline, and wires the new capability through the public GL processing API and the viewer upload path.

Changes:

  • Implement GLSL fragment shader-based conversion for M420 and introduce a new NV12 GLSL converter with CPU fallback via dual_processing_block.
  • Expose an NV12 GL decoder in the C/C++ GL processing APIs and export it from the GL shared library.
  • Update the viewer/rendering upload path to handle M420 and NV12, and remove them from the “rendering not supported” list.

Reviewed changes

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

Show a summary per file
File Description
src/gl/rs-gl.cpp Adds rs2_gl_create_nv12_decoder and wires it into the GL processing-block factory with CPU fallback.
src/gl/realsense-gl.def Exports the new NV12 GL decoder symbol on Windows.
src/gl/nv12-to-rgb-gl.h Declares the new librealsense::gl::nv12_to_rgb GPU processing block.
src/gl/nv12-to-rgb-gl.cpp Implements the NV12 GLSL shader and processing block (texture upload + FBO render to RGB).
src/gl/m420-to-rgb-gl.cpp Replaces the prior “not supported” runtime error with a working GLSL shader path for M420.
src/gl/CMakeLists.txt Adds the new NV12 GL converter sources to the GL library build.
include/librealsense2-gl/rs_processing_gl.hpp Introduces rs2::gl::nv12_decoder C++ wrapper class.
include/librealsense2-gl/rs_processing_gl.h Adds the C API declaration for rs2_gl_create_nv12_decoder.
common/viewer.cpp Stops flagging M420/NV12 as “rendering not supported” in the viewer UI.
common/subdevice-model.cpp Switches NV12 conversion to use the new GL decoder wrapper.
common/rendering.h Adds M420 and NV12 handling to the texture upload/render path (using the processing blocks).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/gl/nv12-to-rgb-gl.cpp Outdated
Comment thread src/gl/m420-to-rgb-gl.cpp Outdated
@Nir-Az Nir-Az requested a review from OhadMeir April 9, 2026 12:29

@remibettan remibettan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

WD

@Nir-Az Nir-Az removed the request for review from OhadMeir April 9, 2026 13:05
@Nir-Az Nir-Az merged commit 2857459 into realsenseai:development Apr 9, 2026
28 of 29 checks passed
@Nir-Az Nir-Az deleted the nir/nv12-platform-camera branch April 9, 2026 13:06
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.

3 participants