Skip to content

Commit

Permalink
backport warnings to on cache-critical classes
Browse files Browse the repository at this point in the history
  • Loading branch information
douira committed Feb 6, 2023
1 parent 6cb77fc commit bd78531
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public class InputAvailability {
public final boolean texture;
public final boolean lightmap;
public final boolean overlay;
// WARNING: adding new fields requires updating hashCode and equals methods!

public InputAvailability(boolean texture, boolean lightmap, boolean overlay) {
this.texture = texture;
Expand Down Expand Up @@ -42,10 +43,10 @@ public int pack() {
@Override
public String toString() {
return "InputAvailability{" +
"texture=" + texture +
", lightmap=" + lightmap +
", overlay=" + overlay +
'}';
"texture=" + texture +
", lightmap=" + lightmap +
", overlay=" + overlay +
'}';
}

@Override
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/net/coderbot/iris/gl/blending/AlphaTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public class AlphaTest {

private final AlphaTestFunction function;
private final float reference;
// WARNING: adding new fields requires updating hashCode and equals methods!

public AlphaTest(AlphaTestFunction function, float reference) {
this.function = function;
Expand All @@ -24,8 +25,8 @@ public String toExpression(String alphaAccessor, String alphaThreshold, String i
return "// alpha test disabled\n";
} else if (this == AlphaTests.VERTEX_ALPHA) {
return indentation + "if (!(" + alphaAccessor + " > iris_vertexColor.a)) {\n" +
indentation + " discard;\n" +
indentation + "}\n";
indentation + " discard;\n" +
indentation + "}\n";
} else if (function == AlphaTestFunction.NEVER) {
return "discard;\n";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class ShaderAttributeInputs {
private boolean light;
private boolean normal;
private boolean newLines;
// WARNING: adding new fields requires updating hashCode and equals methods!

public ShaderAttributeInputs(VertexFormat format, boolean isFullbright) {
if (format == DefaultVertexFormat.POSITION_COLOR_NORMAL) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

public class AttributeParameters extends GeometryInfoParameters {
public final InputAvailability inputs;
// WARNING: adding new fields requires updating hashCode and equals methods!

public AttributeParameters(Patch patch,
Object2ObjectMap<Tri<String, TextureType, TextureStage>, String> textureMap,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import net.coderbot.iris.shaderpack.texture.TextureStage;

public class ComputeParameters extends TextureStageParameters {
// WARNING: adding new fields requires updating hashCode and equals methods!

public ComputeParameters(Patch patch, TextureStage stage,
Object2ObjectMap<Tri<String, TextureType, TextureStage>, String> textureMap) {
super(patch, stage, textureMap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

public abstract class GeometryInfoParameters extends Parameters {
public final boolean hasGeometry;
// WARNING: adding new fields requires updating hashCode and equals methods!

public GeometryInfoParameters(Patch patch,
Object2ObjectMap<Tri<String, TextureType, TextureStage>, String> textureMap, boolean hasGeometry) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public abstract class Parameters implements JobParameters {
public final Patch patch;
public PatchShaderType type; // may only be set by TransformPatcher
private final Object2ObjectMap<Tri<String, TextureType, TextureStage>, String> textureMap;
// WARNING: adding new fields requires updating hashCode and equals methods!

public Parameters(Patch patch, Object2ObjectMap<Tri<String, TextureType, TextureStage>, String> textureMap) {
this.patch = patch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public class SodiumParameters extends Parameters {
public final float positionScale;
public final float positionOffset;
public final float textureScale;

public AlphaTest alpha;
// WARNING: adding new fields requires updating hashCode and equals methods!

public SodiumParameters(Patch patch,
Object2ObjectMap<Tri<String, TextureType, TextureStage>, String> textureMap,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

public class TextureStageParameters extends Parameters {
private final TextureStage stage;
// WARNING: adding new fields requires updating hashCode and equals methods!

public TextureStageParameters(Patch patch, TextureStage stage,
Object2ObjectMap<Tri<String, TextureType, TextureStage>, String> textureMap) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class VanillaParameters extends GeometryInfoParameters {
public final AlphaTest alpha;
public final ShaderAttributeInputs inputs;
public final boolean hasChunkOffset;
// WARNING: adding new fields requires updating hashCode and equals methods!

public VanillaParameters(
Patch patch,
Expand Down

0 comments on commit bd78531

Please sign in to comment.