Common and version specific shader packages #10
No files matched your search
@@ -1,5 +1,8 @@
|
||||
package com.mitchej123.glsm;
|
||||
|
||||
import net.irisshaders.iris.gl.blending.BlendMode;
|
||||
import net.irisshaders.iris.gl.blending.ColorMask;
|
||||
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
public interface GLStateManagerService {
|
||||
@@ -52,8 +55,6 @@ public interface GLStateManagerService {
|
||||
|
||||
void glClearColor(float red, float green, float blue, float alpha);
|
||||
|
||||
void clear(int mask, boolean checkError); // Non-standard
|
||||
|
||||
int glGetTexLevelParameteri(int target, int level, int pname);
|
||||
|
||||
void glFramebufferTexture2D(int target, int attachment, int textarget, int texture, int level);
|
||||
@@ -62,13 +63,23 @@ public interface GLStateManagerService {
|
||||
void glGenTextures(int[] textures);
|
||||
void glDeleteTextures(int texture);
|
||||
void glDeleteTextures(int[] textures);
|
||||
void bindTexture(int texture); // Non-standard
|
||||
void glActiveTexture(int texture);
|
||||
int getActiveTexture(); // Non-standard
|
||||
|
||||
int glGenBuffers();
|
||||
void glBindBuffer(int target, int buffer);
|
||||
|
||||
void glPixelStorei(int pname, int param);
|
||||
|
||||
// Mojang & Non-Standard
|
||||
void clear(int mask, boolean checkError); // Non-standard signature
|
||||
|
||||
void bindTexture(int texture); // Non-standard signature
|
||||
|
||||
int getActiveTexture(); // Mojang Addition
|
||||
|
||||
boolean getDepthStateMask();
|
||||
boolean isBlendEnabled();
|
||||
BlendMode getBlendMode();
|
||||
ColorMask getColorMask();
|
||||
|
||||
}
|
||||
+2
-7
@@ -2,9 +2,6 @@ package net.irisshaders.iris.gl.blending;
|
||||
|
||||
import static com.mitchej123.glsm.GLStateManagerService.GL_STATE_MANAGER;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.irisshaders.iris.mixin.GlStateManagerAccessor;
|
||||
|
||||
public class DepthColorStorage {
|
||||
private static boolean originalDepthEnable;
|
||||
private static ColorMask originalColor;
|
||||
@@ -17,11 +14,9 @@ public class DepthColorStorage {
|
||||
public static void disableDepthColor() {
|
||||
if (!depthColorLocked) {
|
||||
// Only save the previous state if the depth and color mask wasn't already locked
|
||||
GlStateManager.ColorMask colorMask = GlStateManagerAccessor.getCOLOR_MASK();
|
||||
GlStateManager.DepthState depthState = GlStateManagerAccessor.getDEPTH();
|
||||
|
||||
originalDepthEnable = depthState.mask;
|
||||
originalColor = new ColorMask(colorMask.red, colorMask.green, colorMask.blue, colorMask.alpha);
|
||||
originalDepthEnable = GL_STATE_MANAGER.getDepthStateMask();
|
||||
originalColor = GL_STATE_MANAGER.getColorMask();
|
||||
}
|
||||
|
||||
depthColorLocked = false;
|
||||
@@ -2,10 +2,7 @@ package net.irisshaders.iris.gl.blending;
|
||||
|
||||
import static com.mitchej123.glsm.GLStateManagerService.GL_STATE_MANAGER;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.irisshaders.iris.gl.IrisRenderSystem;
|
||||
import net.irisshaders.iris.mixin.GlStateManagerAccessor;
|
||||
import net.irisshaders.iris.mixin.statelisteners.BooleanStateAccessor;
|
||||
|
||||
public class BlendModeStorage {
|
||||
private static boolean originalBlendEnable;
|
||||
@@ -19,10 +16,9 @@ public class BlendModeStorage {
|
||||
public static void overrideBlend(BlendMode override) {
|
||||
if (!blendLocked) {
|
||||
// Only save the previous state if the blend mode wasn't already locked
|
||||
GlStateManager.BlendState blendState = GlStateManagerAccessor.getBLEND();
|
||||
|
||||
originalBlendEnable = ((BooleanStateAccessor) blendState.mode).isEnabled();
|
||||
originalBlend = new BlendMode(blendState.srcRgb, blendState.dstRgb, blendState.srcAlpha, blendState.dstAlpha);
|
||||
originalBlendEnable = GL_STATE_MANAGER.isBlendEnabled();
|
||||
originalBlend = GL_STATE_MANAGER.getBlendMode();
|
||||
}
|
||||
|
||||
blendLocked = false;
|
||||
@@ -40,10 +36,8 @@ public class BlendModeStorage {
|
||||
public static void overrideBufferBlend(int index, BlendMode override) {
|
||||
if (!blendLocked) {
|
||||
// Only save the previous state if the blend mode wasn't already locked
|
||||
GlStateManager.BlendState blendState = GlStateManagerAccessor.getBLEND();
|
||||
|
||||
originalBlendEnable = ((BooleanStateAccessor) blendState.mode).isEnabled();
|
||||
originalBlend = new BlendMode(blendState.srcRgb, blendState.dstRgb, blendState.srcAlpha, blendState.dstAlpha);
|
||||
originalBlendEnable = GL_STATE_MANAGER.isBlendEnabled();
|
||||
originalBlend = GL_STATE_MANAGER.getBlendMode();
|
||||
}
|
||||
|
||||
if (override == null) {
|
||||
|
||||
@@ -2,6 +2,10 @@ package org.embeddedt.embeddium.impl.gl;
|
||||
|
||||
import com.mitchej123.glsm.GLStateManagerService;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.irisshaders.iris.gl.blending.BlendMode;
|
||||
import net.irisshaders.iris.gl.blending.ColorMask;
|
||||
import net.irisshaders.iris.mixin.GlStateManagerAccessor;
|
||||
import net.irisshaders.iris.mixin.statelisteners.BooleanStateAccessor;
|
||||
|
||||
public class GLStateManagerImpl implements GLStateManagerService {
|
||||
@Override
|
||||
@@ -244,4 +248,30 @@ public class GLStateManagerImpl implements GLStateManagerService {
|
||||
GlStateManager._pixelStore(pname, param);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean getDepthStateMask() {
|
||||
return GlStateManagerAccessor.getDEPTH().mask;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlendEnabled() {
|
||||
GlStateManager.BlendState blendState = GlStateManagerAccessor.getBLEND();
|
||||
|
||||
return ((BooleanStateAccessor)blendState.mode).isEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlendMode getBlendMode() {
|
||||
GlStateManager.BlendState blendState = GlStateManagerAccessor.getBLEND();
|
||||
return new BlendMode(blendState.srcRgb, blendState.dstRgb, blendState.srcAlpha, blendState.dstAlpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColorMask getColorMask() {
|
||||
GlStateManager.ColorMask colorMask = GlStateManagerAccessor.getCOLOR_MASK();
|
||||
|
||||
return new ColorMask(colorMask.red, colorMask.green, colorMask.blue, colorMask.alpha);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user