mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-28 23:59:00 +00:00
39 lines
1.6 KiB
Diff
39 lines
1.6 KiB
Diff
--- a/com/mojang/blaze3d/pipeline/RenderTarget.java
|
|
+++ b/com/mojang/blaze3d/pipeline/RenderTarget.java
|
|
@@ -75,7 +_,7 @@
|
|
this.width = p_83951_;
|
|
this.height = p_83952_;
|
|
if (this.useDepth) {
|
|
- this.depthTexture = RenderSystem.getDevice().createTexture(() -> this.label + " / Depth", TextureFormat.DEPTH32, p_83951_, p_83952_, 1);
|
|
+ this.depthTexture = RenderSystem.getDevice().createTexture(() -> this.label + " / Depth", TextureFormat.DEPTH32, p_83951_, p_83952_, 1, this.stencilEnabled);
|
|
this.depthTexture.setTextureFilter(FilterMode.NEAREST, false);
|
|
this.depthTexture.setAddressMode(AddressMode.CLAMP_TO_EDGE);
|
|
}
|
|
@@ -134,5 +_,26 @@
|
|
@Nullable
|
|
public GpuTexture getDepthTexture() {
|
|
return this.depthTexture;
|
|
+ }
|
|
+
|
|
+ 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);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * 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;
|
|
}
|
|
}
|