Skip to content

TSL: Mismatched type assignment from pass texture on WebGL fallback #31759

@shotamatsuda

Description

@shotamatsuda

Description

Using WebGPURenderer with WebGLBackend, sampling a depth pass texture using TextureNode.load() attempts to assign a vec4 value to a float variable, resulting in a compilation error. This doesn't reproduce when using TextureNode.sample().

Reproduction steps

  1. Render a scene using PassNode.
  2. Sample the depth texture using TextureNode.load().

Code

const renderer = new WebGPURenderer({ forceWebGL: true })
await renderer.init()

const passNode = pass(scene, camera)
const depthNode = passNode.getTextureNode('depth')

// This will be transpiled to:
//   float nodeVar0;
//   nodeVar0 = texelFetch( nodeUniform0, ..., 0 );
// Expected:
//   float nodeVar0;
//   nodeVar0 = texelFetch( nodeUniform0, ..., 0 ).x;
const outputNode = depthNode.load(ivec2(0, 0))

const material = new NodeMaterial()
material.fragmentNode = outputNode
const mesh = new QuadMesh(material)
mesh.render(renderer)

Live example

https://jsfiddle.net/shotamatsuda/r7ms2wfk/
(See errors in the console output)

Screenshots

No response

Version

r179

Device

Desktop

Browser

Chrome

OS

MacOS

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions