
Microsoft Edge WebGL engine open-sourced - aroman
https://github.com/MicrosoftEdge/WebGL
======
rossy
Well, that's interesting. The state of desktop OpenGL on Windows is pretty
awful at the moment. The antiquated WGL APIs make it difficult to control when
your application enters exclusive fullscreen mode, and as far as I know, it's
impossible to control latency or get any kind of presentation feedback with
them. You also can't make UWP apps that use WGL. Google's ANGLE, which is used
to implement WebGL in Chrome and Firefox, is a lot better, and it lets you do
fancy things like render OpenGL ES content to a D3D11 texture or to a
DirectComposition surface. If Microsoft open-source Edge's WebGL engine
(currently it seems like only the GLSL->HLSL translator is open-sourced,) it
could become another modern way of using GLES on Windows.

Source: We rely on OpenGL to render video in mpv, and we are currently
switching from using a WGL context by default to using ANGLE. Maybe this could
be a third option?

~~~
MikusR
So this is false? [https://msdn.microsoft.com/en-
us/library/windows/apps/dn4409...](https://msdn.microsoft.com/en-
us/library/windows/apps/dn440963.aspx)

~~~
rossy
Well, that would use a WebGL canvas and Edge's GLES renderer, not WGL and
desktop GL. (WGL refers to Microsoft's equivalent of GLX and EGL here, not
WebGL.)

~~~
pjmlp
So what is preventing you to use Microsoft's port of Angle?

[https://blogs.windows.com/buildingapps/2015/08/04/angle-
for-...](https://blogs.windows.com/buildingapps/2015/08/04/angle-for-windows-
now-available-on-nuget/)

~~~
rossy
Presumably nothing, if I was writing a UWP app. All I said was that WGL didn't
work in UWP apps, not that there wasn't any alternatives.

It's actually pretty interesting that Microsoft maintain a fork of ANGLE for
this purpose when they have their own GLES implementation in Edge. I guess
(before now) it was easier for them to modify ANGLE than to open-source their
own work.

------
tracker1
Wow, 45 upvotes and no comments...

While I'm not entirely sure what the strategy is with this, I'm fairly
surprised by the move. This is something that would have been unheard of from
Microsoft even a decade ago. They've made a bunch of really huge strides in
FLOSS, but they've all been centered around developer mindshare. I totally get
open-sourcing your developer tooling, especially in consideration of their
Azure ambitions, which isn't bad.

I really like VS Code, which has become my daily editor of choice, I keep
meaning to try the integrated debugging, but haven't. The .Net core releases
have me looking at C# again, in a fairly new light. The Linux Subsystem for
Windows is impressive.

All of that said, this move still surprises me. I'm not sure if/how much it
will benefit the larger developer community, but it is really nice to see a
much more open MS. All I can say is that the next half decade will be
particularly interesting in terms of software improvements as hardware has
started to level off.

~~~
fenomas
Having seen a tiny little slice of the requirements of open-sourcing code at a
(different) Big Software company, I really hope people give MS and other
companies their deserved props for stuff like this.

As a 3rd party it's very easy to think "oh they should just release the source
for X and if they don't it's because they don't want to", but if X is big and
it didn't start out public, it usually takes a pretty herculean effort to get
it released, often meaning someone burnt a lot of capital (of whatever sort)
to make it happen.

~~~
SwellJoe
I believe it will pay dividends for Microsoft that they're being more
encouraging of this kind of thing. There's a few reasons so many of the best
developers work at Google (for example), and one of them is that Google opens
a lot of stuff, and actively encourages open development. I, personally,
wouldn't work anywhere where I couldn't contribute to Open Source communities
at least part of my work day.

Microsoft knows how important developers are for a platform company, both
inside and outside of the company (as evidenced by very good salaries, real
offices, etc.). I just think it took them a few years to notice that one of
the things good developers value is community. Now that they've figured it
out, they've begun making changes. If you'd asked me 10-20 years ago, "Hey,
would you ever consider working for Microsoft", I would have laughed. Today,
I'd probably still say no, but I wouldn't laugh, and I'd probably even think
about it for a minute or two.

~~~
fenomas
> I wouldn't work anywhere where I couldn't contribute to Open Source
> communities

Okay, but note that that's not at all what my comment was about. Contributing
new code to an open project isn't a hard problem, in any company I'm familiar
with, but taking a large closed project that your company wholly owns, and
getting it released as MIT is a different matter.

Even if the project was begun under the assumption it would be opened someday
(as I imagine may have been the case here), momentum is against it and it
tends not to happen unless someone is passionate about making sure it does.

~~~
praneshp
This is so true. When I worked at Yahoo, there were a couple of people
dedicated to helping people open source projects, and would help us make the
right choices (eg, don't open source for the sake of it, etc).

------
wtracy
The README says the code is published without any build scripts "for reference
only", so I expected this to be another "shared source" thing.

It turns out that the code is offered under the (very permissive) MIT license.
Cool.

------
haxiomic
This is great to have as a reference - the GLSL parser looks like a very
thorough implementation. Thanks!

We've recently produced a WebGL implementation on top of V8 (passing calls
through to OpenGL ES) - we needed it for a specific use case where a bundling
a complete browser wouldn't do. We're interested in open sourcing if it's
helpful to others - I'm curious to know if anyone else has a use case for an
embeddable WebGL implementation? (Ours was to run three.js on the GearVR)

------
greggman
What's more frustrating is that edge had been shipping for a while now with a
broken implementation of WebGL.

The conformance tests have been available for years and yet they haven't
bothered to pass them

[https://www.khronos.org/registry/webgl/sdk/tests/webgl-
confo...](https://www.khronos.org/registry/webgl/sdk/tests/webgl-conformance-
tests.html)

This makes devs have write nasty workarounds if they want WebGL apps to work
on Edge

~~~
ohyes
Reminds me of their approach to javascript.

------
microcolonel
By the way, this is not the whole WebGL implementation, just the shader
transpiler (GLSL to HLSL). Though it's good to see that their GLSL parser
isn't totally insane. Somebody really ought to check it for compliance though;
we really don't want to have yet another nonstandard shader compiler.

------
bobajeff
Hmmm, interesting choice to opensource just the WebGL engine without the rest
of the browser's layout engine.

~~~
arca_vorago
Embrace, extend, extinguish. I'm constantly surprised at how quickly people
forget the lessons of the 90s...

~~~
bigtones
Dude, it's 2016 - that was twenty years ago.

~~~
cyphar
Microsoft still acts unethically _today_. NT still has backdoors, almost their
entire stack is proprietary. Just because they have made some parts of what
they do free software doesn't turn them into the technological equivalent of
Jesus. Yes, I am happy that they are freeing some of the stuff they do, but
it's clear that they're doing it as a marketing move not because they care
about user freedom. So I don't see them ever making the whole stack free
software.

~~~
pjmlp
Have you seen the backdoors on Mac OS X, customized Android versions and every
other commercial OSes out there?

~~~
cyphar
> backdoors on Mac OS X

That's proprietary too, so sure. But why are you mentioning Apple in a thread
about Windows? I never said Apple was good either...

> customized Android versions

Android is mostly proprietary as well. Replicant is as close as you can get to
a free fork of Android.

> every other commercial OSes

s/commercial/proprietary/g

~~~
pjmlp
Because many HNers like to bash Microsoft, while at the same time give a white
pass the SV beloved companies, which happen to have similar practices.

------
Ezhik
I wonder when the entire browser is gonna get open-sourced.

------
mark_l_watson
Microsoft seems like a different company now.

Off topic, but I am a happy customer of Office 365. I use the web versions of
Word and Excel on my Linux laptops when people send me Office files. Works
fine. The one terabyte of cloud storage for each family member is nice also.

------
iLoch
Hmm this is very interesting... I was looking for exactly this so I could try
to hook up WebGL calls from canvas into HoloLens' 3D environment. Three.js
holograms :)

------
unique_parrot2
call me impressed when i can launch a mirrored copy of my windows ssd from an
usb stick without fuss. this is just peanuts.

------
coderdude
Microsoft is amazing. Top notch work across the board. Not all of their
initiatives are aligned with hacker ideology but they are hands down developer
friendly. Ballmer always made that important to know. I personally have the
utmost faith in them. Their development tools are unequaled.

~~~
bschwindHN
> they are hands down developer friendly

> Their development tools are unequaled

Have you ever done any cross-platform C++ programming? That might change your
opinion a bit.

~~~
coderdude
Because Visual Studio isn't on every platform yet? The answer to your question
is yes, btw. I spend most of my time in Ubuntu and I've also been forced to
get my own projects to compile on my MacBook. It sucks, if that's what you
were getting at. At least make a point.

~~~
bschwindHN
It's taken Visual Studio quite some time to get up to feature parity for
things like C++11/14/17\. A year or two ago was a super frustrating time to be
writing modern C++ that supported Windows. Oh, I can't use that feature here.
Oh, this networking API call is _slightly_ different from every other
platform. Oh, this same function exists but the Windows team changed the name
to be camel case instead of using underscores.

And if you're working on a cross-platform project, it's probably using CMake
or something similar. The development cycle of `cmake .. && make` is simple
and easy. As far as I could tell, Windows builds were not as straightforward.
It's been awhile so maybe they've improved it, but I would hardly call their
developer tools "unequaled"

I just want to install Clang in a straightforward manner, call the above-
mentioned `cmake .. && make`, and have an exe waiting for me. Is that possible
now? It wasn't in the past which is why I'm highly suspicious of your "hands
down developer friendly" comment. Windows always seems to be the platform that
has to do things slightly different, and has offered the most friction when
developing projects that run on OS X, Linux, and Windows.

EDIT: I would also like to add that most CI services offer at least G++ or
Clang++. AppVeyor seems to support Windows builds with MSVC but isn't free.
This is yet another hindrance to smooth cross-platform development.

~~~
coderdude
I laugh when you bring up compatibility issues because man have I grappled
with them, too. You won't hear me say they're on the bleeding edge of c++
standards. It's their IDE that compels me to speak on their behalf. I do get
what you're driving at, though.

~~~
bschwindHN
That's fair. I first used Visual Studio with C# and loved the debugger and
code refactoring tools. And I use it occasionally when logging statements just
aren't enough in C++.

So in that regard, yes their IDE is one of the best, but their platform sort
of diminishes the developer-friendliness of the whole experience when
developing on Windows.

I need to check out CLion again, haven't tried it since they released one of
the first versions.

------
abpavel
The title is misleading, as the first words on github are: "This repo contains
a select number of files". The title should say "Dump of some of the files".
Considering the state of popularity if the Edge, maybe even "reference on what
not to do"

~~~
NKCSS
That's a bit negative; it's the source for the WebGL implementation; rather
than wait X amount of time till they can do the 'proper' release; the source
is available to read, how can you be mad at that?

This is something Microsoft would never have done in the past, and I think we
should applaud the efforts that are being made.

Lastly; they are doing this to improve interoperability; give them some credit
for the effort.

~~~
eumoria
never underestimate nerd hate towards microsoft. they could open source
everything they have and give every person a free sex robot and people would
still find something to be pissed at them about

~~~
jaeh
just think about the fact that this sexrobot would show advertisements at
climax, clench it's teeth when updating (at the worst possible time...) and
generally chitchat about all of your kinks with the microsoft cloud.

worst sex partner of all times.

------
agnivade
lol, look at those enterprise type comments -

    
    
      //+----------------------------------------------------------------------------
      //
      //  Function:   GetDefaultInitValue
      //
      //  Synopsis:   Returns a string that contains the default HLSL value for
      //              the component of this type. Should not be called on sampler
      //              or void types, as there are no values to init with.
      //
      //------------------------------------------------------------------------

~~~
antoinealb
Actually this comment contains useful information such as validity domain
(should not be called on samplers or void types) and justification for this
domain (there are not values to init with).

Much better than the crap comments I see on a lot of projects such as "# does
this even work ? lol"

