ANGLE already does that: https://chromium.googlesource.com/angle/angle