vtkShaderProperty::AddFragmentShaderReplacement behaves differently in WebAssembly (VTK 9.5.2) compared to native OpenGL

Hi,

I use vtkShaderProperty::AddFragmentShaderReplacement() to modify the fragment shader.

The following shader replacement works correctly in the native OpenGL build, the actor is red. But it has no visible effect in a WebAssembly/WebGL2 build. The actor itself is rendered correctly in both builds.
The shader replacement is installed without compile or runtime errors.

auto shaderProperty =

actor->GetShaderProperty();

shaderProperty->AddFragmentShaderReplacement(
“//VTK::Light::Impl”,
false,
R"glsl(
//VTK::Light::Impl
fragOutput0.rgb =
vec3(1.0, 0.0, 0.0);
)glsl",
false);

Expected Result:

Both builds render the actor completely red.

Actual Result

Native OpenGL

The actor becomes red as expected.

WebAssembly / WebGL2

The actor keeps its original color.

The replacement appears to have no visible effect.

Environment:

VTK Version: 9.5.2

Native:

- Windows 11

- RenderingOpenGL2

- MSVC 2022

Web:

- Emscripten

- WebGL2

- VTK built from source

VTK configuration:

VTK_ENABLE_WEBGPU=OFF

VTK_OPENGL_HAS_EGL=OFF

VTK_OPENGL_USE_GLES=ON

VTK_MODULE_ENABLE_VTK_RenderingOpenGL2=DEFAULT

VTK_WEBASSEMBLY_64_BIT=OFF