Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-200003

Reloading a shader after passing invalid uniforms fails to update shader

    XMLWordPrintable

Details

    • Bug
    • Status: Open
    • Resolution: Unresolved
    • 1.16.3
    • None
    • Confirmed
    • (Unassigned)

    Description

      In a shader post json file, if a shader pass provides an invalid value in the uniforms, upon fixing the issue, the shader will stop updating no matter how many reloads are done, and will instead always render the same version of the shader from the reload before the error happened.

      It seems there are other cases that can trigger this bug to occur, all triggered by certain errors in the shader, but I do not have a conclusive list of exact scenarios. One possible case includes changing the shader to one of a different GLSL version with code that contains a bug. The other cases always happen when reloading after fixing an error after a previous reload.

      Expected Behavior:
      The game should always reliable reload all resource pack assets including recompiling modified shaders.

      To Reproduce:

      1. Download the provided zip file and extract the contents to your resource pack folder.
      2. Open a world, set graphics to Fabulous! and load the resource pack.
      3. You should see that your screen is completely red now. This means the shader is being applied.
      4. Go to assets/minecraft/shaders/post. Rename transparency.json to transparencyTEMP.json, then rename transparencyERROR.json to transparency.json (effectively swapping the files).
      5. F3+T to reload resource packs, and the game will error and reset to the default shaders as expected. The new transparency.json passes a non-existent Uniform value called 'Example' to the shader at line 69. In the output log, you should be able to find an error saying "passes[1]->uniforms[0]: Uniform 'Example' does not exist".
      6. Now rename transparency.json to transparencyERROR.json, then rename transparencyTEMP.json to transparency.json (effectively swapping the files again).
      7. Set graphics back to Fabulous! and load the resource pack.
      8. You should see that your screen is red again. This means the shader is loaded.
      9. Go to assets/minecraft/shaders/program. Open shaderreloadbug.fsh and uncomment the second line. This should now make the shader render a blue screen instead of red.
      10. F3+T to reload resource packs, and you will see the screen is still red. No amount of reloads will update the shader.
      11. Restart the game, go back into the world, and you will now see the screen is blue, confirming that the shader previously was refusing to update.

      Notes:
      A restart can be avoided by deleting the pass, reloading, and putting the pass back again, but this is not an optimal way around the issue. The game should always reliably reload all resources.

      Attachments

        Activity

          People

            Unassigned Unassigned
            onnowhere Onnowhere
            Votes:
            3 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              CHK: