Open-sourcing the Microsoft Edge WebGL GLSL transpiler

Windows

Windows
Today we’re excited to announce that we’re open-sourcing part of the Microsoft Edge WebGL renderer – specifically, the GLSL to HLSL transpiler. We hope that the source code is useful for everybody working on similar WebGL projects, and that this will help performance, correctness and interoperability of WebGL.

You can find the code on the
Please, Log in or Register to view URLs content!
.

What is a GLSL::HLSL transpiler?


WebGL web pages run ‘programs’ (shaders) on your
Please, Log in or Register to view URLs content!
to render 3D content; these programs are written in the
Please, Log in or Register to view URLs content!
shading language. Microsoft Edge uses the
Please, Log in or Register to view URLs content!
(and HLSL, a different Windows-specific shading language) to render content.

Microsoft Edge converts WebGL content to DirectX equivalents to display it; the WebGL renderer converts WebGL calls into DirectX equivalents, and the transpiler converts GLSL shaders to HLSL shaders.

The
Please, Log in or Register to view URLs content!
– as used in Chrome and Firefox – has similar functionality.

As an example of this conversion, here’s a super-simple program that paints a red pixel:

GLSL:



void main()

{

gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); // r g b a

}

HLSL:



float4 main() : SV_Target

{

return float4(1.0f, 0.0f, 0.0f, 1); // r g b a

}


The transpiler (like any compiler) parses the GLSL program, checks for correctness and security constraints, and applies a
Please, Log in or Register to view URLs content!
to produce HLSL output.

What’s next?


We do plan to publish additional scripts and documentation over time. By making a first drop of the source available right away, we are immediately enabling engineers working on other WebGL / OpenGL / 3D implementations to inspect the code and improve interoperability across browsers.

Why just the transpiler?


The HLSL to GLSL transpiler is the most critical component of the WebGL stack from an interoperability perspective, so we started with that. We expect it to be the most interesting for the specialized audience of engineers who maintain WebGL implementations on different platforms. We may expand the scope of the release to other sub-components over time.

Does this mean you’re open-sourcing Microsoft Edge?


One natural question following this announcement is whether this signals a move to open-source more of Microsoft Edge. At this time we have no plans to open source Microsoft Edge or EdgeHTML, but we understand and value the importance of being more open with our roadmap and our core technologies.

Today’s announcement builds on our recent
Please, Log in or Register to view URLs content!
, as well as initiatives like our open roadmap on
Please, Log in or Register to view URLs content!
. We continue to be committed to even more transparency with the engineering of Microsoft Edge in the future.

We’re excited about this step to improve interoperability across WebGL implementations, and we look forward to seeing your feedback on and contributions to this good.
Please, Log in or Register to view URLs content!
!

Please, Log in or Register to view URLs content!
, Principal Program Manager Lead

Please, Log in or Register to view URLs content!
 

Users who are viewing this thread

Top