glsl-optimizer | GLSL optimizer based on Mesa 's GLSL compiler

 by   aras-p C++ Version: Current License: Non-SPDX

kandi X-RAY | glsl-optimizer Summary

kandi X-RAY | glsl-optimizer Summary

glsl-optimizer is a C++ library. glsl-optimizer has no bugs, it has no vulnerabilities and it has medium support. However glsl-optimizer has a Non-SPDX License. You can download it from GitHub.

A C++ library that takes GLSL shaders, does some GPU-independent optimizations on them and outputs GLSL or Metal source back. Optimizations are function inlining, dead code removal, copy propagation, constant folding, constant propagation, arithmetic optimizations and so on. Apparently quite a few mobile platforms are pretty bad at optimizing shaders; and unfortunately they also lack offline shader compilers. So using a GLSL optimizer offline before can make the shader run much faster on a platform like that. See performance numbers in [this blog post] Even for drivers that have decent shader optimization, GLSL optimizer could be useful to just strip away dead code, make shaders smaller and do uniform/input reflection offline. Almost all actual code is [Mesa 3D’s GLSL] compiler; all this library does is spits out optimized GLSL or Metal back, and adds GLES type precision handling to the optimizer. This GLSL optimizer is made for [Unity’s] purposes and is built-in starting with Unity 3.0. GLSL Optimizer is licensed according to the terms of the MIT license. See [change log here] Changelog.md).
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              glsl-optimizer has a medium active ecosystem.
              It has 1626 star(s) with 419 fork(s). There are 117 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 41 open issues and 34 have been closed. On average issues are closed in 93 days. There are 10 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of glsl-optimizer is current.

            kandi-Quality Quality

              glsl-optimizer has 0 bugs and 0 code smells.

            kandi-Security Security

              glsl-optimizer has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              glsl-optimizer code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              glsl-optimizer has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              glsl-optimizer releases are not available. You will need to build from source code and install.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of glsl-optimizer
            Get all kandi verified functions for this library.

            glsl-optimizer Key Features

            No Key Features are available at this moment for glsl-optimizer.

            glsl-optimizer Examples and Code Snippets

            No Code Snippets are available at this moment for glsl-optimizer.

            Community Discussions

            QUESTION

            Is there a way to run the mesa compiler to reduce the size of shader files?
            Asked 2020-Jan-20 at 15:19

            The mesa drivers, as part of their compilation process, reduce the size of the glsl shader files.

            Some libraries, like this one, use this fact to create shader minification libraries. All minification libraries I have found are abandonware, so, unless mesa has functionality to get the intermediary glsl files directly, I may have to edit the actual code the way those libraries did it.

            I was wondering if there is an executable within the mesa code base that can be used to do the stripping without having to edit the code.

            I tried reading the official mesa documentation, but I didn't anything that suggests either way: https://www.mesa3d.org/opengles.html

            ...

            ANSWER

            Answered 2020-Jan-20 at 15:19

            "Minification" is something different to optimization. Typically the term is used to describe a process that takes a source file in text form and removes all superfluous whitespace and replaces all identifiers with shorter ones.

            Strictly speaking the whole idea of minification is a folly, since it has zero impact on performance; neither lexing the code, nor the compilation result are affected by it. The whole minification doofus started in web development to reduce webpage resource size; totally worthless, because you'll get far better performance if you just compress the text with gzip or similar. Heck after zipping the original and the minified versions' sized will probably within a few bytes of each other.

            If you're really concerned about the size of your shader as a resource, just compress it (but mind the overhead of the decompression code). EDIT: However if your target is WebGL, then make use of HTTP transport gzip compression. The relevant browsers do support it all, and most HTTP servers can be configured to transparently deliver a supplementary .gz suffixed file (or do the compression and cache it on the fly).

            For optimization, you should look to the other offerings of Khronos. Specifically the GLSL to SPIR-V compiler glslc, the SPIR-V optimizer spirv-opt, and the SPIR-V decompiler spirv-cross. You can chain those up to create optimized, "reduced" GLSL.

            Source https://stackoverflow.com/questions/59760829

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install glsl-optimizer

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/aras-p/glsl-optimizer.git

          • CLI

            gh repo clone aras-p/glsl-optimizer

          • sshUrl

            git@github.com:aras-p/glsl-optimizer.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link