Skip to content

Add support for WebGL2 #114

@vorg

Description

@vorg

To make this transition manageable i propose following steps

  • update this repo to ESM
  • port VAO (Add VAO support #85) from 85-vao-temp branch
  • decide on UBO support class/object
  • decouple shader stage parameters from source so we can generate GLSL100 and GLSL300 source code depending on WebGL version
//pex-context@2 for webgl1
ctx.pipeline({
  frag: `....`
})

//pex-context@3 for webgl1/2
ctx.pipeline({
  extensions: [],
  uniforms: [],
  vert: {
    ins: [],
    outs: [],
    src: []
  },
  frag: {    
     outs: []
     src: ``
  }
})

//or more webgl-y
ctx.pipeline({
  extensions: [],
  uniforms: [],
  attributes: [],
  varyings: [],
  outs: [],
  vert: src,
  frag: src
})

The questions is why would we need that?

  • to run on iOS < 15 devices with no WebGL 2 (apparently still about 40% as of 2022-Q1)
  • to ease pain of porting every single PBR/MRT shader as they use extension that is built-in in WebGL2 (draw buffers, derivatives etc)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions