# WebGPU render target texture TSL error

**URL:** <https://discourse.threejs.org/t/webgpu-render-target-texture-tsl-error/86565>\
**Category:** Questions\
**Tags:** compute-shaders, tsl, webgpu\
**Created:** [August 27, 2025, 6:20pm UTC](https://discourse.threejs.org/t/webgpu-render-target-texture-tsl-error/86565 "2025-08-27T18:20:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![playbyan1453](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/playbyan1453/32/35853_2.png) [@playbyan1453](https://discourse.threejs.org/u/playbyan1453)\
**Post date:** [August 27, 2025, 6:20pm UTC](https://discourse.threejs.org/t/webgpu-render-target-texture-tsl-error/86565/1 "2025-08-27T18:20:13Z")

</div>

Hi I am using three.js r179.1 and using WebGPU to create a hobby project working around virtual texture system, while implementing I encountered a issue where my value passed to the TSL compiler it seems the value was changed to my sampler node. Image below was normal expected value.

 ![value passing to tsl](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/a/c/ac659859f4595a2d7dc80e3c32a2f01e1e1dc519.png)

In here the value seems way different, it is not a texture but rather the sampler instead of the texture node.

 ![value in the tsl setup](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/b/d/bd0f2b0962e3492d60709e76e9dce217cc538d2f.png)

Instead it builds the texture node using sampler’s input.

```javascript
this.uvSamp = sampler({
  filter: THREE.LinearFilter,
  wrapS: THREE.RepeatWrapping,
  wrapT: THREE.RepeatWrapping
});

```

The value passed here is this:

![value inside the tsl builder](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/0/2/0254a8def490353ebceb90cba5a3551c29fecafa.png)

Here is my snippet:

```javascript
import * as THREE from 'three/webgpu';
import {
  storage, texture, uniform, globalId,
  uint, float, vec2, vec4, uv, sampler, wgslFn, code
} from 'three/tsl';

export class FeedbackPass {
  constructor(opts) {
    this.renderer = opts.renderer;
    this.mesh = opts.mesh;
    this.pageTable = opts.pageTable;

    const m = opts.manifest;
    this.vW = (m.virtualWidth|0) >>> 0;
    this.vH = (m.virtualHeight|0) >>> 0;
    this.tile = (m.tileSize|0) >>> 0;
    this.mips = (m.mipCount|0) >>> 0;

    this.res = (opts.res|0) || 512;
    this.everyN = (opts.everyN|0) || 8;
    this.lodBias = Number.isFinite(opts.lodBias) ? opts.lodBias : 0.0;

    // ---- A) UV capture target ----
    this.rt = new THREE.RenderTarget(this.res, this.res, { depthBuffer: false, stencilBuffer: false });
    this.rt.texture.name = 'vt_uv_rt';

    // uniforms & nodes
    this.uVW = uint(this.vW);
    this.uVH = uint(this.vH);
    this.uTile = uint(this.tile);
    this.uMipC = uint(this.mips);
    this.uBias = float(this.lodBias);
    this.uRes = uint(this.res);

    // This is the line that causes the TSL error.
    this.uvTexNode = texture(this.rt.texture); 
    this.uvSamp = sampler({
      filter: THREE.LinearFilter,
      wrapS: THREE.RepeatWrapping,
      wrapT: THREE.RepeatWrapping
    });

    // ---- C) Compute kernel ----
    const kernel = wgslFn(`
      fn kernel(
        uvTex : texture_2d<f32>,
        uvSamp : sampler,
        bits_in : ptr<storage, array<u32>, read_write>,
        vW : u32,
        vH : u32,
        tile : u32,
        mipCount : u32,
        bias : f32,
        res : u32,
        gid : vec3<u32>
      ) -> void {
        // ... (rest of the kernel code)
      }
    `, [...]);

    this.kernelNode = kernel(
      this.uvTexNode,
      this.uvSamp,
      this.bitsNode,
      this.uVW,
      this.uVH,
      this.uTile,
      this.uMipC,
      this.uBias,
      this.uRes,
      globalId
    ).compute(this.res * this.res);

  }
}

```

Maybe I could do some jsfiddle using Gemini, sorta like this. The error dumps only happened if I call dispatch of the compute shader, but when debugging it errors out but not showing up on console.

---

<div class="post-metadata">

**Author:** ![playbyan1453](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/playbyan1453/32/35853_2.png) [@playbyan1453](https://discourse.threejs.org/u/playbyan1453)\
**Post date:** [August 28, 2025, 9:52am UTC](https://discourse.threejs.org/t/webgpu-render-target-texture-tsl-error/86565/2 "2025-08-28T09:52:03Z")

</div>

![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/3/1/31befbcaf089730dbc9342abc0915afdfa51f884.png)

I found [this](https://github.com/mrdoob/three.js/blob/cf60b969c46b0b27e1262b1e24dff908480a89cf/examples/webgpu_tsl_interoperability.html) example and changed my code correspondingly, and works normaly later.

---

<div class="post-metadata">

**Author:** ![cmhhelgeson](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/cmhhelgeson/32/47626_2.png) [@cmhhelgeson](https://discourse.threejs.org/u/cmhhelgeson)\
**Post date:** [August 28, 2025, 11:19pm UTC](https://discourse.threejs.org/t/webgpu-render-target-texture-tsl-error/86565/3 "2025-08-28T23:19:41Z")

</div>

Glad you found the example useful 👍
