Skip to content

Commit

Permalink
Merge branch 'dev' into snapshot/dev2
Browse files Browse the repository at this point in the history
# Conflicts:
#	common/src/main/java/net/caffeinemc/mods/sodium/mixin/features/render/compositing/RenderTargetMixin.java
#	common/src/main/java/net/caffeinemc/mods/sodium/mixin/features/textures/mipmaps/SpriteContentsMixin.java
  • Loading branch information
IMS212 committed Sep 5, 2024
2 parents fe35e5c + e1bae36 commit a5685bb
Show file tree
Hide file tree
Showing 62 changed files with 804 additions and 514 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ micro-stutter, while fixing many graphical issues in Minecraft.

### 📥 Installation

The latest releases of Sodium are published to our official [Modrinth](https://modrinth.com/mod/sodium) and
[GitHub release](https://github.com/CaffeineMC/sodium-fabric/releases) pages. These releases are considered by our
team to be suitable for general use, but they are not guaranteed to be free of bugs and other issues.
The latest version of Sodium can be downloaded from our official [Modrinth](https://modrinth.com/mod/sodium) and
[CurseForge](https://www.curseforge.com/minecraft/mc-mods/sodium) pages.

For more information about downloading and installing the mod, you can read our installation guide on
[Modrinth](https://modrinth.com/mod/sodium#installation).
It also contains information about any currently known compatibility issues, which are often useful to read.
Since the release of Sodium 0.6.0, both the _Fabric_ and _NeoForge_ mod loaders are supported. We generally recommend
that new users prefer to use the _Fabric_ mod loader, since it is more lightweight and stable (for the time being.)

For more information about downloading and installing the mod, please refer to our [Installation Guide](https://github.com/CaffeineMC/sodium-fabric/wiki/Installation).

### 🐛 Reporting Issues

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ val FABRIC_API_VERSION by extra { "0.102.3+1.21.2" }
val PARCHMENT_VERSION by extra { null }

// https://semver.org/
val MOD_VERSION by extra { "0.6.0" }
val MOD_VERSION by extra { "0.6.0-beta.1" }

allprojects {
apply(plugin = "java")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package net.caffeinemc.mods.sodium.api.blockentity;

import java.util.function.Predicate;

import net.caffeinemc.mods.sodium.api.internal.DependencyInjection;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import org.jetbrains.annotations.ApiStatus;

@ApiStatus.Experimental
@ApiStatus.AvailableSince("0.6.0")
public interface BlockEntityRenderHandler {
BlockEntityRenderHandler INSTANCE = DependencyInjection.load(BlockEntityRenderHandler.class,
"net.caffeinemc.mods.sodium.client.render.chunk.BlockEntityRenderHandlerImpl");

static BlockEntityRenderHandler instance() {
return INSTANCE;
}

/**
* Adds a predicate to determine if a block entity should be rendered.
*
* <p>Upon chunk bake, block entities of the given type will have {@code shouldRender} evaluated.
* <br>If <b>all predicates</b> returns {@code true} (and the block entity has a renderer), the block entity will be
* added to the chunk for future rendering.</p>
* @param type The block entity type to associate the given predicate with.
* @param shouldRender The predicate for the block entity to evaluate.
*/
<T extends BlockEntity> void addRenderPredicate(BlockEntityType<T> type, BlockEntityRenderPredicate<T> shouldRender);

/**
* Removes a predicate added by {@code addRenderPredicate}. <b>It must be the same object that was added.</b>
*
* @param type The block entity type to associate the given predicate with.
* @param shouldRender The predicate to remove.
* @return If the predicate existed and was removed.
*/
<T extends BlockEntity> boolean removeRenderPredicate(BlockEntityType<T> type, BlockEntityRenderPredicate<T> shouldRender);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package net.caffeinemc.mods.sodium.api.blockentity;

import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.entity.BlockEntity;
import org.jetbrains.annotations.ApiStatus;

@ApiStatus.Experimental
@ApiStatus.AvailableSince("0.6.0")
@FunctionalInterface
public interface BlockEntityRenderPredicate<T extends BlockEntity> {
boolean shouldRender(BlockGetter blockGetter, BlockPos blockPos, T entity);
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package net.caffeinemc.mods.sodium.api.vertex.buffer;

import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.blaze3d.vertex.VertexFormat;
import net.caffeinemc.mods.sodium.api.memory.MemoryIntrinsics;
import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatDescription;
import org.jetbrains.annotations.Nullable;
import org.lwjgl.system.MemoryStack;

Expand Down Expand Up @@ -61,7 +61,7 @@ private static RuntimeException createUnsupportedVertexConsumerThrowable(VertexC
* @param count The number of vertices to copy
* @param format The format of the vertices
*/
void push(MemoryStack stack, long ptr, int count, VertexFormatDescription format);
void push(MemoryStack stack, long ptr, int count, VertexFormat format);

/**
* If this {@link VertexBufferWriter} passes through data to nested {@link VertexConsumer} implementations,
Expand All @@ -86,9 +86,9 @@ default boolean canUseIntrinsics() {
*/
static void copyInto(VertexBufferWriter writer,
MemoryStack stack, long ptr, int count,
VertexFormatDescription format)
VertexFormat format)
{
var length = count * format.stride();
var length = count * format.getVertexSize();
var copy = stack.nmalloc(length);

MemoryIntrinsics.copyMemory(ptr, copy, length);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package net.caffeinemc.mods.sodium.api.vertex.format;

public interface VertexFormatExtensions {
/**
* Returns an integer identifier that represents this vertex format in the global namespace. These identifiers
* are valid only for the current process lifetime and should not be saved to disk.
*/
int sodium$getGlobalId();
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ static VertexFormatRegistry instance() {
return INSTANCE;
}

VertexFormatDescription get(VertexFormat format);
int allocateGlobalId(VertexFormat format);
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
package net.caffeinemc.mods.sodium.api.vertex.format.common;

import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.VertexFormat;
import net.caffeinemc.mods.sodium.api.math.MatrixHelper;
import net.caffeinemc.mods.sodium.api.vertex.attributes.common.ColorAttribute;
import net.caffeinemc.mods.sodium.api.vertex.attributes.common.PositionAttribute;
import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatDescription;
import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatRegistry;
import org.joml.Matrix4f;

public final class ColorVertex {
public static final VertexFormatDescription FORMAT = VertexFormatRegistry.instance()
.get(DefaultVertexFormat.POSITION_COLOR);
public static final VertexFormat FORMAT = DefaultVertexFormat.POSITION_COLOR;

public static final int STRIDE = 16;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package net.caffeinemc.mods.sodium.api.vertex.format.common;

import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.VertexFormat;
import net.caffeinemc.mods.sodium.api.vertex.attributes.common.*;
import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatDescription;
import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatRegistry;

public final class ModelVertex {
public static final VertexFormatDescription FORMAT = VertexFormatRegistry.instance()
.get(DefaultVertexFormat.NEW_ENTITY);
public final class EntityVertex {
public static final VertexFormat FORMAT = DefaultVertexFormat.NEW_ENTITY;

public static final int STRIDE = 36;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
package net.caffeinemc.mods.sodium.api.vertex.format.common;

import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.VertexFormat;
import net.caffeinemc.mods.sodium.api.vertex.attributes.common.ColorAttribute;
import net.caffeinemc.mods.sodium.api.vertex.attributes.common.LightAttribute;
import net.caffeinemc.mods.sodium.api.vertex.attributes.common.PositionAttribute;
import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatDescription;
import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatRegistry;
import net.caffeinemc.mods.sodium.api.vertex.attributes.common.TextureAttribute;

public final class GlyphVertex {
public static final VertexFormatDescription FORMAT = VertexFormatRegistry.instance()
.get(DefaultVertexFormat.POSITION_COLOR_TEX_LIGHTMAP);
public static final VertexFormat FORMAT = DefaultVertexFormat.POSITION_COLOR_TEX_LIGHTMAP;

public static final int STRIDE = 28;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package net.caffeinemc.mods.sodium.api.vertex.format.common;

import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.VertexFormat;
import net.caffeinemc.mods.sodium.api.vertex.attributes.common.ColorAttribute;
import net.caffeinemc.mods.sodium.api.vertex.attributes.common.NormalAttribute;
import net.caffeinemc.mods.sodium.api.vertex.attributes.common.PositionAttribute;
import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatDescription;
import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatRegistry;

public final class LineVertex {
public static final VertexFormatDescription FORMAT = VertexFormatRegistry.instance()
.get(DefaultVertexFormat.POSITION_COLOR_NORMAL);
public static final VertexFormat FORMAT = DefaultVertexFormat.POSITION_COLOR_NORMAL;

public static final int STRIDE = 20;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
package net.caffeinemc.mods.sodium.api.vertex.format.common;

import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.VertexFormat;
import net.caffeinemc.mods.sodium.api.vertex.attributes.common.ColorAttribute;
import net.caffeinemc.mods.sodium.api.vertex.attributes.common.LightAttribute;
import net.caffeinemc.mods.sodium.api.vertex.attributes.common.PositionAttribute;
import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatDescription;
import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatRegistry;
import net.caffeinemc.mods.sodium.api.vertex.attributes.common.TextureAttribute;

public final class ParticleVertex {
public static final VertexFormatDescription FORMAT = VertexFormatRegistry.instance()
.get(DefaultVertexFormat.PARTICLE);
public static final VertexFormat FORMAT = DefaultVertexFormat.PARTICLE;

public static final int STRIDE = 28;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package net.caffeinemc.mods.sodium.api.vertex.serializer;

import com.mojang.blaze3d.vertex.VertexFormat;
import net.caffeinemc.mods.sodium.api.internal.DependencyInjection;
import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatDescription;

public interface VertexSerializerRegistry {
VertexSerializerRegistry INSTANCE = DependencyInjection.load(VertexSerializerRegistry.class,
Expand All @@ -11,5 +11,7 @@ static VertexSerializerRegistry instance() {
return INSTANCE;
}

VertexSerializer get(VertexFormatDescription srcFormat, VertexFormatDescription dstFormat);
VertexSerializer get(VertexFormat srcFormat, VertexFormat dstFormat);

void registerSerializer(VertexFormat srcFormat, VertexFormat dstFormat, VertexSerializer serializer);
}
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public static MixinConfig load(File file) {

MixinConfig config = new MixinConfig();
config.readProperties(props);
PlatformMixinOverrides.getInstance().applyModOverrides();
PlatformMixinOverrides.getInstance().applyModOverrides().forEach(config::applyModOverride);

return config;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
*/
public record GlVertexAttributeFormat(int typeId, int size) {
public static final GlVertexAttributeFormat FLOAT = new GlVertexAttributeFormat(GL33C.GL_FLOAT, 4);
public static final GlVertexAttributeFormat INT = new GlVertexAttributeFormat(GL33C.GL_INT, 4);
public static final GlVertexAttributeFormat SHORT = new GlVertexAttributeFormat(GL33C.GL_SHORT, 2);
public static final GlVertexAttributeFormat BYTE = new GlVertexAttributeFormat(GL33C.GL_BYTE, 1);
public static final GlVertexAttributeFormat UNSIGNED_SHORT = new GlVertexAttributeFormat(GL33C.GL_UNSIGNED_SHORT, 2);
public static final GlVertexAttributeFormat UNSIGNED_BYTE = new GlVertexAttributeFormat(GL33C.GL_UNSIGNED_BYTE, 1);
public static final GlVertexAttributeFormat UNSIGNED_INT = new GlVertexAttributeFormat(GL33C.GL_UNSIGNED_INT, 4);
Expand Down
Loading

0 comments on commit a5685bb

Please sign in to comment.