Attempt to use a more compatible method to initialize stencil support.

In case the separate attachments don't work for everyone, there's a new setting to choose the combined attachment.
This commit is contained in:
David Quintana 2020-07-03 14:40:21 +02:00
parent a690a7526a
commit 8e5138da27
3 changed files with 16 additions and 5 deletions

View file

@ -11,18 +11,22 @@
}
this.func_147607_a(9728);
@@ -127,7 +130,10 @@
@@ -127,7 +130,14 @@
GlStateManager.func_227727_h_(FramebufferConstants.field_227592_a_, this.field_147616_f);
GlStateManager.func_227645_a_(FramebufferConstants.field_227592_a_, FramebufferConstants.field_227594_c_, 3553, this.field_147617_g, 0);
if (this.field_147619_e) {
+ if(!stencilEnabled)
GlStateManager.func_227645_a_(FramebufferConstants.field_227592_a_, FramebufferConstants.field_227595_d_, 3553, this.field_147624_h, 0);
+ else
+ else if(net.minecraftforge.common.ForgeConfig.CLIENT.useCombinedDepthStencilAttachment.get()) {
+ GlStateManager.func_227645_a_(FramebufferConstants.field_227592_a_, org.lwjgl.opengl.GL30.GL_DEPTH_STENCIL_ATTACHMENT, 3553, this.field_147624_h, 0);
+ } else {
+ GlStateManager.func_227645_a_(FramebufferConstants.field_227592_a_, org.lwjgl.opengl.GL30.GL_DEPTH_ATTACHMENT, 3553, this.field_147624_h, 0);
+ GlStateManager.func_227645_a_(FramebufferConstants.field_227592_a_, org.lwjgl.opengl.GL30.GL_STENCIL_ATTACHMENT, 3553, this.field_147624_h, 0);
+ }
}
this.func_147611_b();
@@ -280,4 +286,30 @@
@@ -280,4 +290,30 @@
GlStateManager.func_227658_a_(i, p_216493_1_);
this.func_147609_e();
}

View file

@ -139,6 +139,8 @@ public class ForgeConfig
public final BooleanValue showLoadWarnings;
public final BooleanValue useCombinedDepthStencilAttachment;
Client(ForgeConfigSpec.Builder builder) {
builder.comment("Client only settings, mostly things related to rendering")
.push("client");
@ -184,6 +186,11 @@ public class ForgeConfig
.translation("forge.configgui.showLoadWarnings")
.define("showLoadWarnings", true);
useCombinedDepthStencilAttachment = builder
.comment("Set to true to use a combined DEPTH_STENCIL attachment instead of two separate ones.")
.translation("forge.configgui.useCombinedDepthStencilAttachment")
.define("useCombinedDepthStencilAttachment", false);
builder.pop();
}
}

View file

@ -28,7 +28,7 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
@Mod("stencil_enable_test")
public class StencilEnableTest {
public static boolean ENABLED = false;
public static boolean ENABLED = true;
public StencilEnableTest() {
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup);