Is GL_EXT_draw_instanced supported in WebGL1 - webgl

I want to add instancing to my WebGL application, which works fine using gl_InstanceID for devices running WebGL2. However, I want to also support older devices running WebGL1 - apparently this is available as an extension for OpenGLES2.0 (see here):
#extension GL_EXT_draw_instanced : enable
#define gl_InstanceID gl_InstanceIDEXT
However, it doesn't look like WebGL1 supports this extension (at least not on the devices I've tested with). Is the list at MDN the canonical list? Is there another way to support instancing for WebGL? I found this thread that has someone offering an implementation, but unfortunately the links are dead.

The official canonical list for WebGL extensions can be found here:
https://registry.khronos.org/webgl/extensions/
WebGL1 does support instancing through the ANGLE_instanced_arrays extension (MDN page). It has the same functionality and API(postfixed with ANGLE) as the WebGL2 default functionality, however GLSL ES 1.0 does not support gl_InstanceID so you'll have to implement a work around if you require it.

Related

No support for OES_texture_float, but WebGL2 is available

I've been surprised to find out that my Android phone does not support OES_texture_float extension, but fully supports WebGL2, which has floating texture functionality as baseline. What could cause the lack of their support in WebGL1, and is there any way around it, besides emulating float textures in shaders or migrating everything to WebGL2 (which would require a massive rewrite of everything to support both options)?
Edit: it seems the answer to WebGL: Declining support for OES_texture_float on Android covers part of this question, though it seems strange that they expect us to move to WebGL2 which requires a lot of work to maintain backwards compatibility.

Opengl ES 3.1+ support on iOS through Vulkan wrapper

Now that a Vulkan to Metal wrapper is officially supported by Khronos (MoltenVK), and that OpenGL to Vulkan wrappers began to appear (glo), would it be technically possible to use OpenGL ES 3.1 or even 3.2 (so even with support to OpenGL compute shaders) on modern iOS versions/HW by chaining these two technologies? Has anybody tried this combination?
I'm not much interested in the performance drop (that would obviously be there due to the two additional layers of abstraction), but only on the enabling factor and cross-platform aspect of the solution.
In theory, yes :).
MoltenVK doesn't support every bit of Vulkan (see the Vulkan Portable Subset section), and some of those features might be required by OpenGL ES 3.1. Triangle fans are an obvious one, full texture swizzle is another. MoltenVK has focused on things that could translate directly; if the ES-on-Vulkan translator was willing to accept extra overhead, it could fake some or all of these features.
The core ANGLE team is working on both OpenGL ES 3.1 support and a Vulkan backend, according to their README and recent commits. They have a history of emulating features (like triangle fans) needed by ES that weren't available in D3D.

WebGL Compute Shader and VBO/UBO's

AFAIK is the compute shader model very limited in WebGL. The documentation on this is even less. I have a hard time to find any answers to my questions.
Is there a possibility to execute a compute shader on one or multiple VBO/UBO's and alter their values?
Update: On April 9 2019, the Khronos group released the a draft standard for compute shaders in WebGL 2.
Original answer:
In this press release, the Khronos group stated that they are working on an extension to WebGL 2 to allow for compute shaders:
What’s next? An extension to WebGL 2.0 providing compute shader support is under development, which will bring many leading-edge graphics algorithms to the web. Khronos is also beginning work on the next generation of WebGL, to bring the enhanced performance of the new generation of explicit 3D APIs to the web. Stay tuned for more news!
Your best bet is to wait about a year or two for it to happen on a limited number of GPU + browser combination.
2022 UPDATE
It has been declared here (in red) that the WebGL 2.0 Compute specification has instead been moved into the new WebGPU spec and is deprecated for WebGL 2.0.
WebGPU has nowhere near global coverage across browsers yet, whereas WebGL 2.0 reached global coverage as of Feb 2022. WebGL 2.0 Compute is implemented only in Google Chrome (Windows, Linux) and Microsoft Edge Insider Channels and will not be implemented elsewhere.
This is obviously a severe limitation for those wanting compute capability on the web. But it is still possible to do informal compute using other methods, such as using regular graphics shaders + the expanded input and output buffer functionalities supplied by WebGL 2.0.
I would recommend Amanda Ghassaei's gpu-io for this. It does all the work for you in wrapping regular GL calls to give compute capability that "just works" (in either WebGL or WebGL 2.0).

What is the difference between prefixes of WebGL extensions

What is the difference between prefixes of WebGL extensions?
There is several prefixes for WebGL extensions like ANGLE , OES , WEBGL or EXT. What is actual difference between them?
Taken from here.
WebGL API extensions may derive from many sources, and the naming of
each extension reflects its origin and intent.
More about each tags:
ANGLE tag should be used if Angle library is used.
OES tag should be used for mirroring functionality from OpenGL ES or
OpenGL API extensions approved by the respective architecture review
boards.
EXT tag should be used or mirroring other OpenGL ES or OpenGL API
extensions. If only small differences in behavior compared to OpenGL
ES or OpenGL are specified for a given extension, the original tag
should be maintained.
WEBGL tag should be used for WebGL-specific extensions which are
intended to be compatible with multiple web browsers. It should also
be used for extensions which originated with the OpenGL ES or OpenGL
APIs, but whose behavior has been significantly altered.

Is it possible to run #version 120 shaders with WebGL

I have a number of GLSL fragment shaders for which I can pretty much guarantee that they conform to #version 120 They use standard, non-ES conformant values and they do not have any ES-specific pragmas.
I really want to make a web previewer for them using WebGL. The previewer won't be used on mobile. Is this feasible? Is the feature set exposed to GLSL shaders in WebGL restricted compared to that GLSL version? Are there precision differences?
I've already tried playing with THREE.js but that doesn't really rub it since it mucks up my shader code before loading it onto the GPU (which I cannot do).
In short: is the GLSL spec sufficient for me to run those shaders?.. because if it isn't what I am after is not doable and I should just drop it.
No, WebGL shaders must be version #100. Anything else is disallowed.
If you're curious why it's because, as much as possible, WebGL needs to run everywhere. If you could choose any version your web page would only run on systems with GPUs/Drivers that handled that version.
The next version of WebGL will raise the version number. It will allow GLSL ES 3.0 (note the ES). It's currently available behind a flag in Chrome and Firefox as of May 2016

Resources