Package codechicken.lib.render.shader
Class BinaryShaderObject
java.lang.Object
codechicken.lib.render.shader.NamedShaderObject
codechicken.lib.render.shader.BinaryShaderObject
- All Implemented Interfaces:
ShaderObject,net.minecraft.server.packs.resources.PreparableReloadListener,net.minecraft.server.packs.resources.ResourceManagerReloadListener
public class BinaryShaderObject
extends NamedShaderObject
implements net.minecraft.server.packs.resources.ResourceManagerReloadListener
Allows using pre-compiled shader binaries with
ShaderProgram.
Created by KitsuneAlex on 18/11/21.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.server.packs.resources.PreparableReloadListener
net.minecraft.server.packs.resources.PreparableReloadListener.PreparationBarrierNested classes/interfaces inherited from interface codechicken.lib.render.shader.ShaderObject
ShaderObject.ShaderType, ShaderObject.StandardShaderType -
Constructor Summary
ConstructorsConstructorDescriptionBinaryShaderObject(String name, net.minecraft.resources.ResourceLocation asset, ShaderObject.ShaderType type, BinaryType binaryType, String entryPoint, Collection<UniformPair> uniforms, Consumer<ConstantCache> specializationCallback) -
Method Summary
Modifier and TypeMethodDescriptionvoidalloc()Allocates and compiles thisShaderObject.intGets the GL id for thisShaderObject.booleanisDirty()Checks if this shader is dirty and requires re-compiling.voidonLink(int programId) Called when thisShaderObjectis linked to aShaderProgram.voidonResourceManagerReload(net.minecraft.server.packs.resources.ResourceManager resourceManager) Methods inherited from class codechicken.lib.render.shader.NamedShaderObject
getName, getShaderType, getUniformsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.server.packs.resources.PreparableReloadListener
getNameMethods inherited from interface net.minecraft.server.packs.resources.ResourceManagerReloadListener
reload
-
Constructor Details
-
BinaryShaderObject
public BinaryShaderObject(String name, net.minecraft.resources.ResourceLocation asset, ShaderObject.ShaderType type, BinaryType binaryType, String entryPoint, Collection<UniformPair> uniforms, Consumer<ConstantCache> specializationCallback)
-
-
Method Details
-
isDirty
public boolean isDirty()Description copied from interface:ShaderObjectChecks if this shader is dirty and requires re-compiling.- Specified by:
isDirtyin interfaceShaderObject- Returns:
- If this shader is dirty.
-
alloc
public void alloc()Description copied from interface:ShaderObjectAllocates and compiles thisShaderObject. Does nothing if the shader is already compiled.- Specified by:
allocin interfaceShaderObject
-
getShaderID
public int getShaderID()Description copied from interface:ShaderObjectGets the GL id for thisShaderObject.- Specified by:
getShaderIDin interfaceShaderObject- Returns:
- The id, -1 of not allocated.
-
onLink
public void onLink(int programId) Description copied from interface:ShaderObjectCalled when thisShaderObjectis linked to aShaderProgram.- Specified by:
onLinkin interfaceShaderObject- Parameters:
programId- The GL id of the program.
-
onResourceManagerReload
public void onResourceManagerReload(net.minecraft.server.packs.resources.ResourceManager resourceManager) - Specified by:
onResourceManagerReloadin interfacenet.minecraft.server.packs.resources.ResourceManagerReloadListener
-