GlTextureView .java

com.mojang.renderpearl.backend.opengl.GlTextureView (class): members: fboKeys, removeAssociatedFbo, addAssociatedFbo, frameBufferCache, fboMipLevel, glId.

com.mojang.renderpearl.backend.openglclass63 linesclientextends BaseGpuTextureView1.5 KB

Implements

API Surface (7)

boolean isClosed()
void close()
GlTexture texture()
int glId()
int fboMipLevel()
void addAssociatedFbo(final FrameBufferCache.CacheKey fboKey)
void removeAssociatedFbo(final FrameBufferCache.CacheKey fboKey)

Fields & Constants (4)

EMPTY
closed
frameBufferCache
fboKeys

Code Graph: Dependencies (4)

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

Full Source

GlTextureView.java63 lines · Minecraft 26.3 · verbatim
1
package com.mojang.renderpearl.backend.opengl;
2
3
import com.mojang.renderpearl.backend.common.BaseGpuTextureView;
4
import java.util.ArrayList;
5
import java.util.List;
6
import net.fabricmc.api.EnvType;
7
import net.fabricmc.api.Environment;
8
9
@Environment(EnvType.CLIENT)
10
public class GlTextureView extends BaseGpuTextureView implements FrameBufferAttachment {
11
	private static final int EMPTY = -1;
12
	private boolean closed;
13
	private final FrameBufferCache frameBufferCache;
14
	private final List<FrameBufferCache.CacheKey> fboKeys = new ArrayList<>();
15
16
	protected GlTextureView(final GlTexture texture, final int baseMipLevel, final int mipLevels, final FrameBufferCache frameBufferCache) {
17
		super(texture, baseMipLevel, mipLevels);
18
		texture.addViews();
19
		this.frameBufferCache = frameBufferCache;
20
	}
21
22
	@Override
23
	public boolean isClosed() {
24
		return this.closed;
25
	}
26
27
	@Override
28
	public void close() {
29
		if (!this.closed) {
30
			this.closed = true;
31
			this.texture().removeViews();
32
33
			while (!this.fboKeys.isEmpty()) {
34
				this.frameBufferCache.destroyFbo(this.fboKeys.getLast());
35
			}
36
		}
37
	}
38
39
	public GlTexture texture() {
40
		return (GlTexture)super.texture();
41
	}
42
43
	@Override
44
	public int glId() {
45
		return this.texture().id;
46
	}
47
48
	@Override
49
	public int fboMipLevel() {
50
		return this.baseMipLevel();
51
	}
52
53
	@Override
54
	public void addAssociatedFbo(final FrameBufferCache.CacheKey fboKey) {
55
		this.fboKeys.add(fboKey);
56
	}
57
58
	@Override
59
	public void removeAssociatedFbo(final FrameBufferCache.CacheKey fboKey) {
60
		this.fboKeys.remove(fboKey);
61
	}
62
}
63

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