GpuBuffer .java

com.mojang.renderpearl.api.buffers.GpuBuffer (interface, 56 lines): members: USAGE_UNIFORM_TEXEL_BUFFER, USAGE_HINT_CLIENT_STORAGE, USAGE_MAP_WRITE, Usage.

com.mojang.renderpearl.api.buffersinterface56 linesclientextends UncheckedAutoCloseable1.6 KB

API Surface (0)

No public/protected methods detected (fields or constants only).

Fields & Constants (10)

USAGE_MAP_READ
USAGE_MAP_WRITE
USAGE_HINT_CLIENT_STORAGE
USAGE_COPY_DST
USAGE_COPY_SRC
USAGE_VERTEX
USAGE_INDEX
USAGE_UNIFORM
USAGE_UNIFORM_TEXEL_BUFFER
USAGE_INDIRECT_PARAMETERS

String literals (2)

"Offset of "
" and length "

Code Graph: Dependencies (2)

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

Full Source

GpuBuffer.java56 lines · Minecraft 26.3 · verbatim
1
package com.mojang.renderpearl.api.buffers;
2
3
import com.mojang.renderpearl.util.UncheckedAutoCloseable;
4
import java.lang.annotation.ElementType;
5
import java.lang.annotation.Retention;
6
import java.lang.annotation.RetentionPolicy;
7
import java.lang.annotation.Target;
8
import net.fabricmc.api.EnvType;
9
import net.fabricmc.api.Environment;
10
11
@Environment(EnvType.CLIENT)
12
public interface GpuBuffer extends UncheckedAutoCloseable {
13
	int USAGE_MAP_READ = 1;
14
	int USAGE_MAP_WRITE = 2;
15
	int USAGE_HINT_CLIENT_STORAGE = 4;
16
	int USAGE_COPY_DST = 8;
17
	int USAGE_COPY_SRC = 16;
18
	int USAGE_VERTEX = 32;
19
	int USAGE_INDEX = 64;
20
	int USAGE_UNIFORM = 128;
21
	int USAGE_UNIFORM_TEXEL_BUFFER = 256;
22
	int USAGE_INDIRECT_PARAMETERS = 512;
23
24
	long size();
25
26
	@GpuBuffer.Usage int usage();
27
28
	boolean isClosed();
29
30
	default GpuBufferSlice slice(final long offset, final long length) {
31
		if (offset >= 0L && length >= 0L && offset + length <= this.size()) {
32
			return new GpuBufferSlice(this, offset, length);
33
		} else {
34
			throw new IllegalArgumentException(
35
				"Offset of " + offset + " and length " + length + " would put new slice outside buffer's range (of 0," + this.size() + ")"
36
			);
37
		}
38
	}
39
40
	default GpuBufferSlice slice() {
41
		return new GpuBufferSlice(this, 0L, this.size());
42
	}
43
44
	default GpuBufferSlice.MappedView map(final boolean read, final boolean write) {
45
		return this.map(0L, this.size(), read, write);
46
	}
47
48
	GpuBufferSlice.MappedView map(long offset, long length, boolean read, boolean write);
49
50
	@Retention(RetentionPolicy.CLASS)
51
	@Target(ElementType.TYPE_USE)
52
	@Environment(EnvType.CLIENT)
53
	@interface Usage {
54
	}
55
}
56

Decompiled Minecraft 26.3 source of GpuBuffer (com/mojang/renderpearl/api/buffers/GpuBuffer.java) with Mojang official mappings, stored verbatim on the site.