6
6
import com .mojang .blaze3d .vertex .VertexFormat ;
7
7
import it .unimi .dsi .fastutil .objects .Object2ObjectOpenHashMap ;
8
8
import net .irisshaders .iris .Iris ;
9
+ import net .irisshaders .iris .compat .SkipList ;
9
10
import net .irisshaders .iris .gl .GLDebug ;
10
11
import net .irisshaders .iris .gl .blending .DepthColorStorage ;
11
12
import net .irisshaders .iris .mixinterface .ShaderInstanceInterface ;
21
22
import net .minecraft .server .packs .resources .ResourceProvider ;
22
23
import org .lwjgl .opengl .KHRDebug ;
23
24
import org .slf4j .Logger ;
25
+ import org .spongepowered .asm .mixin .Dynamic ;
24
26
import org .spongepowered .asm .mixin .Final ;
25
27
import org .spongepowered .asm .mixin .Mixin ;
26
28
import org .spongepowered .asm .mixin .Shadow ;
27
29
import org .spongepowered .asm .mixin .Unique ;
28
30
import org .spongepowered .asm .mixin .injection .At ;
31
+ import org .spongepowered .asm .mixin .injection .Group ;
29
32
import org .spongepowered .asm .mixin .injection .Inject ;
30
33
import org .spongepowered .asm .mixin .injection .Redirect ;
31
34
import org .spongepowered .asm .mixin .injection .callback .CallbackInfo ;
35
38
import java .lang .invoke .MethodType ;
36
39
import java .util .Map ;
37
40
41
+ import static net .irisshaders .iris .compat .SkipList .*;
42
+ import static net .irisshaders .iris .compat .SkipList .shouldSkipList ;
43
+
38
44
@ Mixin (ShaderInstance .class )
39
45
public abstract class MixinShaderInstance implements ShaderInstanceInterface {
40
46
@ Unique
@@ -51,24 +57,22 @@ public abstract class MixinShaderInstance implements ShaderInstanceInterface {
51
57
@ Final
52
58
private Program fragmentProgram ;
53
59
54
- @ Unique
55
- private static final MethodHandle NONE = MethodHandles .constant (Integer .class , 2 );
56
-
57
- @ Unique
58
- private static final MethodHandle ALWAYS = MethodHandles .constant (Integer .class , 1 );
59
-
60
60
@ Unique
61
61
private MethodHandle shouldSkip ;
62
62
63
- private static Map <Class <?>, MethodHandle > shouldSkipList = new Object2ObjectOpenHashMap <>();
64
-
65
63
static {
66
64
shouldSkipList .put (ExtendedShader .class , NONE );
67
65
shouldSkipList .put (FallbackShader .class , NONE );
68
66
}
69
67
70
- @ Inject (method = "<init>(Lnet/minecraft/server/packs/resources/ResourceProvider;Lnet/minecraft/resources/ResourceLocation;Lcom/mojang/blaze3d/vertex/VertexFormat;)V" , at = @ At ("TAIL" ), require = 0 )
71
- private void iriss$storeSkip (ResourceProvider resourceProvider , ResourceLocation string , VertexFormat vertexFormat , CallbackInfo ci ) {
68
+ @ Override
69
+ public void setShouldSkip (MethodHandle s ) {
70
+ shouldSkip = s ;
71
+ }
72
+
73
+
74
+ @ Inject (method = "<init>(Lnet/minecraft/server/packs/resources/ResourceProvider;Ljava/lang/String;Lcom/mojang/blaze3d/vertex/VertexFormat;)V" , at = @ At (value = "FIELD" , target = "Lnet/minecraft/client/renderer/ShaderInstance;CHUNK_OFFSET:Lcom/mojang/blaze3d/shaders/Uniform;" ), require = 0 )
75
+ private void iris$storeSkipFabric (ResourceProvider resourceProvider , String string , VertexFormat vertexFormat , CallbackInfo ci ) {
72
76
shouldSkip = shouldSkipList .computeIfAbsent (getClass (), x -> {
73
77
try {
74
78
MethodHandle iris$skipDraw = MethodHandles .lookup ().findVirtual (x , "iris$skipDraw" , MethodType .methodType (boolean .class ));
@@ -80,7 +84,7 @@ public abstract class MixinShaderInstance implements ShaderInstanceInterface {
80
84
});
81
85
82
86
83
- if (Iris .getIrisConfig ().shouldSkip (string )) {
87
+ if (Iris .getIrisConfig ().shouldSkip (ResourceLocation . tryParse ( string ) )) {
84
88
shouldSkip = ALWAYS ;
85
89
}
86
90
}
0 commit comments