Package foundry.veil.api.client.render
Class VeilRenderSystem
java.lang.Object
foundry.veil.api.client.render.VeilRenderSystem
Additional functionality for
RenderSystem
.-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
static void
static void
bind
(ShaderBlock<?> block) Binds the specified block into the next available binding spot and updates all shaders if the binding index has changed.static void
bind
(CharSequence name, ShaderBlock<?> block) Binds the specified block into the next available binding spot and updates all shaders if the binding index has changed.static void
bindTextures
(int first, int... textures) Binds the specified texture ids to sequential texture units and invalidates the GLStateManager.static void
bindTextures
(int first, IntBuffer textures) Binds the specified texture ids to sequential texture units and invalidates the GLStateManager.static void
bindVertexArray
(int vao) Binds the specified vertex array and invalidates the vanilla MC immediate buffer state.static void
blit
(net.minecraft.util.profiling.ProfilerFiller profiler) static void
close()
static boolean
static boolean
static void
drawIndirect
(com.mojang.blaze3d.vertex.VertexBuffer vbo, long indirect, int drawCount, int stride) Draws indirect instances of the specified vertex buffer.static void
drawInstanced
(com.mojang.blaze3d.vertex.VertexBuffer vbo, int instances) Draws instances of the specified vertex buffer.static void
Draws a quad onto the full screen usingDefaultVertexFormat.POSITION
.static void
endFrame()
static void
Clears all pending shader errors and re-queues uniform block ids to shaders.static int
getIndexCount
(com.mojang.blaze3d.vertex.VertexBuffer vbo) Retrieves the number of indices in the specified vertex buffer.static org.joml.Vector3fc
static org.joml.Vector3fc
static @Nullable ShaderProgram
static void
init()
static int
static int
static int
static int
static int
static int
static int
static int
static int
static int
static int
static int
static int
static int
static int
static int
maxTargetBindings
(int target) Retrieves the maximum bindings for the specified buffer binding.static int
static int
static void
printGlErrors
(@Nullable String glCall) Consumes all OpenGL errors and prints them to console.static VeilRenderer
renderer()
static void
static Executor
static void
resize
(int width, int height) static @Nullable ShaderProgram
setShader
(@Nullable ShaderProgram shader) Sets the shader instance to a specific instance of a shader.static @Nullable ShaderProgram
setShader
(Supplier<ShaderProgram> shader) Sets the shader instance to a specific instance reference of a shader.static @Nullable ShaderProgram
setShader
(net.minecraft.resources.ResourceLocation shader) Sets the shader instance to be a reference to the shader manager.static void
setShaderLights
(org.joml.Vector3fc light0, org.joml.Vector3fc light1) static VeilShaderLimits
shaderLimits
(int shader) Retrieves the maximum limits for the specified shader type.static void
static boolean
static boolean
static void
Prints an error to console about the current shader.static boolean
static void
unbind
(ShaderBlock<?> block) Unbinds the specified block and frees the binding it occupied.
-
Method Details
-
init
@Internal public static void init() -
bindTextures
Binds the specified texture ids to sequential texture units and invalidates the GLStateManager.- Parameters:
first
- The first unit to bind totextures
- The textures to bind
-
bindTextures
public static void bindTextures(int first, int... textures) Binds the specified texture ids to sequential texture units and invalidates the GLStateManager.- Parameters:
first
- The first unit to bind totextures
- The textures to bind
-
drawScreenQuad
public static void drawScreenQuad()Draws a quad onto the full screen usingDefaultVertexFormat.POSITION
. -
setShader
@Nullable public static @Nullable ShaderProgram setShader(net.minecraft.resources.ResourceLocation shader) Sets the shader instance to be a reference to the shader manager.- Parameters:
shader
- The name of the shader to use- Returns:
- The Veil shader instance applied or
null
if there was an error
-
setShader
Sets the shader instance to a specific instance of a shader.setShader(ResourceLocation)
should be used in most cases.- Parameters:
shader
- The shader instance to use- Returns:
- The Veil shader instance applied or
null
if there was an error
-
setShader
Sets the shader instance to a specific instance reference of a shader.setShader(ResourceLocation)
should be used in most cases.- Parameters:
shader
- The reference to the shader to use- Returns:
- The Veil shader instance applied or
null
if there was an error
-
finalizeShaderCompilation
@Internal public static void finalizeShaderCompilation()Clears all pending shader errors and re-queues uniform block ids to shaders. -
throwShaderError
public static void throwShaderError()Prints an error to console about the current shader. This is useful to debug if a shader has an error while trying to be used. -
drawInstanced
public static void drawInstanced(com.mojang.blaze3d.vertex.VertexBuffer vbo, int instances) Draws instances of the specified vertex buffer.- Parameters:
vbo
- The vertex buffer to drawinstances
- The number of instances to draw- See Also:
-
drawIndirect
public static void drawIndirect(com.mojang.blaze3d.vertex.VertexBuffer vbo, long indirect, int drawCount, int stride) Draws indirect instances of the specified vertex buffer.- Parameters:
vbo
- The vertex buffer to drawindirect
- A pointer into the currently boundGL40C.GL_DRAW_INDIRECT_BUFFER
or the address of a struct containing draw datadrawCount
- The number of primitives to drawstride
- The offset between indirect elements- See Also:
-
printGlErrors
Consumes all OpenGL errors and prints them to console.- Parameters:
glCall
- The name of the OpenGL call made for extra logging ornull
to not include
-
getIndexCount
public static int getIndexCount(com.mojang.blaze3d.vertex.VertexBuffer vbo) Retrieves the number of indices in the specified vertex buffer.- Parameters:
vbo
- The vertex buffer to query- Returns:
- The number of indices in the buffer
-
computeSupported
public static boolean computeSupported()- Returns:
- Whether compute shaders are supported
-
atomicCounterSupported
public static boolean atomicCounterSupported()- Returns:
- Whether atomic counters in shaders are supported
-
transformFeedbackSupported
public static boolean transformFeedbackSupported()- Returns:
- Whether transform feedback from shaders is supported
-
textureMultibindSupported
public static boolean textureMultibindSupported()- Returns:
- Whether
GL44C.glBindTextures(int, java.nio.IntBuffer)
is supported
-
sparseBuffersSupported
public static boolean sparseBuffersSupported()- Returns:
- Whether
ARBSparseBuffer
is supported
-
directStateAccessSupported
public static boolean directStateAccessSupported()- Returns:
- Whether
ARBDirectStateAccess
is supported
-
maxCombinedTextureUnits
public static int maxCombinedTextureUnits()- Returns:
- The GL maximum number of texture units that can be bound
-
maxColorAttachments
public static int maxColorAttachments()- Returns:
- The GL maximum amount of color attachments a framebuffer can have
-
maxSamples
public static int maxSamples()- Returns:
- The GL maximum amount of samples a render buffer can have
-
maxTargetBindings
public static int maxTargetBindings(int target) Retrieves the maximum bindings for the specified buffer binding.- Parameters:
target
- The target to query the maximum bindings of- Returns:
- The GL maximum amount of buffer bindings available
-
shaderLimits
Retrieves the maximum limits for the specified shader type.- Parameters:
shader
- The shader to query the limits for- Returns:
- The GL limits available
-
maxTransformFeedbackBindings
public static int maxTransformFeedbackBindings()- Returns:
- The GL maximum number of transform feedback buffers bindings available
-
maxUniformBuffersBindings
public static int maxUniformBuffersBindings()- Returns:
- The GL maximum number of uniform buffers bindings available
-
maxAtomicCounterBufferBindings
public static int maxAtomicCounterBufferBindings()- Returns:
- The GL maximum number of atomic counter buffers bindings available
-
maxShaderStorageBufferBindings
public static int maxShaderStorageBufferBindings()- Returns:
- The GL maximum number of shader storage buffers bindings available
-
maxArrayTextureLayers
public static int maxArrayTextureLayers()- Returns:
- The GL maximum number of array texture layers available
-
maxFramebufferWidth
public static int maxFramebufferWidth()- Returns:
- The GL maximum width of framebuffers
-
maxFramebufferHeight
public static int maxFramebufferHeight()- Returns:
- The GL maximum width of framebuffers
-
maxComputeWorkGroupCountX
public static int maxComputeWorkGroupCountX()- Returns:
- The GL maximum number of work groups in the X
-
maxComputeWorkGroupCountY
public static int maxComputeWorkGroupCountY()- Returns:
- The GL maximum number of work groups in the Y
-
maxComputeWorkGroupCountZ
public static int maxComputeWorkGroupCountZ()- Returns:
- The GL maximum number of work groups in the Z
-
maxComputeWorkGroupSizeX
public static int maxComputeWorkGroupSizeX()- Returns:
- The GL maximum number of local work groups in the X
-
maxComputeWorkGroupSizeY
public static int maxComputeWorkGroupSizeY()- Returns:
- The GL maximum number of local work groups in the Y
-
maxComputeWorkGroupSizeZ
public static int maxComputeWorkGroupSizeZ()- Returns:
- The GL maximum number of local work groups in the Z
-
maxComputeWorkGroupInvocations
public static int maxComputeWorkGroupInvocations()- Returns:
- The GL maximum number of total compute shader invocations
-
bind
Binds the specified block into the next available binding spot and updates all shaders if the binding index has changed.
Make sure this is called before trying to use the block on this frame as it may have been overwritten.
- Parameters:
block
- The block to bind
-
bind
Binds the specified block into the next available binding spot and updates all shaders if the binding index has changed.
Make sure this is called before trying to use the block on this frame as it may have been overwritten.
This binds the block and assigns it to shader values.
- Parameters:
name
- The name of the block in shader codeblock
- The block to bind
-
unbind
Unbinds the specified block and frees the binding it occupied. It isn't strictly necessary to unbind blocks, but they should not be referenced anymore after being deleted.- Parameters:
block
- The block to unbind
-
bindVertexArray
public static void bindVertexArray(int vao) Binds the specified vertex array and invalidates the vanilla MC immediate buffer state.- Parameters:
vao
- The vao to bind
-
renderer
- Returns:
- The veil renderer instance
-
renderThreadExecutor
- Returns:
- An executor for the main render thread
-
getShader
- Returns:
- The actual shader reference to use while rendering or
null
if no shader is selected or the selected shader is from Vanilla Minecraft
-
getLight0Position
public static org.joml.Vector3fc getLight0Position()- Returns:
- The position of the first light
-
getLight1Position
public static org.joml.Vector3fc getLight1Position()- Returns:
- The position of the second light
-
beginFrame
@Internal public static void beginFrame() -
endFrame
@Internal public static void endFrame() -
shaderUpdate
@Internal public static void shaderUpdate() -
resize
@Internal public static void resize(int width, int height) -
close
@Internal public static void close() -
renderPost
@Internal public static void renderPost() -
setShaderLights
@Internal public static void setShaderLights(org.joml.Vector3fc light0, org.joml.Vector3fc light1) -
blit
@Internal public static void blit(net.minecraft.util.profiling.ProfilerFiller profiler)
-