Skip to content

Error when passing sampler2D array uniforms to shader #8032

@araid

Description

@araid

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • p5.strands
  • WebGL
  • DevOps, Build process, Unit testing
  • Internationalization (i18n)
  • Friendly Errors
  • Other (specify if possible)

p5.js version

1.11.10

Web browser and version

138.0.7204.184

Operating system

macOS

Steps to reproduce this

In GLSL #version 100 shaders, we should be able to pass an array of textures as uniform sampler2D textures[NUM_TEXTURES];. Right now, adding that line causes p5 to throw an error when calling unbindTextures.

Looking through p5.Shader, it seems like that kind of uniform is just not supported. For example, the gl.SAMPLER_2D uniform type is the only one that doesn't check for uniform.size in setUniform().

I haven't tested in p5 2.0 so I'm not sure if it's any different there.

Test sketch to repro: https://editor.p5js.org/araid/sketches/DkFW006mD

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions