GlShaderModule .java

com.mojang.renderpearl.backend.opengl.GlShaderModule (class): members: INVALID_SHADER, NOT_ALLOCATED, getShaderId, shaderId, getLabel, label, getType.

com.mojang.renderpearl.backend.openglclass46 linesclient1.1 KB

Implements

API Surface (4)

void close()
String getLabel()
int getShaderId()
ShaderType getType()

Fields & Constants (5)

NOT_ALLOCATED
INVALID_SHADER
label
shaderId
type

String literals (2)

"invalid"
"Already closed"

Code Graph: Dependencies (4)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

GlShaderModule.java46 lines · Minecraft 26.3 · verbatim
1
package com.mojang.renderpearl.backend.opengl;
2
3
import com.mojang.blaze3d.systems.RenderSystem;
4
import com.mojang.renderpearl.api.pipeline.ShaderType;
5
import com.mojang.renderpearl.util.UncheckedAutoCloseable;
6
import net.fabricmc.api.EnvType;
7
import net.fabricmc.api.Environment;
8
9
@Environment(EnvType.CLIENT)
10
public class GlShaderModule implements UncheckedAutoCloseable {
11
	private static final int NOT_ALLOCATED = -1;
12
	public static final GlShaderModule INVALID_SHADER = new GlShaderModule(-1, "invalid", ShaderType.VERTEX);
13
	private final String label;
14
	private int shaderId;
15
	private final ShaderType type;
16
17
	public GlShaderModule(final int shaderId, final String label, final ShaderType type) {
18
		this.label = label;
19
		this.shaderId = shaderId;
20
		this.type = type;
21
	}
22
23
	@Override
24
	public void close() {
25
		if (this.shaderId == -1) {
26
			throw new IllegalStateException("Already closed");
27
		}
28
29
		RenderSystem.assertOnRenderThread();
30
		GlStateManager.glDeleteShader(this.shaderId);
31
		this.shaderId = -1;
32
	}
33
34
	public String getLabel() {
35
		return this.label;
36
	}
37
38
	public int getShaderId() {
39
		return this.shaderId;
40
	}
41
42
	public ShaderType getType() {
43
		return this.type;
44
	}
45
}
46

Decompiled Minecraft 26.3 source of GlShaderModule (com/mojang/renderpearl/backend/opengl/GlShaderModule.java) with Mojang official mappings, stored verbatim on the site.