mirror of
https://github.com/barkeser2002/Tenet.git
synced 2026-09-25 08:00:07 +03:00
56 lines
2.9 KiB
Diff
56 lines
2.9 KiB
Diff
--- a/com/mojang/blaze3d/pipeline/RenderTarget.java
|
|
+++ b/com/mojang/blaze3d/pipeline/RenderTarget.java
|
|
@@ -104,7 +_,10 @@
|
|
GlStateManager._texParameter(3553, 34892, 0);
|
|
GlStateManager._texParameter(3553, 10242, 33071);
|
|
GlStateManager._texParameter(3553, 10243, 33071);
|
|
+ if (!stencilEnabled)
|
|
GlStateManager._texImage2D(3553, 0, 6402, this.width, this.height, 0, 6402, 5126, null);
|
|
+ else
|
|
+ GlStateManager._texImage2D(3553, 0, org.lwjgl.opengl.GL30.GL_DEPTH32F_STENCIL8, this.width, this.height, 0, org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL, org.lwjgl.opengl.GL30.GL_FLOAT_32_UNSIGNED_INT_24_8_REV, null);
|
|
}
|
|
|
|
this.setFilterMode(9728, true);
|
|
@@ -114,8 +_,13 @@
|
|
GlStateManager._texImage2D(3553, 0, 32856, this.width, this.height, 0, 6408, 5121, null);
|
|
GlStateManager._glBindFramebuffer(36160, this.frameBufferId);
|
|
GlStateManager._glFramebufferTexture2D(36160, 36064, 3553, this.colorTextureId, 0);
|
|
- if (this.useDepth) {
|
|
+ if (this.useDepth && !stencilEnabled) {
|
|
GlStateManager._glFramebufferTexture2D(36160, 36096, 3553, this.depthBufferId, 0);
|
|
+ } else if(this.useDepth && net.minecraftforge.common.ForgeConfig.CLIENT.useCombinedDepthStencilAttachment.get()) {
|
|
+ GlStateManager._glFramebufferTexture2D(org.lwjgl.opengl.GL30.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL_ATTACHMENT, 3553, this.depthBufferId, 0);
|
|
+ } else if (this.useDepth) {
|
|
+ GlStateManager._glFramebufferTexture2D(org.lwjgl.opengl.GL30.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_DEPTH_ATTACHMENT, 3553, this.depthBufferId, 0);
|
|
+ GlStateManager._glFramebufferTexture2D(org.lwjgl.opengl.GL30.GL_FRAMEBUFFER, org.lwjgl.opengl.GL30.GL_STENCIL_ATTACHMENT, 3553, this.depthBufferId, 0);
|
|
}
|
|
|
|
this.checkStatus();
|
|
@@ -257,5 +_,26 @@
|
|
|
|
public int getDepthTextureId() {
|
|
return this.depthBufferId;
|
|
+ }
|
|
+
|
|
+ private boolean stencilEnabled = false;
|
|
+ /**
|
|
+ * Attempts to enable 8 bits of stencil buffer on this FrameBuffer.
|
|
+ * Modders must call this directly to set things up.
|
|
+ * This is to prevent the default cause where graphics cards do not support stencil bits.
|
|
+ * <b>Make sure to call this on the main render thread!</b>
|
|
+ */
|
|
+ public void enableStencil() {
|
|
+ if (stencilEnabled) return;
|
|
+ stencilEnabled = true;
|
|
+ this.resize(viewWidth, viewHeight, net.minecraft.client.Minecraft.ON_OSX);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Returns wither or not this FBO has been successfully initialized with stencil bits.
|
|
+ * If not, and a modder wishes it to be, they must call enableStencil.
|
|
+ */
|
|
+ public boolean isStencilEnabled() {
|
|
+ return this.stencilEnabled;
|
|
}
|
|
}
|