jamienicol / glsl-optimizer

GLSL optimizer based on Mesa's GLSL compiler. Used in Unity for mobile shader optimization.
Other
9 stars 8 forks source link

Merge mesa 20.1.3 #2

Closed jamienicol closed 4 years ago

jamienicol commented 4 years ago

@lsalzman thought it might be easier to review this here, rather than in the phabricator commit which just revendors all the files with no context.

A quick primer on how glsl-optimizer works to help you out:

The first commit merges the new release. (Not expecting you to review all of the upstream commits!) Thankfully there were no conflicts in the files modified by both the optimizer and upstream. There were lots of conflicts due to upstream modifications in files from non-compiler parts of mesa, which had previously been deleted from the optimizer. I resolved these by deleting them again. Some files which had previously been deleted had to be restored because upstream modified files now depend on them (eg util files).

The second commit regenerates some files which are generated at build time in mesa. But we don't want to depend on flex, bison, or python during build.

The third commit fixes the build, and runs an optimization pass manually which mesa had done automatically prior the new release. Here is the mesa change which forced that change, for reference. The consequence of not making that change would be that builtin functions (eg max()) would not be inlined, and the shader would then fail to link.

The fourth commit changes how we translate from an IR opcode to a glsl string, to make it less brittle.

The last two are fairly self explanatory.

Let me know if you have any questions!

lsalzman commented 4 years ago

Looks good to me