|
6 | 6 | import com.mojang.blaze3d.vertex.VertexSorting;
|
7 | 7 | import net.irisshaders.iris.Iris;
|
8 | 8 | import net.irisshaders.iris.gl.sampler.SamplerLimits;
|
| 9 | +import net.irisshaders.iris.gl.texture.TextureType; |
9 | 10 | import net.irisshaders.iris.mixin.GlStateManagerAccessor;
|
10 | 11 | import net.minecraft.client.Minecraft;
|
11 | 12 | import net.minecraft.client.gui.screens.Screen;
|
|
14 | 15 | import org.joml.Vector3i;
|
15 | 16 | import org.lwjgl.opengl.ARBDirectStateAccess;
|
16 | 17 | import org.lwjgl.opengl.ARBDrawBuffersBlend;
|
| 18 | +import org.lwjgl.opengl.ARBTextureSwizzle; |
17 | 19 | import org.lwjgl.opengl.EXTShaderImageLoadStore;
|
18 | 20 | import org.lwjgl.opengl.GL;
|
19 | 21 | import org.lwjgl.opengl.GL30C;
|
@@ -44,6 +46,7 @@ public class IrisRenderSystem {
|
44 | 46 | private static int polygonMode = GL43C.GL_FILL;
|
45 | 47 | private static int backupPolygonMode = GL43C.GL_FILL;
|
46 | 48 | private static int[] samplers;
|
| 49 | + private static int textureToUnswizzle; |
47 | 50 |
|
48 | 51 | public static void initRenderer() {
|
49 | 52 | if (GL.getCapabilities().OpenGL45) {
|
@@ -486,6 +489,18 @@ public static void restoreCullingState() {
|
486 | 489 | cullingState = true;
|
487 | 490 | }
|
488 | 491 |
|
| 492 | + public static void onProgramUse() { |
| 493 | + if (textureToUnswizzle != 0) { |
| 494 | + IrisRenderSystem.texParameteriv(textureToUnswizzle, TextureType.TEXTURE_2D.getGlType(), ARBTextureSwizzle.GL_TEXTURE_SWIZZLE_RGBA, |
| 495 | + new int[]{GL30C.GL_RED, GL30C.GL_GREEN, GL30C.GL_BLUE, GL30C.GL_ALPHA}); |
| 496 | + textureToUnswizzle = 0; |
| 497 | + } |
| 498 | + } |
| 499 | + |
| 500 | + public static void setUnswizzle(int shaderTexture) { |
| 501 | + textureToUnswizzle = shaderTexture; |
| 502 | + } |
| 503 | + |
489 | 504 | public interface DSAAccess {
|
490 | 505 | void generateMipmaps(int texture, int target);
|
491 | 506 |
|
|
0 commit comments