Closed Bug 843673 Opened 11 years ago Closed 10 years ago

Implement WebGL ANGLE_instanced_arrays

Categories

(Core :: Graphics: CanvasWebGL, defect)

x86_64
Windows 8
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla33

People

(Reporter: vlad, Assigned: jgilbert)

Details

(Whiteboard: webgl-next)

Attachments

(1 file, 1 obsolete file)

Whiteboard: webgl-ext
Whiteboard: webgl-ext → webgl-next
Note that The share of ANGLE_instanced_arrays is very low for Firefox on Windows overall. Chrome reaches 78% but Firefox reaches 0.1%. Source: http://webglstats.com/
It's disabled. There's another bug about this somewhere.
Seems like IE11 is going to have it soon, it's in the developer channel: http://msdn.microsoft.com/en-us/library/ie/dn725046%28v=vs.85%29.aspx
Any news on this? The extension works fine on Firefox/OSX and Chrome/Windows, but isn't present on Firefox/Windows. I think instancing is quite essential on WebGL because of the high 
single-draw-call overhead (I get a >10x speedup for instanced vs non-instanced, and the only limit there
seems to be the dynamic vertex buffer upload each frame).
(In reply to Andre Weissflog from comment #4)
> Any news on this? The extension works fine on Firefox/OSX and
> Chrome/Windows, but isn't present on Firefox/Windows. I think instancing is
> quite essential on WebGL because of the high 
> single-draw-call overhead (I get a >10x speedup for instanced vs
> non-instanced, and the only limit there
> seems to be the dynamic vertex buffer upload each frame).

It was disabled because the version of ANGLE we were using had a broken implementation. We just updated ANGLE so we should be able to check and re-enable this extension.
Assignee: nobody → jgilbert
Here's a demo for testing, this computes dynamic position on the CPU and writes them to a dynamic buffer (1 update per frame via buffer orphaning), and then does a single instanced draw call:

http://floooh.github.io/oryol/Instancing.html

There are also PNaCl versions of the same demos, and a similar non-instanced demo on this page:

http://floooh.github.io/oryol/

There's also a demo from Brandon Jones: 

http://blog.tojicode.com/2013/07/webgl-instancing-with.html

Cheers!
-Floh.
Attached patch enable-instanced (obsolete) — Splinter Review
Attachment #8454187 - Flags: review?(dglastonbury)
Comment on attachment 8454187 [details] [diff] [review]
enable-instanced

Review of attachment 8454187 [details] [diff] [review]:
-----------------------------------------------------------------

LTGM

::: content/canvas/src/WebGLContextDraw.cpp
@@ +452,5 @@
>          } else {
> +            CheckedUint32 checked_curMaxInstances = checked_maxAllowedCount * vd.divisor;
> +            uint32_t curMaxInstances = UINT32_MAX;
> +            if (checked_curMaxInstances.isValid()) {
> +              curMaxInstances = checked_curMaxInstances.value();

Stylistically, how about?

uint32_t curMaxInstances = (checked_curMaxInstances.isValid()) ? checked_curMaxInstances.value() : UINT32_MAX;

But, ugh, that is long.
Attachment #8454187 - Flags: review?(dglastonbury) → review+
Attached patch enable-instancedSplinter Review
r=kamidphish
I added a comment about why we leave it as UINT32_MAX when we overflow.
Attachment #8454187 - Attachment is obsolete: true
Attachment #8454198 - Flags: review+
Keywords: checkin-needed
Do you have a Try link handy for this? :)
Keywords: checkin-needed
(In reply to Ryan VanderMeulen [:RyanVM UTC-4] from comment #10)
> Do you have a Try link handy for this? :)

It's plugging along at:
https://tbpl.mozilla.org/?tree=Try&rev=bb0c0dcab04d

Windows M1 is the main thing to watch for, and those haven't even started yet.
Flags: needinfo?(jgilbert)
Flags: needinfo?(jgilbert)
https://hg.mozilla.org/mozilla-central/rev/5e10f0ff108f
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
When is this supposed to show up in Nightly? It doesn's seem to be in "33.0a1 (2014-07-13)" yet.
Yay, it's in, thanks! :)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: