CommandEncoder .java

com.mojang.renderpearl.api.commands.CommandEncoder (interface): members: clearColorAndDepthTextures, copyTextureToTexture, copyBufferToTexture, regionX.

com.mojang.renderpearl.api.commandsinterface112 linesclient3.7 KB

API Surface (0)

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

Fields & Constants (20)

label
colorTexture
clearColor
depthTexture
clearDepth
regionX
regionY
regionWidth
regionHeight
source
sourceX
sourceY
sourceWidth
sourceHeight
destination
destinationX
destinationY
copyWidth
copyHeight
mipLevel

Full Source

CommandEncoder.java112 lines · Minecraft 26.3 · verbatim
1
package com.mojang.renderpearl.api.commands;
2
3
import com.mojang.blaze3d.platform.NativeImage;
4
import com.mojang.renderpearl.api.buffers.GpuBuffer;
5
import com.mojang.renderpearl.api.buffers.GpuBufferSlice;
6
import com.mojang.renderpearl.api.buffers.TransientMemory;
7
import com.mojang.renderpearl.api.textures.GpuTexture;
8
import com.mojang.renderpearl.api.textures.GpuTextureView;
9
import java.nio.ByteBuffer;
10
import java.util.Optional;
11
import java.util.OptionalDouble;
12
import java.util.function.Supplier;
13
import net.fabricmc.api.EnvType;
14
import net.fabricmc.api.Environment;
15
import org.joml.Vector4fc;
16
import org.jspecify.annotations.Nullable;
17
18
@Environment(EnvType.CLIENT)
19
public interface CommandEncoder {
20
	void submit();
21
22
	TransientMemory transientMemory();
23
24
	default RenderPass createRenderPass(final Supplier<String> label, final GpuTextureView colorTexture, final Optional<Vector4fc> clearColor) {
25
		return this.createRenderPass(label, colorTexture, clearColor, null, OptionalDouble.empty());
26
	}
27
28
	default RenderPass createRenderPass(
29
		final Supplier<String> label,
30
		final GpuTextureView colorTexture,
31
		final Optional<Vector4fc> clearColor,
32
		final @Nullable GpuTextureView depthTexture,
33
		final OptionalDouble clearDepth
34
	) {
35
		return this.createRenderPass(
36
			label, colorTexture, clearColor, depthTexture, clearDepth, new RenderPass.RenderArea(0, 0, colorTexture.getWidth(0), colorTexture.getHeight(0))
37
		);
38
	}
39
40
	default RenderPass createRenderPass(
41
		final Supplier<String> label,
42
		final GpuTextureView colorTexture,
43
		final Optional<Vector4fc> clearColor,
44
		final @Nullable GpuTextureView depthTexture,
45
		final OptionalDouble clearDepth,
46
		final RenderPass.RenderArea renderArea
47
	) {
48
		RenderPassDescriptor.Builder descriptor = RenderPassDescriptor.builder(label).withColorAttachment(colorTexture, clearColor);
49
		if (depthTexture != null) {
50
			descriptor.withDepthAttachment(depthTexture, clearDepth);
51
		}
52
53
		descriptor.withRenderArea(renderArea);
54
		return this.createRenderPass(descriptor.build());
55
	}
56
57
	RenderPass createRenderPass(RenderPassDescriptor descriptor);
58
59
	void clearColorTexture(GpuTexture colorTexture, Vector4fc clearColor);
60
61
	void clearColorAndDepthTextures(GpuTexture colorTexture, Vector4fc clearColor, GpuTexture depthTexture, double clearDepth);
62
63
	void clearColorAndDepthTextures(
64
		GpuTexture colorTexture,
65
		Vector4fc clearColor,
66
		GpuTexture depthTexture,
67
		double clearDepth,
68
		int regionX,
69
		int regionY,
70
		int regionWidth,
71
		int regionHeight,
72
		int mipLevel
73
	);
74
75
	void clearDepthTexture(GpuTexture depthTexture, double clearDepth);
76
77
	void writeToBuffer(GpuBufferSlice destination, ByteBuffer data);
78
79
	void copyToBuffer(GpuBufferSlice source, GpuBufferSlice target);
80
81
	void writeToTexture(GpuTexture destination, NativeImage source);
82
83
	void writeToTexture(GpuTexture destination, NativeImage source, int mipLevel, int depthOrLayer, int destX, int destY);
84
85
	void writeToTexture(GpuTexture destination, ByteBuffer source, int mipLevel, int depthOrLayer, int destX, int destY, int width, int height);
86
87
	void copyBufferToTexture(
88
		GpuBufferSlice source,
89
		int sourceX,
90
		int sourceY,
91
		int sourceWidth,
92
		int sourceHeight,
93
		GpuTexture destination,
94
		int destinationX,
95
		int destinationY,
96
		int copyWidth,
97
		int copyHeight,
98
		int mipLevel,
99
		int arrayLayer
100
	);
101
102
	void copyTextureToBuffer(GpuTexture source, GpuBuffer destination, long offset, Runnable callback, int mipLevel);
103
104
	void copyTextureToBuffer(GpuTexture source, GpuBuffer destination, long offset, Runnable callback, int mipLevel, int x, int y, int width, int height);
105
106
	void copyTextureToTexture(GpuTexture source, GpuTexture destination, int mipLevel, int destX, int destY, int sourceX, int sourceY, int width, int height);
107
108
	GpuFence createFence();
109
110
	void writeTimestamp(GpuQueryPool pool, int index);
111
}
112

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