Skip to content

WebGPU: Resizing RenderTarget3D converts its texture from texture_3d to texture_2d_array #31693

@shotamatsuda

Description

@shotamatsuda

Description

Resizing RenderTarget3D sets the isArrayTexture flag on its texture, and subsequent calls to textureSample on it cannot resolve overloaded functions. Manually setting isArrayTexture to false after resizing works around this issue.

Reproduction steps

  1. Resize a RenderTarget3D using setSize().
  2. Build a new node to sample its texture with texture3D and a vec3.
  3. Open the developer console and see the error message: no matching call to 'textureSample(texture_2d_array<f32>, sampler, vec3<f32>)'.

Code

material.fragmentNode = texture3D(renderTarget.texture).sample(vec3(0, 0, 0))
material.needsUpdate = true
void renderer.render(scene, camera)

// Resize the render target:
renderTarget.setSize(11, 11, 11)

material.fragmentNode = texture3D(renderTarget.texture).sample(vec3(0, 0, 0))
material.needsUpdate = true
void renderer.render(scene, camera)

See also the fiddle below.

Live example

https://jsfiddle.net/shotamatsuda/fpvz0Lbm/

Screenshots

No response

Version

r179

Device

Desktop

Browser

Chrome

OS

Windows, MacOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions