Class ShaderProgram

java.lang.Object
net.minecraft.client.gl.ShaderProgram
All Implemented Interfaces:
AutoCloseable, ShaderProgramSetupView

@Environment(CLIENT) public class ShaderProgram extends Object implements ShaderProgramSetupView, AutoCloseable
Represents a shader program. Also known as a program object that can be created with glCreateProgram.

Warning: This class is referred to as a shader in strings. However, this does NOT represent a shader object that can be created with glCreateShader. ShaderStage is what represents a shader object.

See Also:
Mappings:
Namespace Name
named net/minecraft/client/gl/ShaderProgram
intermediary net/minecraft/class_5944
official gfn
  • Field Details

    • SHADERS_DIRECTORY

      public static final String SHADERS_DIRECTORY
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named SHADERS_DIRECTORY Lnet/minecraft/client/gl/ShaderProgram;SHADERS_DIRECTORY:Ljava/lang/String;
      intermediary field_32778 Lnet/minecraft/class_5944;field_32778:Ljava/lang/String;
      official a Lgfn;a:Ljava/lang/String;
    • CORE_DIRECTORY

      private static final String CORE_DIRECTORY
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named CORE_DIRECTORY Lnet/minecraft/client/gl/ShaderProgram;CORE_DIRECTORY:Ljava/lang/String;
      intermediary field_40512 Lnet/minecraft/class_5944;field_40512:Ljava/lang/String;
      official q Lgfn;q:Ljava/lang/String;
    • INCLUDE_DIRECTORY

      private static final String INCLUDE_DIRECTORY
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named INCLUDE_DIRECTORY Lnet/minecraft/client/gl/ShaderProgram;INCLUDE_DIRECTORY:Ljava/lang/String;
      intermediary field_32779 Lnet/minecraft/class_5944;field_32779:Ljava/lang/String;
      official r Lgfn;r:Ljava/lang/String;
    • LOGGER

      static final Logger LOGGER
      Mappings:
      Namespace Name Mixin selector
      named LOGGER Lnet/minecraft/client/gl/ShaderProgram;LOGGER:Lorg/slf4j/Logger;
      intermediary field_29483 Lnet/minecraft/class_5944;field_29483:Lorg/slf4j/Logger;
      official s Lgfn;s:Lorg/slf4j/Logger;
    • DEFAULT_UNIFORM

      private static final Uniform DEFAULT_UNIFORM
      Mappings:
      Namespace Name Mixin selector
      named DEFAULT_UNIFORM Lnet/minecraft/client/gl/ShaderProgram;DEFAULT_UNIFORM:Lnet/minecraft/client/gl/Uniform;
      intermediary field_29484 Lnet/minecraft/class_5944;field_29484:Lnet/minecraft/class_278;
      official t Lgfn;t:Lfar;
    • field_32780

      private static final boolean field_32780
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named field_32780 Lnet/minecraft/client/gl/ShaderProgram;field_32780:Z
      intermediary field_32780 Lnet/minecraft/class_5944;field_32780:Z
      official u Lgfn;u:Z
    • activeProgram

      private static ShaderProgram activeProgram
      Mappings:
      Namespace Name Mixin selector
      named activeProgram Lnet/minecraft/client/gl/ShaderProgram;activeProgram:Lnet/minecraft/client/gl/ShaderProgram;
      intermediary field_29485 Lnet/minecraft/class_5944;field_29485:Lnet/minecraft/class_5944;
      official v Lgfn;v:Lgfn;
    • activeProgramGlRef

      private static int activeProgramGlRef
      Mappings:
      Namespace Name Mixin selector
      named activeProgramGlRef Lnet/minecraft/client/gl/ShaderProgram;activeProgramGlRef:I
      intermediary field_29486 Lnet/minecraft/class_5944;field_29486:I
      official w Lgfn;w:I
    • samplers

      private final Map<String,Object> samplers
      Mappings:
      Namespace Name Mixin selector
      named samplers Lnet/minecraft/client/gl/ShaderProgram;samplers:Ljava/util/Map;
      intermediary field_29487 Lnet/minecraft/class_5944;field_29487:Ljava/util/Map;
      official x Lgfn;x:Ljava/util/Map;
    • samplerNames

      private final List<String> samplerNames
      Mappings:
      Namespace Name Mixin selector
      named samplerNames Lnet/minecraft/client/gl/ShaderProgram;samplerNames:Ljava/util/List;
      intermediary field_29488 Lnet/minecraft/class_5944;field_29488:Ljava/util/List;
      official y Lgfn;y:Ljava/util/List;
    • loadedSamplerIds

      private final List<Integer> loadedSamplerIds
      Mappings:
      Namespace Name Mixin selector
      named loadedSamplerIds Lnet/minecraft/client/gl/ShaderProgram;loadedSamplerIds:Ljava/util/List;
      intermediary field_29489 Lnet/minecraft/class_5944;field_29489:Ljava/util/List;
      official z Lgfn;z:Ljava/util/List;
    • uniforms

      private final List<GlUniform> uniforms
      Mappings:
      Namespace Name Mixin selector
      named uniforms Lnet/minecraft/client/gl/ShaderProgram;uniforms:Ljava/util/List;
      intermediary field_29490 Lnet/minecraft/class_5944;field_29490:Ljava/util/List;
      official A Lgfn;A:Ljava/util/List;
    • loadedUniformIds

      private final List<Integer> loadedUniformIds
      Mappings:
      Namespace Name Mixin selector
      named loadedUniformIds Lnet/minecraft/client/gl/ShaderProgram;loadedUniformIds:Ljava/util/List;
      intermediary field_29491 Lnet/minecraft/class_5944;field_29491:Ljava/util/List;
      official B Lgfn;B:Ljava/util/List;
    • loadedUniforms

      private final Map<String,GlUniform> loadedUniforms
      Mappings:
      Namespace Name Mixin selector
      named loadedUniforms Lnet/minecraft/client/gl/ShaderProgram;loadedUniforms:Ljava/util/Map;
      intermediary field_29492 Lnet/minecraft/class_5944;field_29492:Ljava/util/Map;
      official C Lgfn;C:Ljava/util/Map;
    • glRef

      private final int glRef
      Mappings:
      Namespace Name Mixin selector
      named glRef Lnet/minecraft/client/gl/ShaderProgram;glRef:I
      intermediary field_29493 Lnet/minecraft/class_5944;field_29493:I
      official D Lgfn;D:I
    • name

      private final String name
      Mappings:
      Namespace Name Mixin selector
      named name Lnet/minecraft/client/gl/ShaderProgram;name:Ljava/lang/String;
      intermediary field_29494 Lnet/minecraft/class_5944;field_29494:Ljava/lang/String;
      official E Lgfn;E:Ljava/lang/String;
    • dirty

      private boolean dirty
      Mappings:
      Namespace Name Mixin selector
      named dirty Lnet/minecraft/client/gl/ShaderProgram;dirty:Z
      intermediary field_29495 Lnet/minecraft/class_5944;field_29495:Z
      official F Lgfn;F:Z
    • vertexShader

      private final ShaderStage vertexShader
      Mappings:
      Namespace Name Mixin selector
      named vertexShader Lnet/minecraft/client/gl/ShaderProgram;vertexShader:Lnet/minecraft/client/gl/ShaderStage;
      intermediary field_29467 Lnet/minecraft/class_5944;field_29467:Lnet/minecraft/class_281;
      official G Lgfn;G:Lfaw;
    • fragmentShader

      private final ShaderStage fragmentShader
      Mappings:
      Namespace Name Mixin selector
      named fragmentShader Lnet/minecraft/client/gl/ShaderProgram;fragmentShader:Lnet/minecraft/client/gl/ShaderStage;
      intermediary field_29468 Lnet/minecraft/class_5944;field_29468:Lnet/minecraft/class_281;
      official H Lgfn;H:Lfaw;
    • format

      private final VertexFormat format
      Mappings:
      Namespace Name Mixin selector
      named format Lnet/minecraft/client/gl/ShaderProgram;format:Lnet/minecraft/client/render/VertexFormat;
      intermediary field_29469 Lnet/minecraft/class_5944;field_29469:Lnet/minecraft/class_293;
      official I Lgfn;I:Lfbn;
    • modelViewMat

      @Nullable public final @Nullable GlUniform modelViewMat
      Mappings:
      Namespace Name Mixin selector
      named modelViewMat Lnet/minecraft/client/gl/ShaderProgram;modelViewMat:Lnet/minecraft/client/gl/GlUniform;
      intermediary field_29470 Lnet/minecraft/class_5944;field_29470:Lnet/minecraft/class_284;
      official b Lgfn;b:Lfaz;
    • projectionMat

      @Nullable public final @Nullable GlUniform projectionMat
      Mappings:
      Namespace Name Mixin selector
      named projectionMat Lnet/minecraft/client/gl/ShaderProgram;projectionMat:Lnet/minecraft/client/gl/GlUniform;
      intermediary field_29471 Lnet/minecraft/class_5944;field_29471:Lnet/minecraft/class_284;
      official c Lgfn;c:Lfaz;
    • textureMat

      @Nullable public final @Nullable GlUniform textureMat
      Mappings:
      Namespace Name Mixin selector
      named textureMat Lnet/minecraft/client/gl/ShaderProgram;textureMat:Lnet/minecraft/client/gl/GlUniform;
      intermediary field_29472 Lnet/minecraft/class_5944;field_29472:Lnet/minecraft/class_284;
      official d Lgfn;d:Lfaz;
    • screenSize

      @Nullable public final @Nullable GlUniform screenSize
      Mappings:
      Namespace Name Mixin selector
      named screenSize Lnet/minecraft/client/gl/ShaderProgram;screenSize:Lnet/minecraft/client/gl/GlUniform;
      intermediary field_29473 Lnet/minecraft/class_5944;field_29473:Lnet/minecraft/class_284;
      official e Lgfn;e:Lfaz;
    • colorModulator

      @Nullable public final @Nullable GlUniform colorModulator
      Mappings:
      Namespace Name Mixin selector
      named colorModulator Lnet/minecraft/client/gl/ShaderProgram;colorModulator:Lnet/minecraft/client/gl/GlUniform;
      intermediary field_29474 Lnet/minecraft/class_5944;field_29474:Lnet/minecraft/class_284;
      official f Lgfn;f:Lfaz;
    • light0Direction

      @Nullable public final @Nullable GlUniform light0Direction
      Mappings:
      Namespace Name Mixin selector
      named light0Direction Lnet/minecraft/client/gl/ShaderProgram;light0Direction:Lnet/minecraft/client/gl/GlUniform;
      intermediary field_29475 Lnet/minecraft/class_5944;field_29475:Lnet/minecraft/class_284;
      official g Lgfn;g:Lfaz;
    • light1Direction

      @Nullable public final @Nullable GlUniform light1Direction
      Mappings:
      Namespace Name Mixin selector
      named light1Direction Lnet/minecraft/client/gl/ShaderProgram;light1Direction:Lnet/minecraft/client/gl/GlUniform;
      intermediary field_29476 Lnet/minecraft/class_5944;field_29476:Lnet/minecraft/class_284;
      official h Lgfn;h:Lfaz;
    • glintAlpha

      @Nullable public final @Nullable GlUniform glintAlpha
      Mappings:
      Namespace Name Mixin selector
      named glintAlpha Lnet/minecraft/client/gl/ShaderProgram;glintAlpha:Lnet/minecraft/client/gl/GlUniform;
      intermediary field_42231 Lnet/minecraft/class_5944;field_42231:Lnet/minecraft/class_284;
      official i Lgfn;i:Lfaz;
    • fogStart

      @Nullable public final @Nullable GlUniform fogStart
      Mappings:
      Namespace Name Mixin selector
      named fogStart Lnet/minecraft/client/gl/ShaderProgram;fogStart:Lnet/minecraft/client/gl/GlUniform;
      intermediary field_29477 Lnet/minecraft/class_5944;field_29477:Lnet/minecraft/class_284;
      official j Lgfn;j:Lfaz;
    • fogEnd

      @Nullable public final @Nullable GlUniform fogEnd
      Mappings:
      Namespace Name Mixin selector
      named fogEnd Lnet/minecraft/client/gl/ShaderProgram;fogEnd:Lnet/minecraft/client/gl/GlUniform;
      intermediary field_29478 Lnet/minecraft/class_5944;field_29478:Lnet/minecraft/class_284;
      official k Lgfn;k:Lfaz;
    • fogColor

      @Nullable public final @Nullable GlUniform fogColor
      Mappings:
      Namespace Name Mixin selector
      named fogColor Lnet/minecraft/client/gl/ShaderProgram;fogColor:Lnet/minecraft/client/gl/GlUniform;
      intermediary field_29479 Lnet/minecraft/class_5944;field_29479:Lnet/minecraft/class_284;
      official l Lgfn;l:Lfaz;
    • fogShape

      @Nullable public final @Nullable GlUniform fogShape
      Mappings:
      Namespace Name Mixin selector
      named fogShape Lnet/minecraft/client/gl/ShaderProgram;fogShape:Lnet/minecraft/client/gl/GlUniform;
      intermediary field_36373 Lnet/minecraft/class_5944;field_36373:Lnet/minecraft/class_284;
      official m Lgfn;m:Lfaz;
    • lineWidth

      @Nullable public final @Nullable GlUniform lineWidth
      Mappings:
      Namespace Name Mixin selector
      named lineWidth Lnet/minecraft/client/gl/ShaderProgram;lineWidth:Lnet/minecraft/client/gl/GlUniform;
      intermediary field_29480 Lnet/minecraft/class_5944;field_29480:Lnet/minecraft/class_284;
      official n Lgfn;n:Lfaz;
    • gameTime

      @Nullable public final @Nullable GlUniform gameTime
      Mappings:
      Namespace Name Mixin selector
      named gameTime Lnet/minecraft/client/gl/ShaderProgram;gameTime:Lnet/minecraft/client/gl/GlUniform;
      intermediary field_29481 Lnet/minecraft/class_5944;field_29481:Lnet/minecraft/class_284;
      official o Lgfn;o:Lfaz;
    • chunkOffset

      @Nullable public final @Nullable GlUniform chunkOffset
      Mappings:
      Namespace Name Mixin selector
      named chunkOffset Lnet/minecraft/client/gl/ShaderProgram;chunkOffset:Lnet/minecraft/client/gl/GlUniform;
      intermediary field_29482 Lnet/minecraft/class_5944;field_29482:Lnet/minecraft/class_284;
      official p Lgfn;p:Lfaz;
  • Constructor Details

    • ShaderProgram

      public ShaderProgram(ResourceFactory factory, String name, VertexFormat format) throws IOException
      Throws:
      IOException
      Mappings:
      Namespace Name Mixin selector
      named <init> Lnet/minecraft/client/gl/ShaderProgram;<init>(Lnet/minecraft/resource/ResourceFactory;Ljava/lang/String;Lnet/minecraft/client/render/VertexFormat;)V
      intermediary <init> Lnet/minecraft/class_5944;<init>(Lnet/minecraft/class_5912;Ljava/lang/String;Lnet/minecraft/class_293;)V
      official <init> Lgfn;<init>(Lauh;Ljava/lang/String;Lfbn;)V
  • Method Details

    • loadShader

      private static ShaderStage loadShader(ResourceFactory factory, ShaderStage.Type type, String name) throws IOException
      Throws:
      IOException
      Mappings:
      Namespace Name Mixin selector
      named loadShader Lnet/minecraft/client/gl/ShaderProgram;loadShader(Lnet/minecraft/resource/ResourceFactory;Lnet/minecraft/client/gl/ShaderStage$Type;Ljava/lang/String;)Lnet/minecraft/client/gl/ShaderStage;
      intermediary method_34579 Lnet/minecraft/class_5944;method_34579(Lnet/minecraft/class_5912;Lnet/minecraft/class_281$class_282;Ljava/lang/String;)Lnet/minecraft/class_281;
      official a Lgfn;a(Lauh;Lfaw$a;Ljava/lang/String;)Lfaw;
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • unbind

      public void unbind()
      Mappings:
      Namespace Name Mixin selector
      named unbind Lnet/minecraft/client/gl/ShaderProgram;unbind()V
      intermediary method_34585 Lnet/minecraft/class_5944;method_34585()V
      official f Lgfn;f()V
    • bind

      public void bind()
      Mappings:
      Namespace Name Mixin selector
      named bind Lnet/minecraft/client/gl/ShaderProgram;bind()V
      intermediary method_34586 Lnet/minecraft/class_5944;method_34586()V
      official g Lgfn;g()V
    • markUniformsDirty

      public void markUniformsDirty()
      Specified by:
      markUniformsDirty in interface ShaderProgramSetupView
      Mappings:
      Namespace Name Mixin selector
      named markUniformsDirty Lnet/minecraft/client/gl/ShaderProgramSetupView;markUniformsDirty()V
      intermediary method_1279 Lnet/minecraft/class_3679;method_1279()V
      official b Lfay;b()V
    • getUniform

      @Nullable public @Nullable GlUniform getUniform(String name)
      Mappings:
      Namespace Name Mixin selector
      named getUniform Lnet/minecraft/client/gl/ShaderProgram;getUniform(Ljava/lang/String;)Lnet/minecraft/client/gl/GlUniform;
      intermediary method_34582 Lnet/minecraft/class_5944;method_34582(Ljava/lang/String;)Lnet/minecraft/class_284;
      official a Lgfn;a(Ljava/lang/String;)Lfaz;
    • getUniformOrDefault

      public Uniform getUniformOrDefault(String name)
      Mappings:
      Namespace Name Mixin selector
      named getUniformOrDefault Lnet/minecraft/client/gl/ShaderProgram;getUniformOrDefault(Ljava/lang/String;)Lnet/minecraft/client/gl/Uniform;
      intermediary method_35785 Lnet/minecraft/class_5944;method_35785(Ljava/lang/String;)Lnet/minecraft/class_278;
      official b Lgfn;b(Ljava/lang/String;)Lfar;
    • loadReferences

      private void loadReferences()
      Mappings:
      Namespace Name Mixin selector
      named loadReferences Lnet/minecraft/client/gl/ShaderProgram;loadReferences()V
      intermediary method_34588 Lnet/minecraft/class_5944;method_34588()V
      official j Lgfn;j()V
    • readSampler

      private void readSampler(JsonElement json)
      Mappings:
      Namespace Name Mixin selector
      named readSampler Lnet/minecraft/client/gl/ShaderProgram;readSampler(Lcom/google/gson/JsonElement;)V
      intermediary method_34580 Lnet/minecraft/class_5944;method_34580(Lcom/google/gson/JsonElement;)V
      official a Lgfn;a(Lcom/google/gson/JsonElement;)V
    • addSampler

      public void addSampler(String name, Object sampler)
      Mappings:
      Namespace Name Mixin selector
      named addSampler Lnet/minecraft/client/gl/ShaderProgram;addSampler(Ljava/lang/String;Ljava/lang/Object;)V
      intermediary method_34583 Lnet/minecraft/class_5944;method_34583(Ljava/lang/String;Ljava/lang/Object;)V
      official a Lgfn;a(Ljava/lang/String;Ljava/lang/Object;)V
    • addUniform

      private void addUniform(JsonElement json) throws InvalidHierarchicalFileException
      Throws:
      InvalidHierarchicalFileException
      Mappings:
      Namespace Name Mixin selector
      named addUniform Lnet/minecraft/client/gl/ShaderProgram;addUniform(Lcom/google/gson/JsonElement;)V
      intermediary method_34584 Lnet/minecraft/class_5944;method_34584(Lcom/google/gson/JsonElement;)V
      official b Lgfn;b(Lcom/google/gson/JsonElement;)V
    • getVertexShader

      public ShaderStage getVertexShader()
      Specified by:
      getVertexShader in interface ShaderProgramSetupView
      Mappings:
      Namespace Name Mixin selector
      named getVertexShader Lnet/minecraft/client/gl/ShaderProgramSetupView;getVertexShader()Lnet/minecraft/client/gl/ShaderStage;
      intermediary method_1274 Lnet/minecraft/class_3679;method_1274()Lnet/minecraft/class_281;
      official c Lfay;c()Lfaw;
    • getFragmentShader

      public ShaderStage getFragmentShader()
      Specified by:
      getFragmentShader in interface ShaderProgramSetupView
      Mappings:
      Namespace Name Mixin selector
      named getFragmentShader Lnet/minecraft/client/gl/ShaderProgramSetupView;getFragmentShader()Lnet/minecraft/client/gl/ShaderStage;
      intermediary method_1278 Lnet/minecraft/class_3679;method_1278()Lnet/minecraft/class_281;
      official d Lfay;d()Lfaw;
    • attachReferencedShaders

      public void attachReferencedShaders()
      Specified by:
      attachReferencedShaders in interface ShaderProgramSetupView
      Mappings:
      Namespace Name Mixin selector
      named attachReferencedShaders Lnet/minecraft/client/gl/ShaderProgramSetupView;attachReferencedShaders()V
      intermediary method_34418 Lnet/minecraft/class_3679;method_34418()V
      official e Lfay;e()V
    • getFormat

      public VertexFormat getFormat()
      Mappings:
      Namespace Name Mixin selector
      named getFormat Lnet/minecraft/client/gl/ShaderProgram;getFormat()Lnet/minecraft/client/render/VertexFormat;
      intermediary method_35786 Lnet/minecraft/class_5944;method_35786()Lnet/minecraft/class_293;
      official h Lgfn;h()Lfbn;
    • getName

      public String getName()
      Mappings:
      Namespace Name Mixin selector
      named getName Lnet/minecraft/client/gl/ShaderProgram;getName()Ljava/lang/String;
      intermediary method_35787 Lnet/minecraft/class_5944;method_35787()Ljava/lang/String;
      official i Lgfn;i()Ljava/lang/String;
    • getGlRef

      public int getGlRef()
      Specified by:
      getGlRef in interface ShaderProgramSetupView
      Mappings:
      Namespace Name Mixin selector
      named getGlRef Lnet/minecraft/client/gl/ShaderProgramSetupView;getGlRef()I
      intermediary method_1270 Lnet/minecraft/class_3679;method_1270()I
      official a Lfay;a()I
    • initializeUniforms

      public void initializeUniforms(VertexFormat.DrawMode drawMode, Matrix4f viewMatrix, Matrix4f projectionMatrix, Window window)
      Mappings:
      Namespace Name Mixin selector
      named initializeUniforms Lnet/minecraft/client/gl/ShaderProgram;initializeUniforms(Lnet/minecraft/client/render/VertexFormat$DrawMode;Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;Lnet/minecraft/client/util/Window;)V
      intermediary method_60897 Lnet/minecraft/class_5944;method_60897(Lnet/minecraft/class_293$class_5596;Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;Lnet/minecraft/class_1041;)V
      official a Lgfn;a(Lfbn$c;Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;Lfam;)V