Skip to content

Commit

Permalink
The great coreify
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS212 committed Aug 21, 2024
1 parent 8560dd9 commit 1719c7e
Show file tree
Hide file tree
Showing 39 changed files with 562 additions and 802 deletions.
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ plugins {
id("fabric-loom") version("1.7.2") apply(false)
}

val MINECRAFT_VERSION by extra { "24w33a" }
val MINECRAFT_VERSION by extra { "24w34a" }
val NEOFORGE_VERSION by extra { "21.0.143" }
val FABRIC_LOADER_VERSION by extra { "0.16.1" }
val FABRIC_LOADER_VERSION by extra { "0.16.2" }
val FABRIC_API_VERSION by extra { "0.102.0+1.21.1" }
val SODIUM_FILE by extra { "sodium-LOADER-0.6.0-snapshot+mc24w33a-local.jar" }
val SODIUM_FILE by extra { "sodium-fabric-0.6.0-snapshot+mc24w34a-local.jar" }

// https://semver.org/
val MOD_VERSION by extra { "1.8.0" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderBuffers;
import net.minecraft.client.renderer.culling.Frustum;
import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.phys.Vec3;
Expand Down Expand Up @@ -76,8 +77,8 @@ public class MixinLevelRenderer {
}
}

@Inject(method = "method_62214", at = @At(value = "CONSTANT", args = "stringValue=translucent"), locals = LocalCapture.CAPTURE_FAILHARD)
private void batchedentityrendering$beginTranslucents(FogParameters fogParameters, DeltaTracker deltaTracker, Camera camera, ProfilerFiller profilerFiller, Matrix4f matrix4f, Matrix4f matrix4f2, ResourceHandle resourceHandle, ResourceHandle resourceHandle2, ResourceHandle resourceHandle3, ResourceHandle resourceHandle4, boolean bl, ResourceHandle resourceHandle5, CallbackInfo ci, float f, Vec3 vec3, double d, double e, double g, PoseStack poseStack, MultiBufferSource.BufferSource bufferSource) {
@Inject(method = "method_62214", at = @At(value = "CONSTANT", args = "stringValue=translucent"))
private void batchedentityrendering$beginTranslucents(FogParameters fogParameters, DeltaTracker deltaTracker, Camera camera, ProfilerFiller profilerFiller, Matrix4f matrix4f, Matrix4f matrix4f2, ResourceHandle resourceHandle, ResourceHandle resourceHandle2, ResourceHandle resourceHandle3, ResourceHandle resourceHandle4, boolean bl, Frustum frustum, ResourceHandle resourceHandle5, CallbackInfo ci) {
if (renderBuffers.bufferSource() instanceof FullyBufferedMultiBufferSource fullyBufferedMultiBufferSource) {
fullyBufferedMultiBufferSource.readyUp();
}
Expand All @@ -98,7 +99,7 @@ public class MixinLevelRenderer {


@Inject(method = "method_62214", at = @At(value = "CONSTANT", args = "stringValue=translucent", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD)
private void batchedentityrendering$endTranslucents(FogParameters fogParameters, DeltaTracker deltaTracker, Camera camera, ProfilerFiller profilerFiller, Matrix4f matrix4f, Matrix4f matrix4f2, ResourceHandle resourceHandle, ResourceHandle resourceHandle2, ResourceHandle resourceHandle3, ResourceHandle resourceHandle4, boolean bl, ResourceHandle resourceHandle5, CallbackInfo ci, float f, Vec3 vec3, double d, double e, double g, PoseStack poseStack, MultiBufferSource.BufferSource bufferSource) {
private void batchedentityrendering$endTranslucents(FogParameters fogParameters, DeltaTracker deltaTracker, Camera camera, ProfilerFiller profilerFiller, Matrix4f matrix4f, Matrix4f matrix4f2, ResourceHandle resourceHandle, ResourceHandle resourceHandle2, ResourceHandle resourceHandle3, ResourceHandle resourceHandle4, boolean bl, Frustum frustum, ResourceHandle resourceHandle5, CallbackInfo ci) {
if (WorldRenderingSettings.INSTANCE.shouldSeparateEntityDraws()) {
this.renderBuffers.bufferSource().endBatch();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package net.irisshaders.iris.gl.program;

import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.shaders.ProgramManager;
import net.irisshaders.iris.Iris;
import net.irisshaders.iris.gl.GlResource;
import net.irisshaders.iris.gl.IrisRenderSystem;
Expand Down Expand Up @@ -36,7 +35,7 @@ public final class ComputeProgram extends GlResource {

public static void unbind() {
ProgramUniforms.clearActiveUniforms();
ProgramManager.glUseProgram(0);
GlStateManager._glUseProgram(0);
}

public void setWorkGroupInfo(Vector2f relativeWorkGroups, Vector3i absoluteWorkGroups, FilledIndirectPointer indirectPointer) {
Expand Down Expand Up @@ -65,7 +64,7 @@ public Vector3i getWorkGroups(float width, float height) {
}

public void use() {
ProgramManager.glUseProgram(getGlId());
GlStateManager._glUseProgram(getGlId());

uniforms.update();
samplers.update();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package net.irisshaders.iris.gl.program;

import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.shaders.ProgramManager;
import net.irisshaders.iris.gl.GlResource;
import net.irisshaders.iris.gl.IrisRenderSystem;
import org.lwjgl.opengl.GL43C;
Expand All @@ -14,6 +13,10 @@ public final class Program extends GlResource {
Program(int program, ProgramUniforms uniforms, ProgramSamplers samplers, ProgramImages images) {
super(program);

if (program == 0) {
throw new IllegalStateException("Created a program with ID 0 somehow.");
}

this.uniforms = uniforms;
this.samplers = samplers;
this.images = images;
Expand All @@ -22,12 +25,12 @@ public final class Program extends GlResource {
public static void unbind() {
ProgramUniforms.clearActiveUniforms();
ProgramSamplers.clearActiveSamplers();
ProgramManager.glUseProgram(0);
GlStateManager._glUseProgram(0);
}

public void use() {
IrisRenderSystem.memoryBarrier(GL43C.GL_SHADER_IMAGE_ACCESS_BARRIER_BIT | GL43C.GL_TEXTURE_FETCH_BARRIER_BIT | GL43C.GL_SHADER_STORAGE_BARRIER_BIT);
ProgramManager.glUseProgram(getGlId());
GlStateManager._glUseProgram(getGlId());

uniforms.update();
samplers.update();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ public int getRowWidth() {

@Override
protected void renderListBackground(GuiGraphics pAbstractSelectionList0) {
if (screen.listTransition.getAsFloat() < 0.02f) return;
RenderSystem.enableBlend();
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, screen.listTransition.getAsFloat());
pAbstractSelectionList0.blit(RenderType::guiTextured,
Expand All @@ -93,16 +92,21 @@ protected void renderListBackground(GuiGraphics pAbstractSelectionList0) {
32,
32
);
pAbstractSelectionList0.flush();

RenderSystem.disableBlend();
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
}
@Override
protected void renderListSeparators(GuiGraphics pAbstractSelectionList0) {
if (screen.listTransition.getAsFloat() < 0.02f) return;

RenderSystem.enableBlend();
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, screen.listTransition.getAsFloat());
pAbstractSelectionList0.blit(RenderType::guiTextured, CreateWorldScreen.HEADER_SEPARATOR, this.getX(), this.getY() + 2, 0.0F, 0.0F, this.getWidth(), 2, 32, 2);
pAbstractSelectionList0.blit(RenderType::guiTextured, CreateWorldScreen.FOOTER_SEPARATOR, this.getX(), this.getBottom(), 0.0F, 0.0F, this.getWidth(), 2, 32, 2);
pAbstractSelectionList0.flush();

RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
RenderSystem.disableBlend();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
import net.minecraft.client.gui.screens.ConfirmLinkScreen;
import net.minecraft.client.gui.screens.ConfirmScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.renderer.LevelTargetBundle;
import net.minecraft.client.renderer.PostChain;
import net.minecraft.network.chat.CommonComponents;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.FormattedCharSequence;
import org.jetbrains.annotations.Nullable;
import org.lwjgl.glfw.GLFW;
Expand Down Expand Up @@ -61,6 +63,7 @@ public class ShaderPackScreen extends Screen implements HudHideable {
private static final Component CONFIGURE_TITLE = Component.translatable("pack.iris.configure.title").withStyle(ChatFormatting.GRAY, ChatFormatting.ITALIC);
private static final int COMMENT_PANEL_WIDTH = 314;
private static final String development = "Development Environment";
private static final ResourceLocation BLUR_POST_CHAIN_ID = ResourceLocation.withDefaultNamespace("blur");
private final Screen parent;
private final MutableComponent irisTextComponent;
private ShaderPackSelectionList shaderPackList;
Expand Down Expand Up @@ -89,7 +92,7 @@ public class ShaderPackScreen extends Screen implements HudHideable {
if (guiHidden) {
return 0.0f;
} else if (this.optionMenuOpen) {
return 0.1f;
return 1.0f;
} else {
return (float) this.minecraft.options.getMenuBackgroundBlurriness();
}
Expand Down Expand Up @@ -360,11 +363,13 @@ public void refreshScreenSwitchButton() {
}

private void processFixedBlur() {
PostChain blurEffect = ((GameRendererAccessor) this.minecraft.gameRenderer).getBlurEffect();
float g = (float) Math.min(this.minecraft.options.getMenuBackgroundBlurriness(), this.blurTransition.getAsFloat());
if (blurEffect != null && g >= 1.0F) {
blurEffect.setUniform("Radius", g);
blurEffect.process(Minecraft.getInstance().getMainRenderTarget(), ((GameRendererAccessor) this.minecraft.gameRenderer).getResourcePool(), this.minecraft.getDeltaTracker());
float f = Math.min(this.minecraft.options.getMenuBackgroundBlurriness(), this.blurTransition.getAsFloat());
if (f >= 1.0F) {
PostChain postChain = this.minecraft.getShaderManager().getPostChain(BLUR_POST_CHAIN_ID, LevelTargetBundle.MAIN_TARGETS);
if (postChain != null) {
postChain.setUniform("Radius", f);
postChain.process(this.minecraft.getMainRenderTarget(), ((GameRendererAccessor) Minecraft.getInstance().gameRenderer).getResourcePool());
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

@Mixin(GameRenderer.class)
public interface GameRendererAccessor {
@Accessor
PostChain getBlurEffect();

@Accessor
CrossFrameResourcePool getResourcePool();
Expand Down
Loading

0 comments on commit 1719c7e

Please sign in to comment.