Skip to content

Commit

Permalink
Merge pull request MCRcortex#1 from IMS212/refg
Browse files Browse the repository at this point in the history
Iris 1.7 + 1.20.6
  • Loading branch information
bobcao3 authored Jun 2, 2024
2 parents 71e2655 + ea2b9cf commit 5c63da3
Show file tree
Hide file tree
Showing 26 changed files with 89 additions and 93 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ol
# Work in progress
Minecraft mod that adds hardware raytracing support to minecraft using opengl vulkan interop

Expand Down
30 changes: 15 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.2-SNAPSHOT'
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'maven-publish'
}

Expand Down Expand Up @@ -38,8 +38,8 @@ dependencies {
modImplementation("net.fabricmc.fabric-api:fabric-rendering-data-attachment-v1:0.3.38+73761d2e9a")
modImplementation(fabricApi.module("fabric-resource-loader-v0", project.fabric_version))

modImplementation "maven.modrinth:sodium:mc1.20.2-0.5.5"
modImplementation "maven.modrinth:iris:1.6.14+1.20.2"
modImplementation "maven.modrinth:sodium:mc1.20.6-0.5.8"
modImplementation "maven.modrinth:iris:1.7.0+1.20.6"

modRuntimeOnly 'org.anarres:jcpp:1.4.14'
modRuntimeOnly 'io.github.douira:glsl-transformer:2.0.0-pre13'
Expand Down Expand Up @@ -106,7 +106,7 @@ publishing {

import org.gradle.internal.os.OperatingSystem

project.ext.lwjglVersion = "3.3.1"
project.ext.lwjglVersion = "3.3.3"

switch (OperatingSystem.current()) {
case OperatingSystem.LINUX:
Expand Down Expand Up @@ -134,23 +134,23 @@ dependencies {
include(implementation("org.lwjgl:lwjgl-shaderc"))
include(implementation("org.lwjgl:lwjgl-spvc"))

include(runtimeOnly("org.lwjgl:lwjgl-meshoptimizer:$lwjglVersion:$lwjglNatives"))
include(runtimeOnly("org.lwjgl:lwjgl-vma:$lwjglVersion:$lwjglNatives"))
include(runtimeOnly("org.lwjgl:lwjgl-shaderc:$lwjglVersion:$lwjglNatives"))
include(runtimeOnly("org.lwjgl:lwjgl-spvc:$lwjglVersion:$lwjglNatives"))
include(runtimeOnly("org.lwjgl:lwjgl-meshoptimizer:$lwjglVersion:natives-linux"))
include(runtimeOnly("org.lwjgl:lwjgl-vma:$lwjglVersion:natives-linux"))
include(runtimeOnly("org.lwjgl:lwjgl-shaderc:$lwjglVersion:natives-linux"))
include(runtimeOnly("org.lwjgl:lwjgl-spvc:$lwjglVersion:natives-linux"))

include(implementation("org.lwjgl:lwjgl-meshoptimizer:$lwjglVersion:$lwjglNatives"))
include(implementation("org.lwjgl:lwjgl-vma:$lwjglVersion:$lwjglNatives"))
include(implementation("org.lwjgl:lwjgl-shaderc:$lwjglVersion:$lwjglNatives"))
include(implementation("org.lwjgl:lwjgl-spvc:$lwjglVersion:$lwjglNatives"))
include(implementation("org.lwjgl:lwjgl-meshoptimizer:$lwjglVersion:natives-linux"))
include(implementation("org.lwjgl:lwjgl-vma:$lwjglVersion:natives-linux"))
include(implementation("org.lwjgl:lwjgl-shaderc:$lwjglVersion:natives-linux"))
include(implementation("org.lwjgl:lwjgl-spvc:$lwjglVersion:natives-linux"))


implementation "org.lwjgl:lwjgl"
implementation "org.lwjgl:lwjgl-glfw"
implementation "org.lwjgl:lwjgl-opengl"
runtimeOnly "org.lwjgl:lwjgl::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-glfw::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-opengl::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl::natives-linux"
runtimeOnly "org.lwjgl:lwjgl-glfw::natives-linux"
runtimeOnly "org.lwjgl:lwjgl-opengl::natives-linux"
}


Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
org.gradle.jvmargs=-Xmx4G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.20.2
yarn_mappings=1.20.2+build.4
loader_version=0.15.6
minecraft_version=1.20.6
yarn_mappings=1.20.6+build.3
loader_version=0.15.11

#Fabric api
fabric_version=0.91.6+1.20.2
fabric_version=0.99.4+1.20.6
# Mod Properties
mod_version=0.0.4-pre-alpha
maven_group=me.cortex
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import me.cortex.vulkanite.lib.memory.VAccelerationStructure;
import me.cortex.vulkanite.lib.memory.VBuffer;
import me.cortex.vulkanite.lib.other.VUtil;
import net.coderbot.iris.vertices.IrisVertexFormats;
import net.irisshaders.iris.vertices.IrisVertexFormats;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.BufferBuilder;
import net.minecraft.client.render.RenderLayer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import me.cortex.vulkanite.lib.memory.VBuffer;
import me.cortex.vulkanite.lib.other.VUtil;
import me.cortex.vulkanite.lib.other.sync.VFence;
import net.coderbot.iris.mixin.LevelRendererAccessor;
import net.coderbot.iris.vertices.IrisVertexFormats;
import net.irisshaders.iris.mixin.LevelRendererAccessor;
import net.irisshaders.iris.vertices.IrisVertexFormats;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.*;
import net.minecraft.client.texture.TextureManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
import me.cortex.vulkanite.lib.shader.reflection.ShaderReflection;
import me.cortex.vulkanite.mixin.iris.MixinCelestialUniforms;
import me.cortex.vulkanite.mixin.iris.MixinCommonUniforms;
import net.coderbot.iris.gl.buffer.ShaderStorageBuffer;
import net.coderbot.iris.texture.pbr.PBRTextureHolder;
import net.coderbot.iris.texture.pbr.PBRTextureManager;
import net.coderbot.iris.uniforms.CapturedRenderingState;
import net.coderbot.iris.uniforms.CommonUniforms;
import net.coderbot.iris.uniforms.SystemTimeUniforms;
import net.irisshaders.iris.gl.buffer.ShaderStorageBuffer;
import net.irisshaders.iris.texture.pbr.PBRTextureHolder;
import net.irisshaders.iris.texture.pbr.PBRTextureManager;
import net.irisshaders.iris.uniforms.CapturedRenderingState;
import net.irisshaders.iris.uniforms.CommonUniforms;
import net.irisshaders.iris.uniforms.SystemTimeUniforms;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.Camera;
import net.minecraft.client.texture.AbstractTexture;
Expand Down Expand Up @@ -102,12 +102,12 @@ public VulkanPipeline(VContext ctx, AccelerationManager accelerationManager, Ray
this.blockAtlasNormalView = new SharedImageViewTracker(ctx, () -> {
AbstractTexture blockAtlas = MinecraftClient.getInstance().getTextureManager().getTexture(new Identifier("minecraft", "textures/atlas/blocks.png"));
PBRTextureHolder holder = PBRTextureManager.INSTANCE.getOrLoadHolder(blockAtlas.getGlId());//((TextureAtlasExtension)blockAtlas).getPBRHolder()
return ((IVGImage) holder.getNormalTexture()).getVGImage();
return ((IVGImage) holder.normalTexture()).getVGImage();
});
this.blockAtlasSpecularView = new SharedImageViewTracker(ctx, () -> {
AbstractTexture blockAtlas = MinecraftClient.getInstance().getTextureManager().getTexture(new Identifier("minecraft", "textures/atlas/blocks.png"));
PBRTextureHolder holder = PBRTextureManager.INSTANCE.getOrLoadHolder(blockAtlas.getGlId());//((TextureAtlasExtension)blockAtlas).getPBRHolder()
return ((IVGImage) holder.getSpecularTexture()).getVGImage();
return ((IVGImage) holder.specularTexture()).getVGImage();
});
this.placeholderSpecular = ctx.memory.createImage2D(4, 4, 1, VK_FORMAT_R8G8B8A8_UNORM, VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
this.placeholderSpecularView = VImageView.create(ctx, placeholderSpecular);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package me.cortex.vulkanite.compat;

import net.coderbot.iris.shaderpack.ProgramDirectives;
import net.coderbot.iris.shaderpack.ProgramSet;

public class RaytracingShaderSource {
public record RayHitSource(String close, String any, String intersection) {}
public final String name;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package me.cortex.vulkanite.lib.other;

import net.coderbot.iris.gl.texture.InternalTextureFormat;
import net.irisshaders.iris.gl.texture.InternalTextureFormat;

import static org.lwjgl.opengl.GL11C.GL_RGB8;
import static org.lwjgl.opengl.GL11C.GL_RGBA16;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package me.cortex.vulkanite.mixin.iris;

import net.coderbot.iris.uniforms.CelestialUniforms;
import net.irisshaders.iris.uniforms.CelestialUniforms;
import org.joml.Vector4f;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package me.cortex.vulkanite.mixin.iris;

import net.coderbot.iris.uniforms.CommonUniforms;
import net.irisshaders.iris.uniforms.CommonUniforms;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
import me.cortex.vulkanite.client.Vulkanite;
import me.cortex.vulkanite.compat.IRenderTargetVkGetter;
import me.cortex.vulkanite.lib.memory.VGImage;
import net.coderbot.iris.gl.GlResource;
import net.coderbot.iris.gl.texture.InternalTextureFormat;
import net.coderbot.iris.gl.texture.PixelFormat;
import net.coderbot.iris.rendertarget.RenderTarget;
import net.irisshaders.iris.gl.GlResource;
import net.irisshaders.iris.gl.texture.InternalTextureFormat;
import net.irisshaders.iris.gl.texture.PixelFormat;
import org.spongepowered.asm.mixin.*;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/me/cortex/vulkanite/mixin/iris/MixinGlTexture.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import me.cortex.vulkanite.lib.base.VRef;
import me.cortex.vulkanite.lib.memory.VGImage;
import me.cortex.vulkanite.lib.other.FormatConverter;
import net.coderbot.iris.gl.IrisRenderSystem;
import net.coderbot.iris.gl.texture.GlTexture;
import net.coderbot.iris.gl.texture.InternalTextureFormat;
import net.coderbot.iris.gl.texture.TextureType;
import net.coderbot.iris.shaderpack.texture.TextureFilteringData;
import net.irisshaders.iris.gl.IrisRenderSystem;
import net.irisshaders.iris.gl.texture.GlTexture;
import net.irisshaders.iris.gl.texture.InternalTextureFormat;
import net.irisshaders.iris.gl.texture.TextureType;
import net.irisshaders.iris.shaderpack.texture.TextureFilteringData;
import org.lwjgl.opengl.GL30;
import org.spongepowered.asm.mixin.*;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -31,7 +31,7 @@ private static int redirectGen() {
return -1;
}

@Redirect(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/coderbot/iris/gl/texture/GlTexture;getGlId()I", ordinal = 0))
@Redirect(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/irisshaders/iris/gl/texture/GlTexture;getGlId()I", ordinal = 0))
private int redirectTextureCreation(GlTexture instance, TextureType target, int sizeX, int sizeY, int sizeZ, int internalFormat, int format, int pixelType, byte[] pixels, TextureFilteringData filteringData) {
// Before getting the texture id, create the texture that wasn't created earlier

Expand Down Expand Up @@ -65,7 +65,7 @@ private int redirectTextureCreation(GlTexture instance, TextureType target, int
return sharedImage.get().glId;
}

@Redirect(method="<init>", at = @At(value = "INVOKE", target = "Lnet/coderbot/iris/gl/texture/TextureType;apply(IIIIIIILjava/nio/ByteBuffer;)V"))
@Redirect(method="<init>", at = @At(value = "INVOKE", target = "Lnet/irisshaders/iris/gl/texture/TextureType;apply(IIIIIIILjava/nio/ByteBuffer;)V"))
private void redirectUpload(TextureType instance, int glId, int width, int height, int depth, int internalFormat, int format, int pixelType, ByteBuffer data) {
int target = instance.getGlType();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
import me.cortex.vulkanite.lib.base.VContext;
import me.cortex.vulkanite.lib.base.VRef;
import me.cortex.vulkanite.lib.memory.VGImage;
import net.coderbot.iris.gl.buffer.ShaderStorageBuffer;
import net.coderbot.iris.gl.texture.TextureAccess;
import net.coderbot.iris.gl.buffer.ShaderStorageBufferHolder;
import net.coderbot.iris.mixin.LevelRendererAccessor;
import net.coderbot.iris.pipeline.CustomTextureManager;
import net.coderbot.iris.pipeline.newshader.NewWorldRenderingPipeline;
import net.coderbot.iris.rendertarget.RenderTargets;
import net.coderbot.iris.shaderpack.ProgramSet;
import net.coderbot.iris.shaderpack.texture.TextureStage;
import net.coderbot.iris.uniforms.CelestialUniforms;
import net.irisshaders.iris.gl.buffer.ShaderStorageBuffer;
import net.irisshaders.iris.gl.texture.TextureAccess;
import net.irisshaders.iris.gl.buffer.ShaderStorageBufferHolder;
import net.irisshaders.iris.mixin.LevelRendererAccessor;
import net.irisshaders.iris.pipeline.CustomTextureManager;
import net.irisshaders.iris.pipeline.IrisRenderingPipeline;
import net.irisshaders.iris.shaderpack.programs.ProgramSet;
import net.irisshaders.iris.shaderpack.texture.TextureStage;
import net.irisshaders.iris.targets.RenderTargets;
import net.irisshaders.iris.uniforms.CelestialUniforms;
import net.minecraft.client.render.Camera;
import net.minecraft.client.MinecraftClient;
import org.spongepowered.asm.mixin.Final;
Expand All @@ -33,8 +33,8 @@
import java.util.Comparator;
import java.util.List;

@Mixin(value = NewWorldRenderingPipeline.class, remap = false)
public class MixinNewWorldRenderingPipeline {
@Mixin(value = IrisRenderingPipeline.class, remap = false)
public class MixinIrisRenderingPipeline {

@Shadow @Final private RenderTargets renderTargets;
@Shadow @Final private CustomTextureManager customTextureManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import me.cortex.vulkanite.compat.IVGImage;
import me.cortex.vulkanite.lib.base.VRef;
import me.cortex.vulkanite.mixin.minecraft.MixinAbstractTexture;
import net.coderbot.iris.gl.IrisRenderSystem;
import net.coderbot.iris.rendertarget.NativeImageBackedCustomTexture;
import net.irisshaders.iris.gl.IrisRenderSystem;
import net.irisshaders.iris.targets.backed.NativeImageBackedCustomTexture;
import net.minecraft.client.texture.AbstractTexture;
import net.minecraft.client.texture.NativeImage;
import net.minecraft.client.texture.NativeImageBackedTexture;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import me.cortex.vulkanite.client.Vulkanite;
import me.cortex.vulkanite.compat.IVGImage;
import me.cortex.vulkanite.lib.base.VRef;
import net.coderbot.iris.texture.pbr.PBRAtlasTexture;
import net.irisshaders.iris.texture.pbr.PBRAtlasTexture;
import net.minecraft.client.texture.AbstractTexture;
import net.minecraft.client.texture.SpriteAtlasTexture;
import org.spongepowered.asm.mixin.Mixin;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package me.cortex.vulkanite.mixin.iris;

import com.google.common.collect.ImmutableSet;
import net.coderbot.iris.shaderpack.PackRenderTargetDirectives;
import net.irisshaders.iris.shaderpack.properties.PackRenderTargetDirectives;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

import me.cortex.vulkanite.compat.IGetRaytracingSource;
import me.cortex.vulkanite.compat.RaytracingShaderSource;
import net.coderbot.iris.shaderpack.ProgramSet;
import net.coderbot.iris.shaderpack.ProgramSource;
import net.coderbot.iris.shaderpack.ShaderPack;
import net.coderbot.iris.shaderpack.ShaderProperties;
import net.coderbot.iris.shaderpack.include.AbsolutePackPath;
import net.irisshaders.iris.shaderpack.ShaderPack;
import net.irisshaders.iris.shaderpack.include.AbsolutePackPath;
import net.irisshaders.iris.shaderpack.programs.ProgramSet;
import net.irisshaders.iris.shaderpack.properties.ShaderProperties;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import me.cortex.vulkanite.lib.base.VRef;
import me.cortex.vulkanite.lib.memory.VGImage;
import me.cortex.vulkanite.lib.other.FormatConverter;
import net.coderbot.iris.gl.texture.InternalTextureFormat;
import net.coderbot.iris.gl.texture.PixelFormat;
import net.coderbot.iris.rendertarget.RenderTarget;
import net.irisshaders.iris.gl.texture.InternalTextureFormat;
import net.irisshaders.iris.gl.texture.PixelFormat;
import net.irisshaders.iris.targets.RenderTarget;
import org.spongepowered.asm.mixin.*;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -33,15 +33,15 @@ private void redirectGen(int[] textures) {

}

@Redirect(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/coderbot/iris/rendertarget/RenderTarget;setupTexture(IIIZ)V", ordinal = 0))
@Redirect(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/irisshaders/iris/targets/RenderTarget;setupTexture(IIIZ)V", ordinal = 0))
private void redirectMain(RenderTarget instance, int id, int width, int height, boolean allowsLinear) {
setupTextures(width, height, allowsLinear);
}

@Redirect(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/coderbot/iris/rendertarget/RenderTarget;setupTexture(IIIZ)V", ordinal = 1))
@Redirect(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/irisshaders/iris/targets/RenderTarget;setupTexture(IIIZ)V", ordinal = 1))
private void redirectAlt(RenderTarget instance, int id, int width, int height, boolean allowsLinear) {}

@Redirect(method = "setupTexture", at = @At(value = "INVOKE",target = "Lnet/coderbot/iris/rendertarget/RenderTarget;resizeTexture(III)V"))
@Redirect(method = "setupTexture", at = @At(value = "INVOKE",target = "Lnet/irisshaders/iris/targets/RenderTarget;resizeTexture(III)V"))
private void redirectResize(RenderTarget instance, int t, int w, int h) {}

@Overwrite
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package me.cortex.vulkanite.mixin.iris;

import com.google.common.collect.ImmutableList;
import net.coderbot.iris.shaderpack.include.ShaderPackSourceNames;
import net.irisshaders.iris.shaderpack.include.ShaderPackSourceNames;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import me.cortex.vulkanite.compat.IVGBuffer;
import me.cortex.vulkanite.lib.base.VRef;
import me.cortex.vulkanite.lib.memory.VGBuffer;
import net.coderbot.iris.gl.IrisRenderSystem;
import net.coderbot.iris.gl.buffer.ShaderStorageBuffer;
import net.irisshaders.iris.gl.IrisRenderSystem;
import net.irisshaders.iris.gl.buffer.ShaderStorageBuffer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
Expand Down Expand Up @@ -36,7 +36,7 @@ public void setBuffer(VRef<VGBuffer> buffer) {
}
}

@Redirect(method = "destroy", at = @At(value = "INVOKE", target = "Lnet/coderbot/iris/gl/IrisRenderSystem;deleteBuffers(I)V"))
@Redirect(method = "destroy", at = @At(value = "INVOKE", target = "Lnet/irisshaders/iris/gl/IrisRenderSystem;deleteBuffers(I)V"))
private void redirectDelete(int id) {
if (vkBuffer != null) {
vkBuffer = null;
Expand Down
Loading

0 comments on commit 5c63da3

Please sign in to comment.