Common and version specific shader packages #10
No files matched your search
@@ -13,7 +13,11 @@ public interface MinecraftVersionShimService {
|
|||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
default long getCurrentTiick() {
|
default long getCurrentTick() {
|
||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getMipmapLevels();
|
||||||
|
|
||||||
|
boolean isModLoaded(String modId);
|
||||||
}
|
}
|
||||||
+1
-5
@@ -2,17 +2,13 @@
|
|||||||
|
|
||||||
package net.irisshaders.iris.gl.shader;
|
package net.irisshaders.iris.gl.shader;
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import static com.mitchej123.glsm.GLStateManagerService.GL_STATE_MANAGER;
|
import static com.mitchej123.glsm.GLStateManagerService.GL_STATE_MANAGER;
|
||||||
|
|
||||||
import net.irisshaders.iris.gl.GlResource;
|
import net.irisshaders.iris.gl.GlResource;
|
||||||
import net.irisshaders.iris.gl.IrisRenderSystem;
|
import net.irisshaders.iris.gl.IrisRenderSystem;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.embeddedt.embeddium.impl.gl.debug.GLDebug;
|
|
||||||
import org.lwjgl.opengl.GL20C;
|
import org.lwjgl.opengl.GL20C;
|
||||||
import org.lwjgl.opengl.KHRDebug;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A compiled OpenGL shader object.
|
* A compiled OpenGL shader object.
|
||||||
@@ -33,7 +29,7 @@ public class GlShader extends GlResource {
|
|||||||
ShaderWorkarounds.safeShaderSource(handle, src);
|
ShaderWorkarounds.safeShaderSource(handle, src);
|
||||||
GL_STATE_MANAGER.glCompileShader(handle);
|
GL_STATE_MANAGER.glCompileShader(handle);
|
||||||
|
|
||||||
GLDebug.nameObject(KHRDebug.GL_SHADER, handle, name + "(" + type.name().toLowerCase(Locale.ROOT) + ")");
|
// GLDebug.nameObject(KHRDebug.GL_SHADER, handle, name + "(" + type.name().toLowerCase(Locale.ROOT) + ")");
|
||||||
|
embeddedt marked this conversation as resolved
Outdated
|
|||||||
|
|
||||||
String log = IrisRenderSystem.getShaderInfoLog(handle);
|
String log = IrisRenderSystem.getShaderInfoLog(handle);
|
||||||
|
|
||||||
+2
-4
@@ -7,9 +7,7 @@ import static com.mitchej123.glsm.GLStateManagerService.GL_STATE_MANAGER;
|
|||||||
import net.irisshaders.iris.gl.IrisRenderSystem;
|
import net.irisshaders.iris.gl.IrisRenderSystem;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.embeddedt.embeddium.impl.gl.debug.GLDebug;
|
|
||||||
import org.lwjgl.opengl.GL20C;
|
import org.lwjgl.opengl.GL20C;
|
||||||
import org.lwjgl.opengl.KHRDebug;
|
|
||||||
|
|
||||||
public class ProgramCreator {
|
public class ProgramCreator {
|
||||||
private static final Logger LOGGER = LogManager.getLogger(ProgramCreator.class);
|
private static final Logger LOGGER = LogManager.getLogger(ProgramCreator.class);
|
||||||
@@ -27,14 +25,14 @@ public class ProgramCreator {
|
|||||||
GL_STATE_MANAGER.glBindAttribLocation(program, 1, "UV0");
|
GL_STATE_MANAGER.glBindAttribLocation(program, 1, "UV0");
|
||||||
|
|
||||||
for (GlShader shader : shaders) {
|
for (GlShader shader : shaders) {
|
||||||
GLDebug.nameObject(KHRDebug.GL_SHADER, shader.getHandle(), shader.getName());
|
// GLDebug.nameObject(KHRDebug.GL_SHADER, shader.getHandle(), shader.getName());
|
||||||
|
|
||||||
GL_STATE_MANAGER.glAttachShader(program, shader.getHandle());
|
GL_STATE_MANAGER.glAttachShader(program, shader.getHandle());
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_STATE_MANAGER.glLinkProgram(program);
|
GL_STATE_MANAGER.glLinkProgram(program);
|
||||||
|
|
||||||
GLDebug.nameObject(KHRDebug.GL_PROGRAM, program, name);
|
// GLDebug.nameObject(KHRDebug.GL_PROGRAM, program, name);
|
||||||
|
|
||||||
//Always detach shaders according to https://www.khronos.org/opengl/wiki/Shader_Compilation#Cleanup
|
//Always detach shaders according to https://www.khronos.org/opengl/wiki/Shader_Compilation#Cleanup
|
||||||
for (GlShader shader : shaders) {
|
for (GlShader shader : shaders) {
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,12 @@
|
|||||||
|
package org.embeddedt.embeddium.compat.dh;
|
||||||
|
|
||||||
|
import java.util.ServiceLoader;
|
||||||
|
|
||||||
|
public interface DHCompatService {
|
||||||
|
DHCompatService DH_COMPAT = ServiceLoader.load(DHCompatService.class).findFirst().orElseThrow();
|
||||||
|
|
||||||
|
default boolean hasRenderingEnabled() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -41,7 +41,7 @@ public class ProgramUniforms {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static long getCurrentTick() {
|
private static long getCurrentTick() {
|
||||||
return MINECRAFT_SHIM.getCurrentTiick();
|
return MINECRAFT_SHIM.getCurrentTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void clearActiveUniforms() {
|
public static void clearActiveUniforms() {
|
||||||
|
|||||||
@@ -6,19 +6,18 @@ import java.util.regex.Pattern;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.mitchej123.glsm.GLStateManagerService.GL_STATE_MANAGER;
|
import static com.mitchej123.glsm.GLStateManagerService.GL_STATE_MANAGER;
|
||||||
|
import static com.mitchej123.glsm.MinecraftVersionShimService.MINECRAFT_SHIM;
|
||||||
|
import static org.embeddedt.embeddium.compat.dh.DHCompatService.DH_COMPAT;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.mojang.blaze3d.platform.GlUtil;
|
import com.mojang.blaze3d.platform.GlUtil;
|
||||||
import net.irisshaders.iris.Iris;
|
import net.irisshaders.iris.Iris;
|
||||||
import net.irisshaders.iris.compat.dh.DHCompat;
|
|
||||||
import net.irisshaders.iris.helpers.StringPair;
|
import net.irisshaders.iris.helpers.StringPair;
|
||||||
import net.irisshaders.iris.pathways.HandRenderer;
|
import net.irisshaders.iris.pathways.HandRenderer;
|
||||||
import net.irisshaders.iris.pipeline.WorldRenderingPhase;
|
import net.irisshaders.iris.pipeline.WorldRenderingPhase;
|
||||||
import net.irisshaders.iris.texture.format.TextureFormat;
|
import net.irisshaders.iris.texture.format.TextureFormat;
|
||||||
import net.irisshaders.iris.texture.format.TextureFormatLoader;
|
import net.irisshaders.iris.texture.format.TextureFormatLoader;
|
||||||
import net.minecraft.Util;
|
import net.minecraft.Util;
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import org.embeddedt.embeddium.impl.loader.common.EarlyLoaderServices;
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
import org.lwjgl.opengl.GL20C;
|
import org.lwjgl.opengl.GL20C;
|
||||||
import org.lwjgl.opengl.GL30C;
|
import org.lwjgl.opengl.GL30C;
|
||||||
@@ -38,7 +37,7 @@ public class StandardMacros {
|
|||||||
ArrayList<StringPair> standardDefines = new ArrayList<>();
|
ArrayList<StringPair> standardDefines = new ArrayList<>();
|
||||||
|
|
||||||
define(standardDefines, "MC_VERSION", getMcVersion());
|
define(standardDefines, "MC_VERSION", getMcVersion());
|
||||||
define(standardDefines, "MC_MIPMAP_LEVEL", String.valueOf(Minecraft.getInstance().options.mipmapLevels().get()));
|
define(standardDefines, "MC_MIPMAP_LEVEL", String.valueOf(MINECRAFT_SHIM.getMipmapLevels()));
|
||||||
define(standardDefines, "MC_GL_VERSION", getGlVersion(GL20C.GL_VERSION));
|
define(standardDefines, "MC_GL_VERSION", getGlVersion(GL20C.GL_VERSION));
|
||||||
define(standardDefines, "MC_GLSL_VERSION", getGlVersion(GL20C.GL_SHADING_LANGUAGE_VERSION));
|
define(standardDefines, "MC_GLSL_VERSION", getGlVersion(GL20C.GL_SHADING_LANGUAGE_VERSION));
|
||||||
define(standardDefines, getOsString());
|
define(standardDefines, getOsString());
|
||||||
@@ -49,7 +48,7 @@ public class StandardMacros {
|
|||||||
define(standardDefines, "IRIS_TAG_SUPPORT", "2");
|
define(standardDefines, "IRIS_TAG_SUPPORT", "2");
|
||||||
|
|
||||||
|
|
||||||
if (EarlyLoaderServices.INSTANCE.isModLoaded("distanthorizons") && DHCompat.hasRenderingEnabled()) {
|
if (MINECRAFT_SHIM.isModLoaded("distanthorizons") && DH_COMPAT.hasRenderingEnabled()) {
|
||||||
define(standardDefines, "DISTANT_HORIZONS");
|
define(standardDefines, "DISTANT_HORIZONS");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package org.embeddedt.embeddium.impl;
|
||||||
|
|
||||||
|
import net.irisshaders.iris.compat.dh.DHCompat;
|
||||||
|
import org.embeddedt.embeddium.compat.dh.DHCompatService;
|
||||||
|
|
||||||
|
public class DHCompatServiceImpl implements DHCompatService {
|
||||||
|
@Override
|
||||||
|
public boolean hasRenderingEnabled() {
|
||||||
|
return DHCompat.hasRenderingEnabled();
|
||||||
|
}
|
||||||
|
}
|
||||||
+12
-1
@@ -2,6 +2,7 @@ package org.embeddedt.embeddium.impl;
|
|||||||
|
|
||||||
import com.mitchej123.glsm.MinecraftVersionShimService;
|
import com.mitchej123.glsm.MinecraftVersionShimService;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import org.embeddedt.embeddium.impl.loader.common.EarlyLoaderServices;
|
||||||
|
|
||||||
public class MinecraftModernVersionShim implements MinecraftVersionShimService {
|
public class MinecraftModernVersionShim implements MinecraftVersionShimService {
|
||||||
@Override
|
@Override
|
||||||
@@ -15,11 +16,21 @@ public class MinecraftModernVersionShim implements MinecraftVersionShimService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getCurrentTiick() {
|
public long getCurrentTick() {
|
||||||
if (Minecraft.getInstance().level == null) {
|
if (Minecraft.getInstance().level == null) {
|
||||||
return 0L;
|
return 0L;
|
||||||
} else {
|
} else {
|
||||||
return Minecraft.getInstance().level.getGameTime();
|
return Minecraft.getInstance().level.getGameTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMipmapLevels() {
|
||||||
|
return Minecraft.getInstance().options.mipmapLevels().get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isModLoaded(String modId) {
|
||||||
|
return EarlyLoaderServices.INSTANCE.isModLoaded(modId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
org.embeddedt.embeddium.impl.DHCompatServiceImpl
|
||||||
Reference in new issue
Block a user
Why is this commented out.. isn't
GLDebugcommon?