more-shader-refactors #11
No files matched your search
@@ -14,7 +14,8 @@ import net.irisshaders.iris.shaderpack.option.Profile;
|
|||||||
import net.irisshaders.iris.shaderpack.option.values.MutableOptionValues;
|
import net.irisshaders.iris.shaderpack.option.values.MutableOptionValues;
|
||||||
import net.irisshaders.iris.shaderpack.option.values.OptionValues;
|
import net.irisshaders.iris.shaderpack.option.values.OptionValues;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.taumc.celeritas.api.v0.CeleritasShadersApi;
|
import org.taumc.celeritas.CeleritasShaderVersionService;
|
||||||
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@@ -90,7 +91,7 @@ public class IrisCommon {
|
|||||||
renderSystemInit = true;
|
renderSystemInit = true;
|
||||||
|
|
||||||
|
|
||||||
CeleritasShadersApi.getInstance().onRenderSystemInit();
|
CeleritasShaderVersionService.INSTANCE.onRenderSystemInit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +125,7 @@ public class IrisCommon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
initialized = true;
|
initialized = true;
|
||||||
CeleritasShadersApi.getInstance().onEarlyInitialize();
|
CeleritasShaderVersionService.INSTANCE.onEarlyInitialize();
|
||||||
}
|
}
|
||||||
public static void onLoadingComplete() {
|
public static void onLoadingComplete() {
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
@@ -138,7 +139,7 @@ public class IrisCommon {
|
|||||||
// See: https://github.com/IrisShaders/Iris/issues/323
|
// See: https://github.com/IrisShaders/Iris/issues/323
|
||||||
lastDimension = DimensionId.OVERWORLD;
|
lastDimension = DimensionId.OVERWORLD;
|
||||||
|
|
||||||
CeleritasShadersApi.getInstance().onLoadingComplete();
|
CeleritasShaderVersionService.INSTANCE.onLoadingComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Path getShaderpacksDirectory() {
|
public static Path getShaderpacksDirectory() {
|
||||||
@@ -460,7 +461,7 @@ public class IrisCommon {
|
|||||||
static void destroyEverything() {
|
static void destroyEverything() {
|
||||||
currentPack = null;
|
currentPack = null;
|
||||||
|
|
||||||
CeleritasShadersApi.getInstance().destroyEverything();
|
CeleritasShaderVersionService.INSTANCE.destroyEverything();
|
||||||
|
|
||||||
// Close the zip filesystem that the shaderpack was loaded from
|
// Close the zip filesystem that the shaderpack was loaded from
|
||||||
//
|
//
|
||||||
@@ -480,12 +481,12 @@ public class IrisCommon {
|
|||||||
@NotNull
|
@NotNull
|
||||||
public static PipelineManager getPipelineManager() {
|
public static PipelineManager getPipelineManager() {
|
||||||
if (pipelineManager == null) {
|
if (pipelineManager == null) {
|
||||||
pipelineManager = new PipelineManager(CeleritasShadersApi.getInstance()::createPipeline);
|
pipelineManager = new PipelineManager(CeleritasShaderVersionService.INSTANCE::createPipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loadPackWhenPossible && renderSystemInit) {
|
if (loadPackWhenPossible && renderSystemInit) {
|
||||||
loadPackWhenPossible = false;
|
loadPackWhenPossible = false;
|
||||||
CeleritasShadersApi.getInstance().reload();
|
CeleritasShaderVersionService.INSTANCE.reload();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import net.irisshaders.iris.gl.shader.ShaderCompileException;
|
|||||||
import net.irisshaders.iris.pipeline.IrisRenderingPipeline;
|
import net.irisshaders.iris.pipeline.IrisRenderingPipeline;
|
||||||
import net.irisshaders.iris.uniforms.CapturedRenderingState;
|
import net.irisshaders.iris.uniforms.CapturedRenderingState;
|
||||||
import org.joml.Matrix4f;
|
import org.joml.Matrix4f;
|
||||||
import org.taumc.celeritas.api.v0.CeleritasShadersApi;
|
import org.taumc.celeritas.CeleritasShaderVersionService;
|
||||||
|
|
||||||
import java.lang.invoke.MethodHandle;
|
import java.lang.invoke.MethodHandle;
|
||||||
import java.lang.invoke.MethodHandles;
|
import java.lang.invoke.MethodHandles;
|
||||||
@@ -30,7 +30,7 @@ public class DHCompat {
|
|||||||
public DHCompat(IrisRenderingPipeline pipeline, boolean renderDHShadow) {
|
public DHCompat(IrisRenderingPipeline pipeline, boolean renderDHShadow) {
|
||||||
try {
|
try {
|
||||||
if (dhPresent) {
|
if (dhPresent) {
|
||||||
compatInternalInstance = CeleritasShadersApi.getInstance().getDHCompatInstance(pipeline, renderDHShadow);
|
compatInternalInstance = CeleritasShaderVersionService.INSTANCE.getDHCompatInstance(pipeline, renderDHShadow);
|
||||||
lastIncompatible = (boolean) incompatible.invoke(compatInternalInstance);
|
lastIncompatible = (boolean) incompatible.invoke(compatInternalInstance);
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import org.joml.Vector2f;
|
|||||||
import org.joml.Vector3i;
|
import org.joml.Vector3i;
|
||||||
import org.lwjgl.opengl.GL43C;
|
import org.lwjgl.opengl.GL43C;
|
||||||
import org.lwjgl.opengl.GL46C;
|
import org.lwjgl.opengl.GL46C;
|
||||||
import org.taumc.celeritas.api.v0.CeleritasShadersApi;
|
import org.taumc.celeritas.CeleritasShaderVersionService;
|
||||||
|
|
||||||
public final class ComputeProgram extends GlResource {
|
public final class ComputeProgram extends GlResource {
|
||||||
private final ProgramUniforms uniforms;
|
private final ProgramUniforms uniforms;
|
||||||
@@ -73,7 +73,7 @@ public final class ComputeProgram extends GlResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void dispatch(float width, float height) {
|
public void dispatch(float width, float height) {
|
||||||
if (!CeleritasShadersApi.getInstance().irisAllowConcurrentUpdate()) {
|
if (!CeleritasShaderVersionService.INSTANCE.irisAllowConcurrentUpdate()) {
|
||||||
IrisRenderSystem.memoryBarrier(GL43C.GL_SHADER_IMAGE_ACCESS_BARRIER_BIT | GL43C.GL_TEXTURE_FETCH_BARRIER_BIT | GL43C.GL_SHADER_STORAGE_BARRIER_BIT);
|
IrisRenderSystem.memoryBarrier(GL43C.GL_SHADER_IMAGE_ACCESS_BARRIER_BIT | GL43C.GL_TEXTURE_FETCH_BARRIER_BIT | GL43C.GL_SHADER_STORAGE_BARRIER_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ import net.irisshaders.iris.shaderpack.materialmap.WorldRenderingSettings;
|
|||||||
import net.irisshaders.iris.uniforms.SystemTimeUniforms;
|
import net.irisshaders.iris.uniforms.SystemTimeUniforms;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.lwjgl.opengl.GL20C;
|
import org.lwjgl.opengl.GL20C;
|
||||||
import org.taumc.celeritas.api.v0.CeleritasShadersApi;
|
import org.taumc.celeritas.CeleritasShaderVersionService;
|
||||||
|
|
||||||
public class PipelineManager {
|
public class PipelineManager {
|
||||||
private final Function<NamespacedId, WorldRenderingPipeline> pipelineFactory;
|
private final Function<NamespacedId, WorldRenderingPipeline> pipelineFactory;
|
||||||
private final Map<NamespacedId, WorldRenderingPipeline> pipelinesPerDimension = new HashMap<>();
|
private final Map<NamespacedId, WorldRenderingPipeline> pipelinesPerDimension = new HashMap<>();
|
||||||
private WorldRenderingPipeline pipeline = CeleritasShadersApi.getInstance().createVanillaRenderingPipeline();
|
private WorldRenderingPipeline pipeline = CeleritasShaderVersionService.INSTANCE.createVanillaRenderingPipeline();
|
||||||
private int versionCounterForSodiumShaderReload = 0;
|
private int versionCounterForSodiumShaderReload = 0;
|
||||||
|
|
||||||
public PipelineManager(Function<NamespacedId, WorldRenderingPipeline> pipelineFactory) {
|
public PipelineManager(Function<NamespacedId, WorldRenderingPipeline> pipelineFactory) {
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ import net.irisshaders.iris.shaderpack.option.OrderBackedProperties;
|
|||||||
import net.irisshaders.iris.shaderpack.option.ShaderPackOptions;
|
import net.irisshaders.iris.shaderpack.option.ShaderPackOptions;
|
||||||
import net.irisshaders.iris.shaderpack.preprocessor.PropertiesPreprocessor;
|
import net.irisshaders.iris.shaderpack.preprocessor.PropertiesPreprocessor;
|
||||||
import org.embeddedt.embeddium.compat.iris.IBlockEntry;
|
import org.embeddedt.embeddium.compat.iris.IBlockEntry;
|
||||||
import org.taumc.celeritas.api.v0.CeleritasShadersApi;
|
import org.taumc.celeritas.CeleritasShaderVersionService;
|
||||||
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
@@ -218,7 +219,7 @@ public class IdMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
entries.add(CeleritasShadersApi.getInstance().parseBlockEntry(part));
|
entries.add(CeleritasShaderVersionService.INSTANCE.parseBlockEntry(part));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
IRIS_LOGGER.warn("Unexpected error while parsing an entry from " + fileName + " for the key " + key + ":", e);
|
IRIS_LOGGER.warn("Unexpected error while parsing an entry from " + fileName + " for the key " + key + ":", e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ import com.google.common.collect.ImmutableList;
|
|||||||
import net.irisshaders.iris.gl.shader.StandardMacros;
|
import net.irisshaders.iris.gl.shader.StandardMacros;
|
||||||
import net.irisshaders.iris.helpers.StringPair;
|
import net.irisshaders.iris.helpers.StringPair;
|
||||||
import net.irisshaders.iris.parsing.BiomeCategories;
|
import net.irisshaders.iris.parsing.BiomeCategories;
|
||||||
import org.taumc.celeritas.api.v0.CeleritasShadersApi;
|
import org.taumc.celeritas.CeleritasShaderVersionService;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -25,7 +26,7 @@ public class IrisDefines {
|
|||||||
public static ImmutableList<StringPair> createIrisReplacements() {
|
public static ImmutableList<StringPair> createIrisReplacements() {
|
||||||
ArrayList<StringPair> s = new ArrayList<>(StandardMacros.createStandardEnvironmentDefines());
|
ArrayList<StringPair> s = new ArrayList<>(StandardMacros.createStandardEnvironmentDefines());
|
||||||
|
|
||||||
CeleritasShadersApi.getInstance().processBiomeMap((key, value) -> define(s, key, value));
|
CeleritasShaderVersionService.INSTANCE.processBiomeMap((key, value) -> define(s, key, value));
|
||||||
|
|
||||||
BiomeCategories[] categories = BiomeCategories.values();
|
BiomeCategories[] categories = BiomeCategories.values();
|
||||||
for (int i = 0; i < categories.length; i++) {
|
for (int i = 0; i < categories.length; i++) {
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import net.irisshaders.iris.shaderpack.texture.TextureFilteringData;
|
|||||||
import net.irisshaders.iris.shaderpack.texture.TextureStage;
|
import net.irisshaders.iris.shaderpack.texture.TextureStage;
|
||||||
import net.irisshaders.iris.uniforms.custom.CustomUniforms;
|
import net.irisshaders.iris.uniforms.custom.CustomUniforms;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.taumc.celeritas.CeleritasShaderVersionService;
|
||||||
import org.taumc.celeritas.api.v0.CeleritasShadersApi;
|
import org.taumc.celeritas.api.v0.CeleritasShadersApi;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
@@ -191,7 +192,7 @@ public class ShaderPack {
|
|||||||
List<String> invalidFeatureFlags = invalidFlagList.stream().map(FeatureFlags::getHumanReadableName).toList();
|
List<String> invalidFeatureFlags = invalidFlagList.stream().map(FeatureFlags::getHumanReadableName).toList();
|
||||||
|
|
||||||
if (!invalidFeatureFlags.isEmpty()) {
|
if (!invalidFeatureFlags.isEmpty()) {
|
||||||
CeleritasShadersApi.getInstance().handleUnsupportedFeatureFlags(invalidFlagList, invalidFeatureFlags);
|
CeleritasShaderVersionService.INSTANCE.handleUnsupportedFeatureFlags(invalidFlagList, invalidFeatureFlags);
|
||||||
CeleritasShadersApi.getInstance().getConfig().setShadersEnabledAndApply(false);
|
CeleritasShadersApi.getInstance().getConfig().setShadersEnabledAndApply(false);
|
||||||
}
|
}
|
||||||
List<StringPair> newEnvDefines = new ArrayList<>(environmentDefines);
|
List<StringPair> newEnvDefines = new ArrayList<>(environmentDefines);
|
||||||
|
|||||||
+3
-2
@@ -4,7 +4,8 @@ import com.google.common.collect.ImmutableList;
|
|||||||
import it.unimi.dsi.fastutil.Function;
|
import it.unimi.dsi.fastutil.Function;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
import org.embeddedt.embeddium.compat.iris.IBlockEntry;
|
import org.embeddedt.embeddium.compat.iris.IBlockEntry;
|
||||||
import org.taumc.celeritas.api.v0.CeleritasShadersApi;
|
import org.taumc.celeritas.CeleritasShaderVersionService;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -78,7 +79,7 @@ public class LegacyIdMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static IBlockEntry block(String name) {
|
private static IBlockEntry block(String name) {
|
||||||
return CeleritasShadersApi.getInstance().createBlockEntry(new NamespacedId("minecraft", name));
|
return CeleritasShaderVersionService.INSTANCE.createBlockEntry(new NamespacedId("minecraft", name));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addMany(Int2ObjectMap<List<IBlockEntry>> blockIdMap, int id, List<String> prefixes, Function<String, IBlockEntry> toId) {
|
private static void addMany(Int2ObjectMap<List<IBlockEntry>> blockIdMap, int id, List<String> prefixes, Function<String, IBlockEntry> toId) {
|
||||||
|
|||||||
+2
-2
@@ -4,7 +4,7 @@ import org.embeddedt.embeddium.compat.mc.IResource;
|
|||||||
import org.embeddedt.embeddium.compat.mc.IResourceLocation;
|
import org.embeddedt.embeddium.compat.mc.IResourceLocation;
|
||||||
import org.embeddedt.embeddium.compat.mc.IResourceProvider;
|
import org.embeddedt.embeddium.compat.mc.IResourceProvider;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.taumc.celeritas.api.v0.CeleritasShadersApi;
|
import org.taumc.celeritas.CeleritasShaderVersionService;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -72,7 +72,7 @@ public class TextureFormatLoader {
|
|||||||
|
|
||||||
private static void onFormatChange() {
|
private static void onFormatChange() {
|
||||||
try {
|
try {
|
||||||
CeleritasShadersApi.getInstance().reloadIris();
|
CeleritasShaderVersionService.INSTANCE.reloadIris();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
package net.irisshaders.iris.texture.util;
|
package net.irisshaders.iris.texture.util;
|
||||||
|
|
||||||
import static com.mitchej123.glsm.GLStateManagerService.GL_STATE_MANAGER;
|
import static com.mitchej123.glsm.GLStateManagerService.GL_STATE_MANAGER;
|
||||||
|
import static org.embeddedt.embeddium.compat.mc.MinecraftVersionShimService.MINECRAFT_SHIM;
|
||||||
|
|
||||||
import net.irisshaders.iris.gl.IrisRenderSystem;
|
import net.irisshaders.iris.gl.IrisRenderSystem;
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
import org.lwjgl.opengl.GL30;
|
import org.lwjgl.opengl.GL30;
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ public class TextureManipulationUtil {
|
|||||||
int height = GL_STATE_MANAGER.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, level, GL11.GL_TEXTURE_HEIGHT);
|
int height = GL_STATE_MANAGER.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, level, GL11.GL_TEXTURE_HEIGHT);
|
||||||
GL_STATE_MANAGER.glViewport(0, 0, width, height);
|
GL_STATE_MANAGER.glViewport(0, 0, width, height);
|
||||||
GL_STATE_MANAGER.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, textureId, level);
|
GL_STATE_MANAGER.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, textureId, level);
|
||||||
GL_STATE_MANAGER.clear(GL11.GL_COLOR_BUFFER_BIT, Minecraft.ON_OSX);
|
GL_STATE_MANAGER.clear(GL11.GL_COLOR_BUFFER_BIT, MINECRAFT_SHIM.isOnOSX());
|
||||||
GL_STATE_MANAGER.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, 0, level);
|
GL_STATE_MANAGER.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, 0, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package org.taumc.celeritas;
|
||||||
|
|
||||||
|
import net.irisshaders.iris.features.FeatureFlags;
|
||||||
|
import net.irisshaders.iris.pipeline.IrisRenderingPipeline;
|
||||||
|
import net.irisshaders.iris.pipeline.WorldRenderingPipeline;
|
||||||
|
import net.irisshaders.iris.shaderpack.materialmap.NamespacedId;
|
||||||
|
import org.embeddedt.embeddium.compat.iris.IBlockEntry;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.ServiceLoader;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
|
||||||
|
public interface CeleritasShaderVersionService {
|
||||||
|
CeleritasShaderVersionService INSTANCE = ServiceLoader.load(CeleritasShaderVersionService.class).findFirst().orElseThrow();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reload the Iris
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
void reloadIris() throws IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether Iris allows concurrent updates to the shader pack.
|
||||||
|
*
|
||||||
|
* @return true if Iris allows concurrent updates, false otherwise.
|
||||||
|
*/
|
||||||
|
boolean irisAllowConcurrentUpdate();
|
||||||
|
|
||||||
|
void handleUnsupportedFeatureFlags(List<FeatureFlags> invalidFlagList, List<String> invalidFeatureFlags);
|
||||||
|
|
||||||
|
void processBiomeMap(BiConsumer<String, String> define);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses a block ID entry.
|
||||||
|
*
|
||||||
|
* @param entry The string representation of the entry. Must not be empty.
|
||||||
|
*/
|
||||||
|
IBlockEntry parseBlockEntry(@NotNull String entry);
|
||||||
|
IBlockEntry createBlockEntry(NamespacedId id);
|
||||||
|
|
||||||
|
|
||||||
|
void onEarlyInitialize();
|
||||||
|
void onRenderSystemInit();
|
||||||
|
void onLoadingComplete();
|
||||||
|
|
||||||
|
void destroyEverything();
|
||||||
|
|
||||||
|
WorldRenderingPipeline createPipeline(NamespacedId dimensionId);
|
||||||
|
WorldRenderingPipeline createVanillaRenderingPipeline();
|
||||||
|
|
||||||
|
void reload();
|
||||||
|
|
||||||
|
Object getDHCompatInstance(IrisRenderingPipeline pipeline, boolean renderDHShadow) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException;
|
||||||
|
}
|
||||||
@@ -1,18 +1,7 @@
|
|||||||
package org.taumc.celeritas.api.v0;
|
package org.taumc.celeritas.api.v0;
|
||||||
|
|
||||||
import net.irisshaders.iris.api.v0.IrisApiConfig;
|
import net.irisshaders.iris.api.v0.IrisApiConfig;
|
||||||
import net.irisshaders.iris.features.FeatureFlags;
|
|
||||||
import net.irisshaders.iris.pipeline.IrisRenderingPipeline;
|
|
||||||
import net.irisshaders.iris.pipeline.WorldRenderingPipeline;
|
|
||||||
import net.irisshaders.iris.shaderpack.materialmap.NamespacedId;
|
|
||||||
import org.embeddedt.embeddium.compat.iris.IBlockEntry;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.ServiceLoader;
|
import java.util.ServiceLoader;
|
||||||
import java.util.function.BiConsumer;
|
|
||||||
|
|
||||||
public interface CeleritasShadersApi {
|
public interface CeleritasShadersApi {
|
||||||
CeleritasShadersApi INSTANCE = ServiceLoader.load(CeleritasShadersApi.class).findFirst().orElseThrow();
|
CeleritasShadersApi INSTANCE = ServiceLoader.load(CeleritasShadersApi.class).findFirst().orElseThrow();
|
||||||
@@ -132,43 +121,4 @@ public interface CeleritasShadersApi {
|
|||||||
* @since API v0.2
|
* @since API v0.2
|
||||||
*/
|
*/
|
||||||
float getSunPathRotation();
|
float getSunPathRotation();
|
||||||
|
|
||||||
/**
|
|
||||||
* Reload the Iris
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
void reloadIris() throws IOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks whether Iris allows concurrent updates to the shader pack.
|
|
||||||
*
|
|
||||||
* @return true if Iris allows concurrent updates, false otherwise.
|
|
||||||
*/
|
|
||||||
boolean irisAllowConcurrentUpdate();
|
|
||||||
|
|
||||||
void handleUnsupportedFeatureFlags(List<FeatureFlags> invalidFlagList, List<String> invalidFeatureFlags);
|
|
||||||
|
|
||||||
void processBiomeMap(BiConsumer<String, String> define);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parses a block ID entry.
|
|
||||||
*
|
|
||||||
* @param entry The string representation of the entry. Must not be empty.
|
|
||||||
*/
|
|
||||||
IBlockEntry parseBlockEntry(@NotNull String entry);
|
|
||||||
IBlockEntry createBlockEntry(NamespacedId id);
|
|
||||||
|
|
||||||
|
|
||||||
void onEarlyInitialize();
|
|
||||||
void onRenderSystemInit();
|
|
||||||
void onLoadingComplete();
|
|
||||||
|
|
||||||
void destroyEverything();
|
|
||||||
|
|
||||||
WorldRenderingPipeline createPipeline(NamespacedId dimensionId);
|
|
||||||
WorldRenderingPipeline createVanillaRenderingPipeline();
|
|
||||||
|
|
||||||
void reload();
|
|
||||||
|
|
||||||
Object getDHCompatInstance(IrisRenderingPipeline pipeline, boolean renderDHShadow) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException;
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package net.irisshaders.iris;
|
|
||||||
|
|
||||||
public class Iris {
|
|
||||||
|
|
||||||
}
|
|
||||||
+6
-52
@@ -1,7 +1,5 @@
|
|||||||
package net.irisshaders.iris.apiimpl;
|
package net.irisshaders.iris;
|
||||||
|
|
||||||
import net.irisshaders.iris.IrisCommon;
|
|
||||||
import net.irisshaders.iris.api.v0.IrisApiConfig;
|
|
||||||
import net.irisshaders.iris.features.FeatureFlags;
|
import net.irisshaders.iris.features.FeatureFlags;
|
||||||
import net.irisshaders.iris.pipeline.IrisRenderingPipeline;
|
import net.irisshaders.iris.pipeline.IrisRenderingPipeline;
|
||||||
import net.irisshaders.iris.pipeline.WorldRenderingPipeline;
|
import net.irisshaders.iris.pipeline.WorldRenderingPipeline;
|
||||||
@@ -10,7 +8,8 @@ import net.irisshaders.iris.shaderpack.materialmap.NamespacedId;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.embeddedt.embeddium.compat.iris.IBlockEntry;
|
import org.embeddedt.embeddium.compat.iris.IBlockEntry;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.taumc.celeritas.api.v0.CeleritasShadersApi;
|
import org.taumc.celeritas.CeleritasShaderVersionService;
|
||||||
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
@@ -22,52 +21,7 @@ import java.util.function.BiConsumer;
|
|||||||
|
|
||||||
import static net.irisshaders.iris.IrisLogging.IRIS_LOGGER;
|
import static net.irisshaders.iris.IrisLogging.IRIS_LOGGER;
|
||||||
|
|
||||||
public class IrisApiV0Impl implements CeleritasShadersApi {
|
public class IrisArchaic implements CeleritasShaderVersionService {
|
||||||
@Override
|
|
||||||
public boolean isShaderPackInUse() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRenderingShadowPass() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getOverriddenShadowDistance(int base) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isShadowDistanceSliderEnabled() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean areDebugOptionsEnabled() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object openMainIrisScreenObj(Object parent) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getMainScreenLanguageKey() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IrisApiConfig getConfig() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getSunPathRotation() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reloadIris() throws IOException {
|
public void reloadIris() throws IOException {
|
||||||
|
|
||||||
@@ -204,7 +158,7 @@ public class IrisApiV0Impl implements CeleritasShadersApi {
|
|||||||
public WorldRenderingPipeline createPipeline(NamespacedId dimensionId) {
|
public WorldRenderingPipeline createPipeline(NamespacedId dimensionId) {
|
||||||
if (IrisCommon.getCurrentPack().isEmpty()) {
|
if (IrisCommon.getCurrentPack().isEmpty()) {
|
||||||
// Completely disables shader-based rendering
|
// Completely disables shader-based rendering
|
||||||
return CeleritasShadersApi.getInstance().createVanillaRenderingPipeline();
|
return createVanillaRenderingPipeline();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -212,7 +166,7 @@ public class IrisApiV0Impl implements CeleritasShadersApi {
|
|||||||
// TODO: This should be reverted if a dimension change causes shaders to compile again
|
// TODO: This should be reverted if a dimension change causes shaders to compile again
|
||||||
IrisCommon.setFallback(true);
|
IrisCommon.setFallback(true);
|
||||||
|
|
||||||
return CeleritasShadersApi.getInstance().createVanillaRenderingPipeline();
|
return createVanillaRenderingPipeline();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package net.irisshaders.iris.apiimpl;
|
||||||
|
|
||||||
|
import net.irisshaders.iris.api.v0.IrisApiConfig;
|
||||||
|
import org.taumc.celeritas.api.v0.CeleritasShadersApi;
|
||||||
|
|
||||||
|
public class IrisApiV0ImplArchaic implements CeleritasShadersApi {
|
||||||
|
@Override
|
||||||
|
public boolean isShaderPackInUse() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRenderingShadowPass() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getOverriddenShadowDistance(int base) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isShadowDistanceSliderEnabled() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean areDebugOptionsEnabled() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object openMainIrisScreenObj(Object parent) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMainScreenLanguageKey() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IrisApiConfig getConfig() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getSunPathRotation() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
net.irisshaders.iris.IrisArchaic
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
net.irisshaders.iris.apiimpl.IrisApiV0Impl
|
net.irisshaders.iris.apiimpl.IrisApiV0ImplArchaic
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
package org.embeddedt.embeddium.impl;
|
package org.embeddedt.embeddium.impl;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
|
|
||||||
//? if forge && >=1.18 {
|
//? if forge && >=1.18 {
|
||||||
import net.minecraftforge.client.event.RegisterClientCommandsEvent;
|
import net.minecraftforge.client.event.RegisterClientCommandsEvent;
|
||||||
//? if >=1.19
|
//? if >=1.19
|
||||||
@@ -115,10 +113,10 @@ public class Celeritas /*? if fabric {*/ /*implements ClientModInitializer *//*?
|
|||||||
// TODO remove
|
// TODO remove
|
||||||
//? if shaders {
|
//? if shaders {
|
||||||
modEventBus.addListener((RegisterKeyMappingsEvent ev) -> {
|
modEventBus.addListener((RegisterKeyMappingsEvent ev) -> {
|
||||||
ev.register(net.irisshaders.iris.apiimpl.IrisApiV0Impl.reloadKeybind);
|
ev.register(net.irisshaders.iris.IrisModern.reloadKeybind);
|
||||||
ev.register(net.irisshaders.iris.apiimpl.IrisApiV0Impl.shaderpackScreenKeybind);
|
ev.register(net.irisshaders.iris.IrisModern.shaderpackScreenKeybind);
|
||||||
ev.register(net.irisshaders.iris.apiimpl.IrisApiV0Impl.toggleShadersKeybind);
|
ev.register(net.irisshaders.iris.IrisModern.toggleShadersKeybind);
|
||||||
ev.register(net.irisshaders.iris.apiimpl.IrisApiV0Impl.wireframeKeybind);
|
ev.register(net.irisshaders.iris.IrisModern.wireframeKeybind);
|
||||||
});
|
});
|
||||||
//?}
|
//?}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,28 +6,22 @@ import com.mojang.blaze3d.platform.GlDebug;
|
|||||||
/*import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;*/
|
/*import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;*/
|
||||||
import net.irisshaders.iris.compat.dh.DHCompat;
|
import net.irisshaders.iris.compat.dh.DHCompat;
|
||||||
import net.irisshaders.iris.compat.sodium.impl.options.IrisSodiumOptions;
|
import net.irisshaders.iris.compat.sodium.impl.options.IrisSodiumOptions;
|
||||||
import net.irisshaders.iris.gl.shader.ShaderCompileException;
|
|
||||||
import net.irisshaders.iris.gui.debug.DebugLoadFailedGridScreen;
|
|
||||||
import net.irisshaders.iris.gui.screen.ShaderPackScreen;
|
import net.irisshaders.iris.gui.screen.ShaderPackScreen;
|
||||||
import net.irisshaders.iris.pipeline.ModernIrisRenderingPipeline;
|
import net.irisshaders.iris.pipeline.ModernIrisRenderingPipeline;
|
||||||
import net.irisshaders.iris.pipeline.PipelineManager;
|
import net.irisshaders.iris.pipeline.PipelineManager;
|
||||||
import net.irisshaders.iris.pipeline.WorldRenderingPipeline;
|
|
||||||
import net.irisshaders.iris.shaderpack.DimensionId;
|
import net.irisshaders.iris.shaderpack.DimensionId;
|
||||||
import net.irisshaders.iris.shaderpack.discovery.ShaderpackDirectoryManager;
|
import net.irisshaders.iris.shaderpack.discovery.ShaderpackDirectoryManager;
|
||||||
import net.irisshaders.iris.shaderpack.materialmap.NamespacedId;
|
import net.irisshaders.iris.shaderpack.materialmap.NamespacedId;
|
||||||
import net.irisshaders.iris.shaderpack.programs.ProgramSet;
|
|
||||||
import net.irisshaders.iris.texture.pbr.PBRTextureManager;
|
import net.irisshaders.iris.texture.pbr.PBRTextureManager;
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.SharedConstants;
|
import net.minecraft.SharedConstants;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.multiplayer.ClientLevel;
|
import net.minecraft.client.multiplayer.ClientLevel;
|
||||||
import net.minecraft.network.chat.ClickEvent;
|
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import org.embeddedt.embeddium.impl.Celeritas;
|
import org.embeddedt.embeddium.impl.Celeritas;
|
||||||
import org.embeddedt.embeddium.impl.gl.debug.GLDebug;
|
import org.embeddedt.embeddium.impl.gl.debug.GLDebug;
|
||||||
import org.embeddedt.embeddium.impl.loader.common.EarlyLoaderServices;
|
import org.embeddedt.embeddium.impl.loader.common.EarlyLoaderServices;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.taumc.celeritas.api.v0.CeleritasShadersApi;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@@ -80,7 +74,7 @@ public class Iris {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void handleKeybinds(Minecraft minecraft) {
|
public static void handleKeybinds(Minecraft minecraft) {
|
||||||
if (net.irisshaders.iris.apiimpl.IrisApiV0Impl.reloadKeybind.consumeClick()) {
|
if (IrisModern.reloadKeybind.consumeClick()) {
|
||||||
try {
|
try {
|
||||||
reload();
|
reload();
|
||||||
|
|
||||||
@@ -95,7 +89,7 @@ public class Iris {
|
|||||||
minecraft.player.displayClientMessage(Component.translatable("iris.shaders.reloaded.failure", Throwables.getRootCause(e).getMessage()).withStyle(ChatFormatting.RED), false);
|
minecraft.player.displayClientMessage(Component.translatable("iris.shaders.reloaded.failure", Throwables.getRootCause(e).getMessage()).withStyle(ChatFormatting.RED), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (net.irisshaders.iris.apiimpl.IrisApiV0Impl.toggleShadersKeybind.consumeClick()) {
|
} else if (IrisModern.toggleShadersKeybind.consumeClick()) {
|
||||||
try {
|
try {
|
||||||
toggleShaders(minecraft, !IrisCommon.getIrisConfig().areShadersEnabled());
|
toggleShaders(minecraft, !IrisCommon.getIrisConfig().areShadersEnabled());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -107,9 +101,9 @@ public class Iris {
|
|||||||
IrisCommon.setShadersDisabled();
|
IrisCommon.setShadersDisabled();
|
||||||
IrisCommon.fallback = true;
|
IrisCommon.fallback = true;
|
||||||
}
|
}
|
||||||
} else if (net.irisshaders.iris.apiimpl.IrisApiV0Impl.shaderpackScreenKeybind.consumeClick()) {
|
} else if (IrisModern.shaderpackScreenKeybind.consumeClick()) {
|
||||||
minecraft.setScreen(new ShaderPackScreen(null));
|
minecraft.setScreen(new ShaderPackScreen(null));
|
||||||
} else if (net.irisshaders.iris.apiimpl.IrisApiV0Impl.wireframeKeybind.consumeClick()) {
|
} else if (IrisModern.wireframeKeybind.consumeClick()) {
|
||||||
if (IrisCommon.getIrisConfig().areDebugOptionsEnabled() && minecraft.player != null && !Minecraft.getInstance().isLocalServer()) {
|
if (IrisCommon.getIrisConfig().areDebugOptionsEnabled() && minecraft.player != null && !Minecraft.getInstance().isLocalServer()) {
|
||||||
minecraft.player.displayClientMessage(Component.literal("No cheating; wireframe only in singleplayer!"), false);
|
minecraft.player.displayClientMessage(Component.literal("No cheating; wireframe only in singleplayer!"), false);
|
||||||
}
|
}
|
||||||
@@ -117,7 +111,7 @@ public class Iris {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean shouldActivateWireframe() {
|
public static boolean shouldActivateWireframe() {
|
||||||
return IrisCommon.getIrisConfig().areDebugOptionsEnabled() && net.irisshaders.iris.apiimpl.IrisApiV0Impl.wireframeKeybind.isDown();
|
return IrisCommon.getIrisConfig().areDebugOptionsEnabled() && IrisModern.wireframeKeybind.isDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleShaders(Minecraft minecraft, boolean enabled) throws IOException {
|
public static void toggleShaders(Minecraft minecraft, boolean enabled) throws IOException {
|
||||||
|
|||||||
+9
-89
@@ -1,32 +1,25 @@
|
|||||||
package net.irisshaders.iris.apiimpl;
|
package net.irisshaders.iris;
|
||||||
|
|
||||||
import com.google.common.base.Throwables;
|
import com.google.common.base.Throwables;
|
||||||
import com.mojang.blaze3d.platform.InputConstants;
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
|
||||||
import net.irisshaders.iris.Iris;
|
|
||||||
import net.irisshaders.iris.IrisCommon;
|
|
||||||
import net.irisshaders.iris.IrisConstants;
|
|
||||||
import net.irisshaders.iris.api.v0.IrisApi;
|
|
||||||
import net.irisshaders.iris.api.v0.IrisApiConfig;
|
|
||||||
import net.irisshaders.iris.api.v0.IrisTextVertexSink;
|
|
||||||
import net.irisshaders.iris.compat.dh.DHCompat;
|
import net.irisshaders.iris.compat.dh.DHCompat;
|
||||||
import net.irisshaders.iris.features.FeatureFlags;
|
import net.irisshaders.iris.features.FeatureFlags;
|
||||||
import net.irisshaders.iris.gl.shader.ShaderCompileException;
|
import net.irisshaders.iris.gl.shader.ShaderCompileException;
|
||||||
import net.irisshaders.iris.gui.FeatureMissingErrorScreen;
|
import net.irisshaders.iris.gui.FeatureMissingErrorScreen;
|
||||||
import net.irisshaders.iris.gui.debug.DebugLoadFailedGridScreen;
|
import net.irisshaders.iris.gui.debug.DebugLoadFailedGridScreen;
|
||||||
import net.irisshaders.iris.gui.screen.ShaderPackScreen;
|
import net.irisshaders.iris.gui.screen.ShaderPackScreen;
|
||||||
import net.irisshaders.iris.pipeline.*;
|
import net.irisshaders.iris.pipeline.IrisRenderingPipeline;
|
||||||
|
import net.irisshaders.iris.pipeline.ModernIrisRenderingPipeline;
|
||||||
|
import net.irisshaders.iris.pipeline.ModernVanillaRenderingPipeline;
|
||||||
|
import net.irisshaders.iris.pipeline.WorldRenderingPipeline;
|
||||||
import net.irisshaders.iris.shaderpack.materialmap.BlockEntry;
|
import net.irisshaders.iris.shaderpack.materialmap.BlockEntry;
|
||||||
import net.irisshaders.iris.shaderpack.materialmap.NamespacedId;
|
import net.irisshaders.iris.shaderpack.materialmap.NamespacedId;
|
||||||
import net.irisshaders.iris.shaderpack.programs.ProgramSet;
|
import net.irisshaders.iris.shaderpack.programs.ProgramSet;
|
||||||
import net.irisshaders.iris.shadows.ShadowRenderingState;
|
|
||||||
import net.irisshaders.iris.texture.pbr.PBRTextureManager;
|
import net.irisshaders.iris.texture.pbr.PBRTextureManager;
|
||||||
import net.irisshaders.iris.uniforms.ModernBiomeUniforms;
|
import net.irisshaders.iris.uniforms.ModernBiomeUniforms;
|
||||||
import net.irisshaders.iris.vertices.IrisTextVertexSinkImpl;
|
|
||||||
import net.minecraft.ChatFormatting;
|
import net.minecraft.ChatFormatting;
|
||||||
import net.minecraft.client.KeyMapping;
|
import net.minecraft.client.KeyMapping;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
|
||||||
import net.minecraft.network.chat.ClickEvent;
|
import net.minecraft.network.chat.ClickEvent;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.MutableComponent;
|
import net.minecraft.network.chat.MutableComponent;
|
||||||
@@ -35,21 +28,19 @@ import org.embeddedt.embeddium.compat.iris.IBlockEntry;
|
|||||||
import org.embeddedt.embeddium.impl.loader.common.EarlyLoaderServices;
|
import org.embeddedt.embeddium.impl.loader.common.EarlyLoaderServices;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
import org.taumc.celeritas.CeleritasShaderVersionService;
|
||||||
import org.taumc.celeritas.api.v0.CeleritasShadersApi;
|
import org.taumc.celeritas.api.v0.CeleritasShadersApi;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
import java.util.function.IntFunction;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static net.irisshaders.iris.IrisLogging.IRIS_LOGGER;
|
import static net.irisshaders.iris.IrisLogging.IRIS_LOGGER;
|
||||||
import static net.irisshaders.iris.uniforms.BiomeUniforms.BIOME_UNIFORMS;
|
import static net.irisshaders.iris.uniforms.BiomeUniforms.BIOME_UNIFORMS;
|
||||||
|
|
||||||
public class IrisApiV0Impl implements IrisApi {
|
public class IrisModern implements CeleritasShaderVersionService {
|
||||||
private static final IrisApiV0ConfigImpl CONFIG = new IrisApiV0ConfigImpl();
|
|
||||||
|
|
||||||
public static KeyMapping reloadKeybind;
|
public static KeyMapping reloadKeybind;
|
||||||
public static KeyMapping toggleShadersKeybind;
|
public static KeyMapping toggleShadersKeybind;
|
||||||
@@ -57,77 +48,6 @@ public class IrisApiV0Impl implements IrisApi {
|
|||||||
public static KeyMapping wireframeKeybind;
|
public static KeyMapping wireframeKeybind;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMinorApiRevision() {
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isShaderPackInUse() {
|
|
||||||
WorldRenderingPipeline pipeline = Iris.getPipelineManager().getPipelineNullable();
|
|
||||||
|
|
||||||
if (pipeline == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return !(pipeline instanceof VanillaRenderingPipeline);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRenderingShadowPass() {
|
|
||||||
return ShadowRenderingState.areShadowsCurrentlyBeingRendered();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getOverriddenShadowDistance(int base) {
|
|
||||||
return Iris.getPipelineManager().getPipeline()
|
|
||||||
.map(pipeline -> pipeline.getForcedShadowRenderDistanceChunksForDisplay().orElse(base))
|
|
||||||
.orElse(base);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isShadowDistanceSliderEnabled() {
|
|
||||||
return Iris.getPipelineManager().getPipeline()
|
|
||||||
.map(pipeline -> !pipeline.getForcedShadowRenderDistanceChunksForDisplay().isPresent())
|
|
||||||
.orElse(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean areDebugOptionsEnabled() {
|
|
||||||
return IrisCommon.getIrisConfig().areDebugOptionsEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object openMainIrisScreenObj(Object parent) {
|
|
||||||
return new ShaderPackScreen((Screen) parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getMainScreenLanguageKey() {
|
|
||||||
return "options.iris.shaderPackSelection";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IrisApiConfig getConfig() {
|
|
||||||
return CONFIG;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IrisTextVertexSink createTextVertexSink(int maxQuadCount, IntFunction<ByteBuffer> bufferProvider) {
|
|
||||||
return new IrisTextVertexSinkImpl(maxQuadCount, bufferProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getSunPathRotation() {
|
|
||||||
WorldRenderingPipeline pipeline = Iris.getPipelineManager().getPipelineNullable();
|
|
||||||
|
|
||||||
if (pipeline == null) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return pipeline.getSunPathRotation();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reloadIris() throws IOException {
|
public void reloadIris() throws IOException {
|
||||||
@@ -286,7 +206,7 @@ public class IrisApiV0Impl implements IrisApi {
|
|||||||
public WorldRenderingPipeline createPipeline(NamespacedId dimensionId) {
|
public WorldRenderingPipeline createPipeline(NamespacedId dimensionId) {
|
||||||
if (IrisCommon.getCurrentPack().isEmpty()) {
|
if (IrisCommon.getCurrentPack().isEmpty()) {
|
||||||
// Completely disables shader-based rendering
|
// Completely disables shader-based rendering
|
||||||
return CeleritasShadersApi.getInstance().createVanillaRenderingPipeline();
|
return createVanillaRenderingPipeline();
|
||||||
}
|
}
|
||||||
|
|
||||||
ProgramSet programs = IrisCommon.getCurrentPack().get().getProgramSet(dimensionId);
|
ProgramSet programs = IrisCommon.getCurrentPack().get().getProgramSet(dimensionId);
|
||||||
@@ -308,7 +228,7 @@ public class IrisApiV0Impl implements IrisApi {
|
|||||||
// TODO: This should be reverted if a dimension change causes shaders to compile again
|
// TODO: This should be reverted if a dimension change causes shaders to compile again
|
||||||
IrisCommon.setFallback(true);
|
IrisCommon.setFallback(true);
|
||||||
|
|
||||||
return CeleritasShadersApi.getInstance().createVanillaRenderingPipeline();
|
return createVanillaRenderingPipeline();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
package net.irisshaders.iris.apiimpl;
|
||||||
|
|
||||||
|
import net.irisshaders.iris.Iris;
|
||||||
|
import net.irisshaders.iris.IrisCommon;
|
||||||
|
import net.irisshaders.iris.api.v0.IrisApi;
|
||||||
|
import net.irisshaders.iris.api.v0.IrisApiConfig;
|
||||||
|
import net.irisshaders.iris.api.v0.IrisTextVertexSink;
|
||||||
|
import net.irisshaders.iris.gui.screen.ShaderPackScreen;
|
||||||
|
import net.irisshaders.iris.pipeline.VanillaRenderingPipeline;
|
||||||
|
import net.irisshaders.iris.pipeline.WorldRenderingPipeline;
|
||||||
|
import net.irisshaders.iris.shadows.ShadowRenderingState;
|
||||||
|
import net.irisshaders.iris.vertices.IrisTextVertexSinkImpl;
|
||||||
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
|
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import java.util.function.IntFunction;
|
||||||
|
|
||||||
|
public class IrisApiV0ImplModern implements IrisApi {
|
||||||
|
private static final IrisApiV0ConfigImpl CONFIG = new IrisApiV0ConfigImpl();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMinorApiRevision() {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isShaderPackInUse() {
|
||||||
|
WorldRenderingPipeline pipeline = Iris.getPipelineManager().getPipelineNullable();
|
||||||
|
|
||||||
|
if (pipeline == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return !(pipeline instanceof VanillaRenderingPipeline);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRenderingShadowPass() {
|
||||||
|
return ShadowRenderingState.areShadowsCurrentlyBeingRendered();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getOverriddenShadowDistance(int base) {
|
||||||
|
return Iris.getPipelineManager().getPipeline()
|
||||||
|
.map(pipeline -> pipeline.getForcedShadowRenderDistanceChunksForDisplay().orElse(base))
|
||||||
|
.orElse(base);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isShadowDistanceSliderEnabled() {
|
||||||
|
return Iris.getPipelineManager().getPipeline()
|
||||||
|
.map(pipeline -> !pipeline.getForcedShadowRenderDistanceChunksForDisplay().isPresent())
|
||||||
|
.orElse(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean areDebugOptionsEnabled() {
|
||||||
|
return IrisCommon.getIrisConfig().areDebugOptionsEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object openMainIrisScreenObj(Object parent) {
|
||||||
|
return new ShaderPackScreen((Screen) parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMainScreenLanguageKey() {
|
||||||
|
return "options.iris.shaderPackSelection";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IrisApiConfig getConfig() {
|
||||||
|
return CONFIG;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IrisTextVertexSink createTextVertexSink(int maxQuadCount, IntFunction<ByteBuffer> bufferProvider) {
|
||||||
|
return new IrisTextVertexSinkImpl(maxQuadCount, bufferProvider);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getSunPathRotation() {
|
||||||
|
WorldRenderingPipeline pipeline = Iris.getPipelineManager().getPipelineNullable();
|
||||||
|
|
||||||
|
if (pipeline == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pipeline.getSunPathRotation();
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
net.irisshaders.iris.IrisModern
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
net.irisshaders.iris.apiimpl.IrisApiV0Impl
|
net.irisshaders.iris.apiimpl.IrisApiV0ImplModern
|
||||||
Reference in new issue
Block a user