Skip to content

Commit

Permalink
Merge branch 'CaffeineMC:dev' into 1.20.4/pojavFixing
Browse files Browse the repository at this point in the history
  • Loading branch information
TarikBR authored Feb 10, 2024
2 parents dc82f67 + 3980cc5 commit fc36449
Show file tree
Hide file tree
Showing 8 changed files with 356 additions and 437 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,4 @@ public interface VertexFormatDescription {
* start at the byte offset (index * stride).
*/
int stride();

/**
* Returns whether or not the format is "simple" (has no duplicate elements).
*/
boolean isSimpleFormat();
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
import net.caffeinemc.mods.sodium.api.vertex.attributes.CommonVertexAttribute;
import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatDescription;
import net.minecraft.client.render.VertexFormat;
import net.minecraft.client.render.VertexFormats;

import java.util.Arrays;
import java.util.EnumSet;
import java.util.NoSuchElementException;

public class VertexFormatDescriptionImpl implements VertexFormatDescription {
Expand All @@ -16,29 +14,11 @@ public class VertexFormatDescriptionImpl implements VertexFormatDescription {

private final int[] offsets;

private final boolean isSimple;

public VertexFormatDescriptionImpl(VertexFormat format, int id) {
this.id = id;
this.stride = format.getVertexSizeByte();

this.offsets = getOffsets(format);
this.isSimple = checkSimple(format);
}

private static boolean checkSimple(VertexFormat format) {
EnumSet<CommonVertexAttribute> attributeSet = EnumSet.noneOf(CommonVertexAttribute.class);
var elementList = format.getElements();

for (int elementIndex = 0; elementIndex < elementList.size(); elementIndex++) {
var element = elementList.get(elementIndex);
var commonType = CommonVertexAttribute.getCommonType(element);
if (element != VertexFormats.PADDING_ELEMENT && (commonType == null || !attributeSet.add(commonType))) {
return false;
}
}

return true;
}

public static int[] getOffsets(VertexFormat format) {
Expand Down Expand Up @@ -86,9 +66,4 @@ public int id() {
public int stride() {
return this.stride;
}

@Override
public boolean isSimpleFormat() {
return this.isSimple;
}
}

This file was deleted.

Loading

0 comments on commit fc36449

Please sign in to comment.