Class ShaderUniformCache

java.lang.Object
foundry.veil.api.client.render.shader.program.ShaderUniformCache

public class ShaderUniformCache extends Object
Queries shader programs for all relevant uniform data.
Since:
1.0.0
  • Constructor Details

    • ShaderUniformCache

      public ShaderUniformCache(IntSupplier shader)
  • Method Details

    • clear

      public void clear()
      Clears the cache, rebuilding it the next time getUniform(CharSequence) is called.
    • getUniform

      @Nullable public @Nullable ShaderUniformCache.Uniform getUniform(CharSequence name)
      Retrieves a uniform by name.
      Parameters:
      name - The name of the uniform to get
      Returns:
      The uniform found or null if it doesn't exist
    • hasUniform

      public boolean hasUniform(String name)
      Checks if a uniform exists by the specified name.
      Parameters:
      name - The name of the uniform to check for
      Returns:
      Whether that uniform exists
    • getUniformBlock

      @Nullable public @Nullable ShaderUniformCache.UniformBlock getUniformBlock(String name)
      Retrieves a uniform block by name.
      Parameters:
      name - The name of the uniform block to get
      Returns:
      The uniform block found or null if it doesn't exist
    • hasUniformBlock

      public boolean hasUniformBlock(String name)
      Checks if a uniform block exists by the specified name.
      Parameters:
      name - The name of the uniform block to check for
      Returns:
      Whether that uniform block exists
    • getStorageBlock

      @Nullable public @Nullable ShaderUniformCache.StorageBlock getStorageBlock(String name)
      Retrieves a storage block by name.
      Parameters:
      name - The name of the storage block to get
      Returns:
      The storage block found or null if it doesn't exist
    • hasStorageBlock

      public boolean hasStorageBlock(String name)
      Checks if a storage block exists by the specified name.
      Parameters:
      name - The name of the storage block to check for
      Returns:
      Whether that storage block exists
    • hasSampler

      public boolean hasSampler(String name)
      Checks if a sampler uniform exists with the specified name.
      Parameters:
      name - The name of the sampler to check for
      Returns:
      Whether that uniform exists and is a sampler
    • getSamplers

      public Map<String,ShaderUniformCache.Uniform> getSamplers()
      Returns:
      A view of all sampler uniforms in the shader
    • getUniforms

      public Map<String,ShaderUniformCache.Uniform> getUniforms()
      Returns:
      A view of all uniforms in the shader
    • getUniformBlocks

      public Map<String,ShaderUniformCache.UniformBlock> getUniformBlocks()
      Returns:
      A view of all uniform blocks in the shader
    • getStorageBlocks

      public Map<String,ShaderUniformCache.StorageBlock> getStorageBlocks()
      Returns:
      A view of all storage blocks in the shader
    • isSampler

      public static boolean isSampler(int type)
      Checks if the specified GL shader type is a sampler.
      Parameters:
      type - The type to check
      Returns:
      Whether that GL type is a sampler
    • getName

      public static String getName(int type)
      Retrieves the human-readable name of the specified GL shader type.
      Parameters:
      type - The type to get the name of
      Returns:
      The human-readable name