-
-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '1.21.x' into l10n_1.21.x
- Loading branch information
Showing
84 changed files
with
1,836 additions
and
394 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- a/com/mojang/blaze3d/pipeline/MainTarget.java | ||
+++ b/com/mojang/blaze3d/pipeline/MainTarget.java | ||
@@ -16,7 +_,10 @@ | ||
static final MainTarget.Dimension DEFAULT_DIMENSIONS = new MainTarget.Dimension(854, 480); | ||
|
||
public MainTarget(int p_166137_, int p_166138_) { | ||
- super(true); | ||
+ this(p_166137_, p_166138_, false); | ||
+ } | ||
+ public MainTarget(int p_166137_, int p_166138_, boolean enableStencil) { | ||
+ super(true, enableStencil); | ||
this.createFrameBuffer(p_166137_, p_166138_); | ||
} | ||
|
||
@@ -37,6 +_,14 @@ | ||
GlStateManager._texParameter(3553, 10242, 33071); | ||
GlStateManager._texParameter(3553, 10243, 33071); | ||
GlStateManager._glFramebufferTexture2D(36160, 36096, 3553, this.depthBufferId, 0); | ||
+ if (this.useStencil) { | ||
+ GlStateManager._glFramebufferTexture2D( | ||
+ org.lwjgl.opengl.GL32.GL_FRAMEBUFFER, | ||
+ org.lwjgl.opengl.GL32.GL_STENCIL_ATTACHMENT, | ||
+ org.lwjgl.opengl.GL32.GL_TEXTURE_2D, | ||
+ this.depthBufferId, | ||
+ 0); | ||
+ } | ||
GlStateManager._bindTexture(0); | ||
this.viewWidth = maintarget$dimension.width; | ||
this.viewHeight = maintarget$dimension.height; | ||
@@ -82,7 +_,11 @@ | ||
RenderSystem.assertOnRenderThreadOrInit(); | ||
GlStateManager._getError(); | ||
GlStateManager._bindTexture(this.depthBufferId); | ||
- GlStateManager._texImage2D(3553, 0, 6402, p_166145_.width, p_166145_.height, 0, 6402, 5126, null); | ||
+ if (!this.useStencil) { | ||
+ GlStateManager._texImage2D(3553, 0, 6402, p_166145_.width, p_166145_.height, 0, 6402, 5126, null); | ||
+ } else { | ||
+ net.neoforged.neoforge.client.ClientHooks.texImageDepthStencil(p_166145_.width, p_166145_.height); | ||
+ } | ||
return GlStateManager._getError() != 1285; | ||
} | ||
|
66 changes: 66 additions & 0 deletions
66
patches/com/mojang/blaze3d/pipeline/RenderTarget.java.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- a/com/mojang/blaze3d/pipeline/RenderTarget.java | ||
+++ b/com/mojang/blaze3d/pipeline/RenderTarget.java | ||
@@ -25,6 +_,7 @@ | ||
public int viewWidth; | ||
public int viewHeight; | ||
public final boolean useDepth; | ||
+ public final boolean useStencil; | ||
public int frameBufferId; | ||
protected int colorTextureId; | ||
protected int depthBufferId; | ||
@@ -32,7 +_,15 @@ | ||
public int filterMode; | ||
|
||
public RenderTarget(boolean p_166199_) { | ||
- this.useDepth = p_166199_; | ||
+ this(p_166199_, false); | ||
+ } | ||
+ | ||
+ public RenderTarget(boolean useDepth, boolean useStencil) { | ||
+ if (useStencil && !useDepth) { | ||
+ throw new IllegalArgumentException("Stencil can only be enabled if depth is enabled."); | ||
+ } | ||
+ this.useDepth = useDepth; | ||
+ this.useStencil = useStencil; | ||
this.frameBufferId = -1; | ||
this.colorTextureId = -1; | ||
this.depthBufferId = -1; | ||
@@ -96,7 +_,11 @@ | ||
GlStateManager._texParameter(3553, 34892, 0); | ||
GlStateManager._texParameter(3553, 10242, 33071); | ||
GlStateManager._texParameter(3553, 10243, 33071); | ||
- GlStateManager._texImage2D(3553, 0, 6402, this.width, this.height, 0, 6402, 5126, null); | ||
+ if (!this.useStencil) { | ||
+ GlStateManager._texImage2D(3553, 0, 6402, this.width, this.height, 0, 6402, 5126, null); | ||
+ } else { | ||
+ net.neoforged.neoforge.client.ClientHooks.texImageDepthStencil(this.width, this.height); | ||
+ } | ||
} | ||
|
||
this.setFilterMode(9728, true); | ||
@@ -109,6 +_,14 @@ | ||
if (this.useDepth) { | ||
GlStateManager._glFramebufferTexture2D(36160, 36096, 3553, this.depthBufferId, 0); | ||
} | ||
+ if (this.useStencil) { | ||
+ GlStateManager._glFramebufferTexture2D( | ||
+ org.lwjgl.opengl.GL32.GL_FRAMEBUFFER, | ||
+ org.lwjgl.opengl.GL32.GL_STENCIL_ATTACHMENT, | ||
+ org.lwjgl.opengl.GL32.GL_TEXTURE_2D, | ||
+ this.depthBufferId, | ||
+ 0); | ||
+ } | ||
|
||
this.checkStatus(); | ||
this.clear(); | ||
@@ -217,6 +_,10 @@ | ||
if (this.useDepth) { | ||
GlStateManager._clearDepth(1.0); | ||
i |= 256; | ||
+ } | ||
+ if (this.useStencil) { | ||
+ GlStateManager._clearStencil(0); | ||
+ i |= org.lwjgl.opengl.GL32.GL_STENCIL_BUFFER_BIT; | ||
} | ||
|
||
GlStateManager._clear(i); |
14 changes: 14 additions & 0 deletions
14
patches/com/mojang/blaze3d/pipeline/TextureTarget.java.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- a/com/mojang/blaze3d/pipeline/TextureTarget.java | ||
+++ b/com/mojang/blaze3d/pipeline/TextureTarget.java | ||
@@ -7,7 +_,10 @@ | ||
@OnlyIn(Dist.CLIENT) | ||
public class TextureTarget extends RenderTarget { | ||
public TextureTarget(int p_166213_, int p_166214_, boolean p_166215_) { | ||
- super(p_166215_); | ||
+ this(p_166213_, p_166214_, p_166215_, false); | ||
+ } | ||
+ public TextureTarget(int p_166213_, int p_166214_, boolean p_166215_, boolean useStencil) { | ||
+ super(p_166215_, useStencil); | ||
RenderSystem.assertOnRenderThreadOrInit(); | ||
this.resize(p_166213_, p_166214_); | ||
} |
18 changes: 18 additions & 0 deletions
18
patches/com/mojang/blaze3d/resource/RenderTargetDescriptor.java.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- a/com/mojang/blaze3d/resource/RenderTargetDescriptor.java | ||
+++ b/com/mojang/blaze3d/resource/RenderTargetDescriptor.java | ||
@@ -6,9 +_,13 @@ | ||
import net.neoforged.api.distmarker.OnlyIn; | ||
|
||
@OnlyIn(Dist.CLIENT) | ||
-public record RenderTargetDescriptor(int width, int height, boolean useDepth) implements ResourceDescriptor<RenderTarget> { | ||
+public record RenderTargetDescriptor(int width, int height, boolean useDepth, boolean useStencil) implements ResourceDescriptor<RenderTarget> { | ||
+ public RenderTargetDescriptor(int width, int height, boolean useDepth) { | ||
+ this(width, height, useDepth, false); | ||
+ } | ||
+ | ||
public RenderTarget allocate() { | ||
- return new TextureTarget(this.width, this.height, this.useDepth); | ||
+ return new TextureTarget(this.width, this.height, this.useDepth, this.useStencil); | ||
} | ||
|
||
public void free(RenderTarget p_363223_) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.