Compare commits

...
Sign in to create a new pull request.

2 commits

Author SHA1 Message Date
2033d36e57 1.21.8 2025-09-18 12:46:36 +00:00
31b6387d6b 1.21.7 2025-09-18 12:37:33 +00:00
1307 changed files with 3256 additions and 3070 deletions

View file

@ -0,0 +1,6 @@
{
"model": {
"type": "minecraft:model",
"model": "minecraft:item/music_disc_lava_chicken"
}
}

View file

@ -4355,6 +4355,8 @@
"item.minecraft.music_disc_creator.desc": "Lena Raine - Creator",
"item.minecraft.music_disc_far": "Music Disc",
"item.minecraft.music_disc_far.desc": "C418 - far",
"item.minecraft.music_disc_lava_chicken": "Music Disc",
"item.minecraft.music_disc_lava_chicken.desc": "Hyper Potions - Lava Chicken",
"item.minecraft.music_disc_mall": "Music Disc",
"item.minecraft.music_disc_mall.desc": "C418 - mall",
"item.minecraft.music_disc_mellohi": "Music Disc",
@ -4751,6 +4753,7 @@
"jukebox_song.minecraft.creator": "Lena Raine - Creator",
"jukebox_song.minecraft.creator_music_box": "Lena Raine - Creator (Music Box)",
"jukebox_song.minecraft.far": "C418 - far",
"jukebox_song.minecraft.lava_chicken": "Hyper Potions - Lava Chicken",
"jukebox_song.minecraft.mall": "C418 - mall",
"jukebox_song.minecraft.mellohi": "C418 - mellohi",
"jukebox_song.minecraft.otherside": "Lena Raine - otherside",
@ -5816,6 +5819,8 @@
"painting.minecraft.courbet.title": "Bonjour Monsieur Courbet",
"painting.minecraft.creebet.author": "Kristoffer Zetterstrand",
"painting.minecraft.creebet.title": "Creebet",
"painting.minecraft.dennis.author": "Sarah Boeving",
"painting.minecraft.dennis.title": "Dennis",
"painting.minecraft.donkey_kong.author": "Kristoffer Zetterstrand",
"painting.minecraft.donkey_kong.title": "Kong",
"painting.minecraft.earth.author": "Mojang",

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/template_music_disc",
"textures": {
"layer0": "minecraft:item/music_disc_lava_chicken"
}
}

BIN
assets/minecraft/textures/item/music_disc_lava_chicken.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/minecraft/textures/painting/dennis.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,77 @@
package com.mojang.blaze3d;
import com.mojang.blaze3d.platform.GLX;
import com.mojang.blaze3d.systems.GpuDevice;
import java.lang.ref.WeakReference;
import java.util.List;
import java.util.Locale;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import org.jetbrains.annotations.Nullable;
@Environment(EnvType.CLIENT)
public class GraphicsWorkarounds {
private static final List<String> INTEL_GEN11_CORE = List.of(
"i3-1000g1",
"i3-1000g4",
"i3-1000ng4",
"i3-1005g1",
"i3-l13g4",
"i5-1030g4",
"i5-1030g7",
"i5-1030ng7",
"i5-1034g1",
"i5-1035g1",
"i5-1035g4",
"i5-1035g7",
"i5-1038ng7",
"i5-l16g7",
"i7-1060g7",
"i7-1060ng7",
"i7-1065g7",
"i7-1068g7",
"i7-1068ng7"
);
private static final List<String> INTEL_GEN11_ATOM = List.of("x6211e", "x6212re", "x6214re", "x6413e", "x6414re", "x6416re", "x6425e", "x6425re", "x6427fe");
private static final List<String> INTEL_GEN11_CELERON = List.of("j6412", "j6413", "n4500", "n4505", "n5095", "n5095a", "n5100", "n5105", "n6210", "n6211");
private static final List<String> INTEL_GEN11_PENTIUM = List.of("6805", "j6426", "n6415", "n6000", "n6005");
@Nullable
private static GraphicsWorkarounds instance;
private final WeakReference<GpuDevice> gpuDevice;
private final boolean alwaysCreateFreshImmediateBuffer;
private GraphicsWorkarounds(GpuDevice device) {
this.gpuDevice = new WeakReference(device);
this.alwaysCreateFreshImmediateBuffer = isIntelGen11(device);
}
public static GraphicsWorkarounds get(GpuDevice device) {
GraphicsWorkarounds graphicsWorkarounds = instance;
if (graphicsWorkarounds == null || graphicsWorkarounds.gpuDevice.get() != device) {
instance = graphicsWorkarounds = new GraphicsWorkarounds(device);
}
return graphicsWorkarounds;
}
public boolean alwaysCreateFreshImmediateBuffer() {
return this.alwaysCreateFreshImmediateBuffer;
}
private static boolean isIntelGen11(GpuDevice device) {
String string = GLX._getCpuInfo().toLowerCase(Locale.ROOT);
String string2 = device.getRenderer().toLowerCase(Locale.ROOT);
if (!string.contains("intel") || !string2.contains("intel") || string2.contains("mesa")) {
return false;
} else if (string2.endsWith("gen11")) {
return true;
} else {
return !string2.contains("uhd graphics") && !string2.contains("iris")
? false
: string.contains("atom") && INTEL_GEN11_ATOM.stream().anyMatch(string::contains)
|| string.contains("celeron") && INTEL_GEN11_CELERON.stream().anyMatch(string::contains)
|| string.contains("pentium") && INTEL_GEN11_PENTIUM.stream().anyMatch(string::contains)
|| INTEL_GEN11_CORE.stream().anyMatch(string::contains);
}
}
}

View file

@ -8,6 +8,7 @@ import org.jetbrains.annotations.Nullable;
import org.lwjgl.opengl.ARBBufferStorage;
import org.lwjgl.opengl.ARBDirectStateAccess;
import org.lwjgl.opengl.GL30;
import org.lwjgl.opengl.GL31;
import org.lwjgl.opengl.GLCapabilities;
@Environment(EnvType.CLIENT)
@ -48,6 +49,8 @@ public abstract class DirectStateAccess {
abstract void flushMappedBufferRange(int buffer, int offset, int length);
abstract void copyBufferSubData(int readBuffer, int writeBuffer, int readOffset, int writeOffset, int size);
@Environment(EnvType.CLIENT)
static class Core extends DirectStateAccess {
@Override
@ -116,6 +119,11 @@ public abstract class DirectStateAccess {
void flushMappedBufferRange(int buffer, int offset, int length) {
ARBDirectStateAccess.glFlushMappedNamedBufferRange(buffer, offset, length);
}
@Override
void copyBufferSubData(int readBuffer, int writeBuffer, int readOffset, int writeOffset, int size) {
ARBDirectStateAccess.glCopyNamedBufferSubData(readBuffer, writeBuffer, readOffset, writeOffset, size);
}
}
@Environment(EnvType.CLIENT)
@ -183,6 +191,15 @@ public abstract class DirectStateAccess {
GlStateManager._glBindBuffer(36663, 0);
}
@Override
void copyBufferSubData(int readBuffer, int writeBuffer, int readOffset, int writeOffset, int size) {
GlStateManager._glBindBuffer(36662, readBuffer);
GlStateManager._glBindBuffer(36663, writeBuffer);
GL31.glCopyBufferSubData(36662, 36663, readOffset, writeOffset, size);
GlStateManager._glBindBuffer(36662, 0);
GlStateManager._glBindBuffer(36663, 0);
}
@Override
public int createFrameBufferObject() {
return GlStateManager.glGenFramebuffers();

View file

@ -3,14 +3,21 @@ package com.mojang.blaze3d.opengl;
import com.mojang.blaze3d.buffers.GpuBuffer;
import com.mojang.blaze3d.buffers.GpuBufferSlice;
import com.mojang.blaze3d.buffers.GpuFence;
import com.mojang.blaze3d.buffers.GpuBuffer.MappedView;
import com.mojang.blaze3d.opengl.Uniform.Sampler;
import com.mojang.blaze3d.opengl.Uniform.Ubo;
import com.mojang.blaze3d.opengl.Uniform.Utb;
import com.mojang.blaze3d.pipeline.BlendFunction;
import com.mojang.blaze3d.pipeline.RenderPipeline;
import com.mojang.blaze3d.platform.DepthTestFunction;
import com.mojang.blaze3d.platform.NativeImage;
import com.mojang.blaze3d.platform.NativeImage.Format;
import com.mojang.blaze3d.shaders.UniformType;
import com.mojang.blaze3d.systems.CommandEncoder;
import com.mojang.blaze3d.systems.RenderPass;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.systems.RenderPass.Draw;
import com.mojang.blaze3d.systems.RenderPass.UniformUploader;
import com.mojang.blaze3d.textures.GpuTexture;
import com.mojang.blaze3d.textures.GpuTextureView;
import com.mojang.blaze3d.textures.TextureFormat;
@ -268,12 +275,12 @@ public class GlCommandEncoder implements CommandEncoder {
}
@Override
public GpuBuffer.MappedView mapBuffer(GpuBuffer gpuBuffer, boolean bl, boolean bl2) {
public MappedView mapBuffer(GpuBuffer gpuBuffer, boolean bl, boolean bl2) {
return this.mapBuffer(gpuBuffer.slice(), bl, bl2);
}
@Override
public GpuBuffer.MappedView mapBuffer(GpuBufferSlice gpuBufferSlice, boolean bl, boolean bl2) {
public MappedView mapBuffer(GpuBufferSlice gpuBufferSlice, boolean bl, boolean bl2) {
if (this.inRenderPass) {
throw new IllegalStateException("Close the existing render pass before performing additional commands");
} else {
@ -311,6 +318,55 @@ public class GlCommandEncoder implements CommandEncoder {
}
}
@Override
public void copyToBuffer(GpuBufferSlice gpuBufferSlice, GpuBufferSlice gpuBufferSlice2) {
if (this.inRenderPass) {
throw new IllegalStateException("Close the existing render pass before performing additional commands");
} else {
GlBuffer glBuffer = (GlBuffer)gpuBufferSlice.buffer();
if (glBuffer.closed) {
throw new IllegalStateException("Source buffer already closed");
} else if ((glBuffer.usage() & 8) == 0) {
throw new IllegalStateException("Source buffer needs USAGE_COPY_DST to be a destination for a copy");
} else {
GlBuffer glBuffer2 = (GlBuffer)gpuBufferSlice2.buffer();
if (glBuffer2.closed) {
throw new IllegalStateException("Target buffer already closed");
} else if ((glBuffer2.usage() & 8) == 0) {
throw new IllegalStateException("Target buffer needs USAGE_COPY_DST to be a destination for a copy");
} else if (gpuBufferSlice.length() != gpuBufferSlice2.length()) {
throw new IllegalArgumentException(
"Cannot copy from slice of size " + gpuBufferSlice.length() + " to slice of size " + gpuBufferSlice2.length() + ", they must be equal"
);
} else if (gpuBufferSlice.offset() + gpuBufferSlice.length() > glBuffer.size) {
throw new IllegalArgumentException(
"Cannot copy more data than the source buffer holds (attempting to copy "
+ gpuBufferSlice.length()
+ " bytes at offset "
+ gpuBufferSlice.offset()
+ " from "
+ glBuffer.size
+ " size buffer)"
);
} else if (gpuBufferSlice2.offset() + gpuBufferSlice2.length() > glBuffer2.size) {
throw new IllegalArgumentException(
"Cannot copy more data than the target buffer can hold (attempting to copy "
+ gpuBufferSlice2.length()
+ " bytes at offset "
+ gpuBufferSlice2.offset()
+ " to "
+ glBuffer2.size
+ " size buffer)"
);
} else {
this.device
.directStateAccess()
.copyBufferSubData(glBuffer.handle, glBuffer2.handle, gpuBufferSlice.offset(), gpuBufferSlice2.offset(), gpuBufferSlice.length());
}
}
}
}
@Override
public void writeToTexture(GpuTexture gpuTexture, NativeImage nativeImage) {
int i = gpuTexture.getWidth(0);
@ -380,7 +436,7 @@ public class GlCommandEncoder implements CommandEncoder {
}
@Override
public void writeToTexture(GpuTexture gpuTexture, IntBuffer intBuffer, NativeImage.Format format, int i, int j, int k, int l, int m, int n) {
public void writeToTexture(GpuTexture gpuTexture, IntBuffer intBuffer, Format format, int i, int j, int k, int l, int m, int n) {
if (this.inRenderPass) {
throw new IllegalStateException("Close the existing render pass before performing additional commands");
} else if (i >= 0 && i < gpuTexture.getMipLevels()) {
@ -605,7 +661,7 @@ public class GlCommandEncoder implements CommandEncoder {
protected <T> void executeDrawMultiple(
GlRenderPass renderPass,
Collection<RenderPass.Draw<T>> draws,
Collection<Draw<T>> draws,
@Nullable GpuBuffer buffer,
@Nullable VertexFormat.IndexType indexType,
Collection<String> uniforms,
@ -616,7 +672,7 @@ public class GlCommandEncoder implements CommandEncoder {
indexType = VertexFormat.IndexType.SHORT;
}
for (RenderPass.Draw<T> draw : draws) {
for (Draw<T> draw : draws) {
VertexFormat.IndexType indexType2 = draw.indexType() == null ? indexType : draw.indexType();
renderPass.setIndexBuffer(draw.indexBuffer() == null ? buffer : draw.indexBuffer(), indexType2);
renderPass.setVertexBuffer(draw.slot(), draw.vertexBuffer());
@ -638,10 +694,10 @@ public class GlCommandEncoder implements CommandEncoder {
}
}
BiConsumer<T, RenderPass.UniformUploader> biConsumer = draw.uniformUploaderConsumer();
BiConsumer<T, UniformUploader> biConsumer = draw.uniformUploaderConsumer();
if (biConsumer != null) {
biConsumer.accept(data, (RenderPass.UniformUploader)(string, gpuBufferSlice) -> {
if (renderPass.pipeline.program().getUniform(string) instanceof Uniform.Ubo(int i)) {
biConsumer.accept(data, (UniformUploader)(string, gpuBufferSlice) -> {
if (renderPass.pipeline.program().getUniform(string) instanceof Ubo(int i)) {
GL32.glBindBufferRange(35345, i, ((GlBuffer)gpuBufferSlice.buffer()).handle, gpuBufferSlice.offset(), gpuBufferSlice.length());
}
});
@ -756,7 +812,7 @@ public class GlCommandEncoder implements CommandEncoder {
}
for (Entry<String, Uniform> entry : renderPass.pipeline.program().getUniforms().entrySet()) {
if (entry.getValue() instanceof Uniform.Sampler) {
if (entry.getValue() instanceof Sampler) {
String string = (String)entry.getKey();
GlTextureView glTextureView = (GlTextureView)renderPass.samplers.get(string);
if (glTextureView == null) {
@ -793,14 +849,14 @@ public class GlCommandEncoder implements CommandEncoder {
String string2 = (String)entry2.getKey();
boolean bl2 = renderPass.dirtyUniforms.contains(string2);
switch ((Uniform)entry2.getValue()) {
case Uniform.Ubo(int var61):
case Ubo(int var61):
int var39 = var61;
if (bl2) {
GpuBufferSlice gpuBufferSlice2 = (GpuBufferSlice)renderPass.uniforms.get(string2);
GL32.glBindBufferRange(35345, var39, ((GlBuffer)gpuBufferSlice2.buffer()).handle, gpuBufferSlice2.offset(), gpuBufferSlice2.length());
}
break;
case Uniform.Utb(int var41, int var42, TextureFormat var43, int var59):
case Utb(int var41, int var42, TextureFormat var43, int var59):
int var44 = var59;
if (bl || bl2) {
GlStateManager._glUniform1i(var41, var42);
@ -813,7 +869,7 @@ public class GlCommandEncoder implements CommandEncoder {
GL31.glTexBuffer(35882, GlConst.toGlInternalId(var43), ((GlBuffer)gpuBufferSlice3.buffer()).handle);
}
break;
case Uniform.Sampler(int glTextureView2, int var51):
case Sampler(int glTextureView2, int var51):
int var46 = var51;
GlTextureView glTextureView2x = (GlTextureView)renderPass.samplers.get(string2);
if (glTextureView2x == null) {

View file

@ -25,13 +25,14 @@ import java.util.function.Supplier;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.renderer.ShaderDefines;
import net.minecraft.client.renderer.ShaderManager;
import net.minecraft.client.renderer.ShaderManager.CompilationException;
import net.minecraft.resources.ResourceLocation;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.Nullable;
import org.lwjgl.glfw.GLFW;
import org.lwjgl.opengl.GL;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL31;
import org.lwjgl.opengl.GLCapabilities;
import org.slf4j.Logger;
@ -303,6 +304,29 @@ public class GlDevice implements GpuDevice {
}
this.shaderCache.clear();
String string = GlStateManager._getString(7937);
if (string.contains("AMD")) {
amdDummyShaderWorkaround();
}
}
private static void amdDummyShaderWorkaround() {
int i = GlStateManager.glCreateShader(35633);
GlStateManager.glShaderSource(i, "#version 150\nvoid main() {\n gl_Position = vec4(0.0);\n}\n");
GlStateManager.glCompileShader(i);
int j = GlStateManager.glCreateShader(35632);
GlStateManager.glShaderSource(
j, "#version 150\nlayout(std140) uniform Dummy {\n float Value;\n};\nout vec4 fragColor;\nvoid main() {\n fragColor = vec4(0.0);\n}\n"
);
GlStateManager.glCompileShader(j);
int k = GlStateManager.glCreateProgram();
GlStateManager.glAttachShader(k, i);
GlStateManager.glAttachShader(k, j);
GlStateManager.glLinkProgram(k);
GL31.glGetUniformBlockIndex(k, "Dummy");
GlStateManager.glDeleteShader(i);
GlStateManager.glDeleteShader(j);
GlStateManager.glDeleteProgram(k);
}
@Override
@ -371,7 +395,7 @@ public class GlDevice implements GpuDevice {
GlProgram glProgram;
try {
glProgram = GlProgram.link(glShaderModule, glShaderModule2, pipeline.getVertexFormat(), pipeline.getLocation().toString());
} catch (ShaderManager.CompilationException var7) {
} catch (CompilationException var7) {
LOGGER.error("Couldn't compile program for pipeline {}: {}", pipeline.getLocation(), var7);
return new GlRenderPipeline(pipeline, GlProgram.INVALID_PROGRAM);
}

View file

@ -1,7 +1,10 @@
package com.mojang.blaze3d.opengl;
import com.google.common.collect.Sets;
import com.mojang.blaze3d.pipeline.RenderPipeline;
import com.mojang.blaze3d.opengl.Uniform.Sampler;
import com.mojang.blaze3d.opengl.Uniform.Ubo;
import com.mojang.blaze3d.opengl.Uniform.Utb;
import com.mojang.blaze3d.pipeline.RenderPipeline.UniformDescription;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.textures.TextureFormat;
import com.mojang.blaze3d.vertex.VertexFormat;
@ -13,7 +16,7 @@ import java.util.Objects;
import java.util.Set;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.renderer.ShaderManager;
import net.minecraft.client.renderer.ShaderManager.CompilationException;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.VisibleForTesting;
import org.lwjgl.opengl.GL31;
@ -33,10 +36,10 @@ public class GlProgram implements AutoCloseable {
this.debugLabel = debugLabel;
}
public static GlProgram link(GlShaderModule vertexShader, GlShaderModule fragmentShader, VertexFormat vertexFormat, String debugLabel) throws ShaderManager.CompilationException {
public static GlProgram link(GlShaderModule vertexShader, GlShaderModule fragmentShader, VertexFormat vertexFormat, String debugLabel) throws CompilationException {
int i = GlStateManager.glCreateProgram();
if (i <= 0) {
throw new ShaderManager.CompilationException("Could not create shader program (returned program ID " + i + ")");
throw new CompilationException("Could not create shader program (returned program ID " + i + ")");
} else {
int j = 0;
@ -49,22 +52,26 @@ public class GlProgram implements AutoCloseable {
GlStateManager.glAttachShader(i, fragmentShader.getShaderId());
GlStateManager.glLinkProgram(i);
int k = GlStateManager.glGetProgrami(i, 35714);
if (k == 0) {
String string = GlStateManager.glGetProgramInfoLog(i, 32768);
throw new ShaderManager.CompilationException(
String string = GlStateManager.glGetProgramInfoLog(i, 32768);
if (k != 0 && !string.contains("Failed for unknown reason")) {
if (!string.isEmpty()) {
LOGGER.info("Info log when linking program containing VS {} and FS {}. Log output: {}", vertexShader.getId(), fragmentShader.getId(), string);
}
return new GlProgram(i, debugLabel);
} else {
throw new CompilationException(
"Error encountered when linking program containing VS " + vertexShader.getId() + " and FS " + fragmentShader.getId() + ". Log output: " + string
);
} else {
return new GlProgram(i, debugLabel);
}
}
}
public void setupUniforms(List<RenderPipeline.UniformDescription> uniforms, List<String> samplers) {
public void setupUniforms(List<UniformDescription> uniforms, List<String> samplers) {
int i = 0;
int j = 0;
for (RenderPipeline.UniformDescription uniformDescription : uniforms) {
for (UniformDescription uniformDescription : uniforms) {
String string = uniformDescription.name();
Object var10000_1 = switch (uniformDescription.type()) {
@ -75,7 +82,7 @@ public class GlProgram implements AutoCloseable {
} else {
int l = i++;
GL31.glUniformBlockBinding(this.programId, k, l);
yield new Uniform.Ubo(l);
yield new Ubo(l);
}
}
case TEXEL_BUFFER -> {
@ -85,7 +92,7 @@ public class GlProgram implements AutoCloseable {
yield null;
} else {
int l = j++;
yield new Uniform.Utb(k, l, (TextureFormat)Objects.requireNonNull(uniformDescription.textureFormat()));
yield new Utb(k, l, (TextureFormat)Objects.requireNonNull(uniformDescription.textureFormat()));
}
}
};
@ -102,7 +109,7 @@ public class GlProgram implements AutoCloseable {
LOGGER.warn("{} shader program does not use sampler {} defined in the pipeline. This might be a bug.", this.debugLabel, string2);
} else {
int n = j++;
this.uniformsByName.put(string2, new Uniform.Sampler(m, n));
this.uniformsByName.put(string2, new Sampler(m, n));
}
}
@ -114,7 +121,7 @@ public class GlProgram implements AutoCloseable {
if (!samplers.contains(string) && BUILT_IN_UNIFORMS.contains(string)) {
int n = i++;
GL31.glUniformBlockBinding(this.programId, p, n);
this.uniformsByName.put(string, new Uniform.Ubo(n));
this.uniformsByName.put(string, new Ubo(n));
} else {
LOGGER.warn("Found unknown and unsupported uniform {} in {}", string, this.debugLabel);
}

View file

@ -2,6 +2,7 @@ package com.mojang.blaze3d.opengl;
import com.mojang.blaze3d.vertex.VertexFormat;
import com.mojang.blaze3d.vertex.VertexFormatElement;
import com.mojang.blaze3d.vertex.VertexFormatElement.Type;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -69,7 +70,7 @@ public abstract class VertexArrayCache {
case POSITION:
case GENERIC:
case UV:
if (vertexFormatElement.type() == VertexFormatElement.Type.FLOAT) {
if (vertexFormatElement.type() == Type.FLOAT) {
GlStateManager._vertexAttribPointer(
j, vertexFormatElement.count(), GlConst.toGl(vertexFormatElement.type()), false, i, vertexFormat.getOffset(vertexFormatElement)
);
@ -111,7 +112,6 @@ public abstract class VertexArrayCache {
if (vertexArray == null) {
int i = GlStateManager._glGenVertexArrays();
GlStateManager._glBindVertexArray(i);
ARBVertexAttribBinding.glBindVertexBuffer(0, buffer.handle, 0L, format.getVertexSize());
List<VertexFormatElement> list = format.getElements();
for (int j = 0; j < list.size(); j++) {
@ -121,7 +121,7 @@ public abstract class VertexArrayCache {
case POSITION:
case GENERIC:
case UV:
if (vertexFormatElement.type() == VertexFormatElement.Type.FLOAT) {
if (vertexFormatElement.type() == Type.FLOAT) {
ARBVertexAttribBinding.glVertexAttribFormat(
j, vertexFormatElement.count(), GlConst.toGl(vertexFormatElement.type()), false, format.getOffset(vertexFormatElement)
);
@ -141,6 +141,7 @@ public abstract class VertexArrayCache {
ARBVertexAttribBinding.glVertexAttribBinding(j, 0);
}
ARBVertexAttribBinding.glBindVertexBuffer(0, buffer.handle, 0L, format.getVertexSize());
VertexArrayCache.VertexArray vertexArray2 = new VertexArrayCache.VertexArray(i, format, buffer);
this.debugLabels.applyLabel(vertexArray2);
this.cache.put(format, vertexArray2);

View file

@ -22,6 +22,9 @@ public record BlendFunction(SourceFactor sourceColor, DestFactor destColor, Sour
public static final BlendFunction ENTITY_OUTLINE_BLIT = new BlendFunction(
SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA, SourceFactor.ZERO, DestFactor.ONE
);
public static final BlendFunction INVERT = new BlendFunction(
SourceFactor.ONE_MINUS_DST_COLOR, DestFactor.ONE_MINUS_SRC_COLOR, SourceFactor.ONE, DestFactor.ZERO
);
public BlendFunction(SourceFactor sourceFactor, DestFactor destFactor) {
this(sourceFactor, destFactor, sourceFactor, destFactor);

View file

@ -343,6 +343,7 @@ public class RenderPipeline {
return this;
}
@Deprecated
public RenderPipeline.Builder withColorLogic(LogicOp logicOp) {
this.colorLogic = Optional.of(logicOp);
return this;

View file

@ -428,13 +428,13 @@ public final class NativeImage implements AutoCloseable {
this.copyRect(this, xFrom, yFrom, xFrom + xToDelta, yFrom + yToDelta, width, height, mirrorX, mirrorY);
}
public void copyRect(NativeImage source, int xFrom, int yFrom, int xTo, int yTo, int width, int height, boolean mirrorX, boolean mirrorY) {
public void copyRect(NativeImage target, int xFrom, int yFrom, int xTo, int yTo, int width, int height, boolean mirrorX, boolean mirrorY) {
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
int k = mirrorX ? width - 1 - j : j;
int l = mirrorY ? height - 1 - i : i;
int m = this.getPixelABGR(xFrom + j, yFrom + i);
source.setPixelABGR(xTo + k, yTo + l, m);
target.setPixelABGR(xTo + k, yTo + l, m);
}
}
}

View file

@ -4,7 +4,9 @@ import com.mojang.blaze3d.DontObfuscate;
import com.mojang.blaze3d.buffers.GpuBuffer;
import com.mojang.blaze3d.buffers.GpuBufferSlice;
import com.mojang.blaze3d.buffers.GpuFence;
import com.mojang.blaze3d.buffers.GpuBuffer.MappedView;
import com.mojang.blaze3d.platform.NativeImage;
import com.mojang.blaze3d.platform.NativeImage.Format;
import com.mojang.blaze3d.textures.GpuTexture;
import com.mojang.blaze3d.textures.GpuTextureView;
import java.nio.ByteBuffer;
@ -35,15 +37,17 @@ public interface CommandEncoder {
void writeToBuffer(GpuBufferSlice gpuBufferSlice, ByteBuffer byteBuffer);
GpuBuffer.MappedView mapBuffer(GpuBuffer gpuBuffer, boolean bl, boolean bl2);
MappedView mapBuffer(GpuBuffer gpuBuffer, boolean bl, boolean bl2);
GpuBuffer.MappedView mapBuffer(GpuBufferSlice gpuBufferSlice, boolean bl, boolean bl2);
MappedView mapBuffer(GpuBufferSlice gpuBufferSlice, boolean bl, boolean bl2);
void copyToBuffer(GpuBufferSlice gpuBufferSlice, GpuBufferSlice gpuBufferSlice2);
void writeToTexture(GpuTexture gpuTexture, NativeImage nativeImage);
void writeToTexture(GpuTexture gpuTexture, NativeImage nativeImage, int i, int j, int k, int l, int m, int n, int o, int p);
void writeToTexture(GpuTexture gpuTexture, IntBuffer intBuffer, NativeImage.Format format, int i, int j, int k, int l, int m, int n);
void writeToTexture(GpuTexture gpuTexture, IntBuffer intBuffer, Format format, int i, int j, int k, int l, int m, int n);
void copyTextureToBuffer(GpuTexture gpuTexture, GpuBuffer gpuBuffer, int i, Runnable runnable, int j);

View file

@ -3,6 +3,7 @@ package com.mojang.blaze3d.vertex;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.mojang.blaze3d.DontObfuscate;
import com.mojang.blaze3d.GraphicsWorkarounds;
import com.mojang.blaze3d.buffers.GpuBuffer;
import com.mojang.blaze3d.systems.CommandEncoder;
import com.mojang.blaze3d.systems.GpuDevice;
@ -12,14 +13,20 @@ import it.unimi.dsi.fastutil.ints.IntList;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.List;
import java.util.function.Supplier;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.Util;
import net.minecraft.Util.OS;
import org.jetbrains.annotations.Nullable;
@Environment(EnvType.CLIENT)
@DontObfuscate
public class VertexFormat {
public static final int UNKNOWN_ELEMENT = -1;
private static final boolean USE_STAGING_BUFFER_WORKAROUND = Util.getPlatform() == OS.WINDOWS && Util.isAarch64();
@Nullable
private static GpuBuffer UPLOAD_STAGING_BUFFER;
private final List<VertexFormatElement> elements;
private final List<String> names;
private final int vertexSize;
@ -102,37 +109,60 @@ public class VertexFormat {
return this.elementsMask * 31 + Arrays.hashCode(this.offsetsByElement);
}
public GpuBuffer uploadImmediateVertexBuffer(ByteBuffer byteBuffer) {
private static GpuBuffer uploadToBuffer(@Nullable GpuBuffer gpuBuffer, ByteBuffer byteBuffer, int i, Supplier<String> supplier) {
GpuDevice gpuDevice = RenderSystem.getDevice();
if (this.immediateDrawVertexBuffer == null) {
this.immediateDrawVertexBuffer = gpuDevice.createBuffer(() -> "Immediate vertex buffer for " + this, 40, byteBuffer);
if (gpuBuffer == null) {
gpuBuffer = gpuDevice.createBuffer(supplier, i, byteBuffer);
} else {
CommandEncoder commandEncoder = gpuDevice.createCommandEncoder();
if (this.immediateDrawVertexBuffer.size() < byteBuffer.remaining()) {
this.immediateDrawVertexBuffer.close();
this.immediateDrawVertexBuffer = gpuDevice.createBuffer(() -> "Immediate vertex buffer for " + this, 40, byteBuffer);
if (gpuBuffer.size() < byteBuffer.remaining()) {
gpuBuffer.close();
gpuBuffer = gpuDevice.createBuffer(supplier, i, byteBuffer);
} else {
commandEncoder.writeToBuffer(this.immediateDrawVertexBuffer.slice(), byteBuffer);
commandEncoder.writeToBuffer(gpuBuffer.slice(), byteBuffer);
}
}
return gpuBuffer;
}
private GpuBuffer uploadToBufferWithWorkaround(@Nullable GpuBuffer gpuBuffer, ByteBuffer byteBuffer, int i, Supplier<String> supplier) {
GpuDevice gpuDevice = RenderSystem.getDevice();
if (USE_STAGING_BUFFER_WORKAROUND) {
if (gpuBuffer == null) {
gpuBuffer = gpuDevice.createBuffer(supplier, i, byteBuffer);
} else {
CommandEncoder commandEncoder = gpuDevice.createCommandEncoder();
if (gpuBuffer.size() < byteBuffer.remaining()) {
gpuBuffer.close();
gpuBuffer = gpuDevice.createBuffer(supplier, i, byteBuffer);
} else {
UPLOAD_STAGING_BUFFER = uploadToBuffer(UPLOAD_STAGING_BUFFER, byteBuffer, i, supplier);
commandEncoder.copyToBuffer(UPLOAD_STAGING_BUFFER.slice(0, byteBuffer.remaining()), gpuBuffer.slice(0, byteBuffer.remaining()));
}
}
return gpuBuffer;
} else if (GraphicsWorkarounds.get(gpuDevice).alwaysCreateFreshImmediateBuffer()) {
if (gpuBuffer != null) {
gpuBuffer.close();
}
return gpuDevice.createBuffer(supplier, i, byteBuffer);
} else {
return uploadToBuffer(gpuBuffer, byteBuffer, i, supplier);
}
}
public GpuBuffer uploadImmediateVertexBuffer(ByteBuffer byteBuffer) {
this.immediateDrawVertexBuffer = this.uploadToBufferWithWorkaround(
this.immediateDrawVertexBuffer, byteBuffer, 40, () -> "Immediate vertex buffer for " + this
);
return this.immediateDrawVertexBuffer;
}
public GpuBuffer uploadImmediateIndexBuffer(ByteBuffer byteBuffer) {
GpuDevice gpuDevice = RenderSystem.getDevice();
if (this.immediateDrawIndexBuffer == null) {
this.immediateDrawIndexBuffer = RenderSystem.getDevice().createBuffer(() -> "Immediate index buffer for " + this, 72, byteBuffer);
} else {
CommandEncoder commandEncoder = gpuDevice.createCommandEncoder();
if (this.immediateDrawIndexBuffer.size() < byteBuffer.remaining()) {
this.immediateDrawIndexBuffer.close();
this.immediateDrawIndexBuffer = RenderSystem.getDevice().createBuffer(() -> "Immediate index buffer for " + this, 72, byteBuffer);
} else {
commandEncoder.writeToBuffer(this.immediateDrawIndexBuffer.slice(), byteBuffer);
}
}
this.immediateDrawIndexBuffer = this.uploadToBufferWithWorkaround(this.immediateDrawIndexBuffer, byteBuffer, 72, () -> "Immediate index buffer for " + this);
return this.immediateDrawIndexBuffer;
}

View file

@ -8,6 +8,6 @@
"description": {
"translate": "dataPack.minecart_improvements.description"
},
"pack_format": 80
"pack_format": 81
}
}

View file

@ -8,6 +8,6 @@
"description": {
"translate": "dataPack.redstone_experiments.description"
},
"pack_format": 80
"pack_format": 81
}
}

View file

@ -8,6 +8,6 @@
"description": {
"translate": "dataPack.trade_rebalance.description"
},
"pack_format": 80
"pack_format": 81
}
}

View file

@ -0,0 +1,8 @@
{
"comparator_output": 9,
"description": {
"translate": "jukebox_song.minecraft.lava_chicken"
},
"length_in_seconds": 134.0,
"sound_event": "minecraft:music_disc.lava_chicken"
}

View file

@ -101,6 +101,33 @@
}
],
"rolls": 1.0
},
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:killed_by_player"
},
{
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"flags": {
"is_baby": true
},
"vehicle": {
"type": "minecraft:chicken"
}
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:music_disc_lava_chicken"
}
],
"rolls": 1.0
}
],
"random_sequence": "minecraft:entities/zombie"

View file

@ -0,0 +1,13 @@
{
"asset_id": "minecraft:dennis",
"author": {
"color": "gray",
"translate": "painting.minecraft.dennis.author"
},
"height": 3,
"title": {
"color": "yellow",
"translate": "painting.minecraft.dennis.title"
},
"width": 3
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
data/minecraft/structure/empty.nbt (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
data/minecraft/structure/end_city/ship.nbt (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
data/minecraft/structure/igloo/bottom.nbt (Stored with Git LFS)

Binary file not shown.

BIN
data/minecraft/structure/igloo/middle.nbt (Stored with Git LFS)

Binary file not shown.

BIN
data/minecraft/structure/igloo/top.nbt (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more