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

Resource Packs loading unused shader imports

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.21.2 Pre-Release 2, 1.21.2 Pre-Release 4, 1.21.2 Pre-Release 5
    • None
    • Unconfirmed
    • (Unassigned)

      Description

      Imports (#moj_import) inside a shader file of a resource pack are always loaded regardless if there are preprocessor instructions in place which should prevent loading them. In the attached example resource pack I loaded another shader file (using #moj_import <color_filter.glsl>), but the instruction is inside an #ifdef and should not be executed as long as the expected define is not defined. The resource pack fails to load, because the import (which should not be loaded) tries to load and fails.

       

      #ifdef COLOR_BLINDNESS_TOGGLE
      #moj_import <color_filter.glsl>
      #endif 

       

      Steps to Reproduce

      1. Load the example resource pack in release 1.21.1 (loads without issue)
      2. Load the example resource pack in 1.21.2-pre2 (can't load)

      Expected Behaviour

      Any instruction inside a #ifdef or #ifndef block or any other conditional block should not be executed if the condition is false. This should also apply for loading imports (#moj_import).

            Unassigned Unassigned
            MrKinau MrKinau
            Votes:
            4 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: