Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: laurentlb/shader-minifier
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.5.1
Choose a base ref
...
head repository: laurentlb/shader-minifier
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1.6.0
Choose a head ref
  • 18 commits
  • 80 files changed
  • 6 contributors

Commits on Apr 13, 2025

  1. Configuration menu
    Copy the full SHA
    39a10b3 View commit details
    Browse the repository at this point in the history

Commits on Apr 15, 2025

  1. Configuration menu
    Copy the full SHA
    8f75484 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3e665d3 View commit details
    Browse the repository at this point in the history

Commits on Apr 28, 2025

  1. Update & Fix Bolero webpage (#506)

    Thanks to Tarmil!
    (fsbolero/Bolero#370 (comment))
    laurentlb authored Apr 28, 2025
    Configuration menu
    Copy the full SHA
    709c328 View commit details
    Browse the repository at this point in the history

Commits on May 7, 2025

  1. Add JSON Output Format (#508)

    ### **Description:**
    
    This Pull Request introduces a new output format option: JSON.
    
    ### **Motivation:**
    
    Currently, the various output formats in `shader-minifier` are tightly
    coupled with the main program. This means that if a user requires a
    specific output format that isn't already supported, they need to have
    that functionality accepted and merged into the core package. This
    approach isn't always the most flexible or user-friendly for everyone.
    
    By adding a JSON output option, users will have a standardized,
    machine-readable format. If their desired output format is not natively
    supported, they can easily parse the JSON output and generate their
    preferred format themselves. This provides greater flexibility and
    empowers users to adapt the minifier's output to their specific needs
    without requiring direct modifications to this repository for every new
    format.
    
    ### **A Note on Implementation:**
    
    I am not deeply familiar with F# or the .NET ecosystem, so there's a
    possibility that my implementation might not be idiomatic or could be
    improved. I would greatly appreciate any feedback, suggestions, or
    corrections regarding the code.
    ssssota authored May 7, 2025
    Configuration menu
    Copy the full SHA
    b112f30 View commit details
    Browse the repository at this point in the history

Commits on May 13, 2025

  1. JSON with templating (#512)

    close #511 
    
    This PR removes System.Text.Json.JsonSerializer to resolve persistent
    build and runtime errors related to its source generator mode in our F#
    Blazor WASM setup.
    ssssota authored May 13, 2025
    Configuration menu
    Copy the full SHA
    6869838 View commit details
    Browse the repository at this point in the history

Commits on Jun 15, 2025

  1. Support For Multi-Dimensional Arrays (#513)

    Adds support for multi-dimensional arrays of the form:
    
    ```
    float x[3][4][8];
    ```
    
    ## Approach
    
    Takes the simple approach of replacing the optional `size` attribute of
    the declaration AST with a (potentially empty) `sizes` list.
    
    ## Outstanding Issues
    
    ### Definition condensing
    
    The `array.frag` unit test contains a case similar to the following
    (simplified for example's sake)
    
    ```
    float a[5];
    float b[5];
    ```
    
    And expects these to be condensed to a shared one line definition
    
    ```
    float a[5], b[5];
    ```
    
    Notice, however, that both arrays have the same size. Turns out that, if
    you change the size of b to 4, for instance, the definitions still get
    condensed.
    
    ```
    float a[5], b[4];
    ```
    
    **But this is not valid HLSL (or GLSL, I think?).**
    
    To fix this, I made it so that array definitions of different sizes
    can't be compactified. But, this breaks the `array.frag` test, since it
    has a few other cases involving arrays with unspecified sizes (i.e.
    `c[]`) and arrays with sizes that are evaluated as part of the
    minification process (`int size = 2+2; c[size];`).
    
    Looking for feedback here; assuming keeping array definition-sharing in
    some capacity is the desired behavior.
    
    ### Non-neighboring, Mergeable Definitions
    
    Currently only neighboring definitions are merged. I.e.
    
    ```
    float a[3];
    float b[2];
    float c[3];
    ```
    
    Produces
    
    ```
    float a[3];
    float b[2];
    float c[3];
    ```
    
    I.e. it does not merge a and c into a shared declaration. This seems to
    be a function of the way the AST transform is written.
    
    ---
    - To see the specific tasks where the Asana app for GitHub is being
    used, see below:
      - https://app.asana.com/0/0/1210515599774891
    bguesman authored Jun 15, 2025
    Configuration menu
    Copy the full SHA
    f0681f2 View commit details
    Browse the repository at this point in the history

Commits on Jun 19, 2025

  1. Support for struct methods (#514)

    This PR adds basic support for parsing struct methods into the AST, and
    printing them back out.
    
    ## Strategy
    
    The strategy we choose is pretty straightforward. Previously, the AST
    for a `StructOrInterfaceBlock` maintained a `Decl list` of _fields_.
    
    We define a new algebraic type:
    
    ```
    StructMember =
      | MemberVariable of Decl
      | Method of FunctionType * Stmt
    ```
    
    That can be either a member variable or a method. The AST for
    `StructOrInterfaceBlock` changes accordingly:
    
    ```
    and StructOrInterfaceBlock = {
        // ...
        members: StructMember list
    }
    ```
    
    ## Unsupported Features
    
    Method renaming is not supported, though should be implementable in a
    way similar to field renaming (EDIT: I actually have this done in a
    follow-up).
    
    Methods with separate definitions are not supported, i.e.
    
    ```
    struct MyStruct {
      int MyFunction();
    };
    
    // ... later
    
    int MyStruct::MyFunction() {
      return 4;
    }
    ```
    
    though this is valid HLSL (compilable by FXC and DXC).
    
    Nested structs are not supported, i.e.
    
    ```
    struct MyStruct {
      struct MyNestedStruct {
        // ...
      };
    };
    ```
    
    This is kind of a non-sequitur, but it's technically valid in HLSL. To
    support this I think you'd just have to add `StructOrInterfaceBlock` to
    the algebraic type for `StructMember`, and parse it, but this is
    orthogonal enough that we'll save that for another day.
    bguesman authored Jun 19, 2025
    Configuration menu
    Copy the full SHA
    94615db View commit details
    Browse the repository at this point in the history

Commits on Jul 14, 2025

  1. Configuration menu
    Copy the full SHA
    98e6a8b View commit details
    Browse the repository at this point in the history

Commits on Nov 3, 2025

  1. Changed exit-code of --version to 0 (#525)

    Hey! I just noticed running `shader_minifier.exe --version` has a
    nonzero (error) exit code and thought I'd fix it quickly.
    LeStahL authored Nov 3, 2025
    Configuration menu
    Copy the full SHA
    e9da2af View commit details
    Browse the repository at this point in the history

Commits on Feb 1, 2026

  1. Don't reuse const variables. Fixes #535 (#536)

    Don't reuse const variables. Fixes #535
    eldritchconundrum authored Feb 1, 2026
    Configuration menu
    Copy the full SHA
    d26e09a View commit details
    Browse the repository at this point in the history

Commits on Mar 2, 2026

  1. Fix: newline between source name and indented source (#544)

    When minifying multiple shaders to `--format indented`, the sources are
    labeled:
    ```GLSL
    // source1.glsl
    ...
    
    // source2.glsl
    ...
    ```
    therontarigo authored Mar 2, 2026
    Configuration menu
    Copy the full SHA
    c05694b View commit details
    Browse the repository at this point in the history

Commits on Mar 4, 2026

  1. Add pure builtins (#550)

    More inlining opportunities
    eldritchconundrum authored Mar 4, 2026
    Configuration menu
    Copy the full SHA
    1620c4f View commit details
    Browse the repository at this point in the history

Commits on Mar 7, 2026

  1. Update compression_test.fs (add missing test)

    the files were added in #507
    laurentlb committed Mar 7, 2026
    Configuration menu
    Copy the full SHA
    e1566b4 View commit details
    Browse the repository at this point in the history

Commits on Mar 8, 2026

  1. Fix rare variable shadowing bug (#528)

    The variable shadowing calculation was sometimes allowing the renaming
    to shadow outer names when they were actually used in the inner scope.
    This generated invalid minified code.
    
    This happened only after a multi-use-site variable inlining, because it
    introduces sharing instances of identifiers at multiple places in the
    AST. This was a problem in the renaming because it operated under the
    assumption that the inner scope names were not renamed yet when entering
    the scope to compute shadowings. But the shared identifier instance was
    already renamed when processing its use in the outer scope!
    eldritchconundrum authored Mar 8, 2026
    Configuration menu
    Copy the full SHA
    2a1c342 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7c975c2 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    8f9a0e7 View commit details
    Browse the repository at this point in the history

Commits on Mar 29, 2026

  1. Move top-level declarations up to merge them more often (#553)

    Co-authored-by: Laurent Le Brun <laurentlb@gmail.com>
    eldritchconundrum and laurentlb authored Mar 29, 2026
    Configuration menu
    Copy the full SHA
    c525202 View commit details
    Browse the repository at this point in the history
Loading