1.19.2 and more fixes

- Update to 1.19.2
- Unbind VAO before restoring GL state
- Shift RenderLayerEvent dispatching point after vanilla VBO and VAO
clean-up
- Fix BlockModel's check for an index buffer being inverted
- The RenderedBuffer returned from ModelUtil#endShadeSeparated is no
longer nullable
- Allow unshadedStartVertex to be 0
- Remove BufferUploaderMixin
- Fix PartialModel javadoc referencing the old bake event
- Switch back to Parchment mappings
This commit is contained in:
PepperCode1 2022-08-13 23:26:39 -07:00
parent 055ae6c04b
commit d51c373568
11 changed files with 19 additions and 56 deletions

View file

@ -33,8 +33,7 @@ java.toolchain.languageVersion = JavaLanguageVersion.of(17)
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
minecraft {
// mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}"
mappings channel: 'official', version: "${minecraft_version}"
mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}"
runs {
client {
@ -114,8 +113,8 @@ dependencies {
// switch to implementation for debugging
compileOnly fg.deobf("maven.modrinth:starlight-forge:1.0.2+1.18.2")
compileOnly fg.deobf("maven.modrinth:rubidium:0.5.2a")
compileOnly fg.deobf("curse.maven:oculus-581495:3821406")
compileOnly fg.deobf("maven.modrinth:rubidium:0.6.1")
compileOnly fg.deobf("maven.modrinth:oculus:1.19-1.2.5a")
// https://discord.com/channels/313125603924639766/725850371834118214/910619168821354497
// Prevent Mixin annotation processor from getting into IntelliJ's annotation processor settings

View file

@ -3,10 +3,10 @@ org.gradle.daemon = false
# mod version info
mod_version = 0.6.5
artifact_minecraft_version = 1.19
artifact_minecraft_version = 1.19.2
minecraft_version = 1.19
forge_version = 41.0.94
minecraft_version = 1.19.2
forge_version = 43.0.8
# build dependency versions
forgegradle_version = 5.1.53
@ -14,7 +14,7 @@ mixingradle_version = 0.7-SNAPSHOT
mixin_version = 0.8.5
librarian_version = 1.+
cursegradle_version = 1.4.0
parchment_version = 2022.07.10
parchment_version = 2022.08.10
# curseforge info
projectId = 486392

View file

@ -44,6 +44,10 @@ public class GlStateTracker {
public void restore() {
GlBufferType[] values = GlBufferType.values();
if (GlStateTracker.vao != 0) {
GlStateManager._glBindVertexArray(0);
}
for (int i = 0; i < values.length; i++) {
if (buffers[i] != GlStateTracker.buffers[i]) {
GlStateManager._glBindBuffer(values[i].glEnum, buffers[i]);

View file

@ -14,7 +14,7 @@ import net.minecraftforge.client.event.ModelEvent;
* Creating a PartialModel will make the associated modelLocation automatically load.
* PartialModels must be initialized during {@link net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent FMLClientSetupEvent}.
* <br>
* Once {@link ModelBakeEvent} finishes, all PartialModels (with valid modelLocations)
* Once {@link ModelEvent.BakingCompleted} finishes, all PartialModels (with valid modelLocations)
* will have their bakedModel fields populated.
* <br>
* Attempting to create a PartialModel after ModelRegistryEvent will cause an error.

View file

@ -56,17 +56,10 @@ public class BlockModel implements Model {
this.name = name;
RenderedBuffer renderedBuffer = pair.first();
if (renderedBuffer == null) {
reader = null;
eboSupplier = () -> null;
return;
}
BufferBuilder.DrawState drawState = renderedBuffer.drawState();
reader = Formats.BLOCK.createReader(renderedBuffer, pair.second());
if (drawState.sequentialIndex()) {
if (!drawState.sequentialIndex()) {
ByteBuffer src = renderedBuffer.indexBuffer();
ByteBuffer indexBuffer = MemoryTracker.create(src.capacity());
MemoryUtil.memCopy(src, indexBuffer);

View file

@ -67,7 +67,7 @@ public class ModelUtil {
// FIXME: Unshaded indices
((BufferBuilderExtension) shadedBuilder).flywheel$appendBufferUnsafe(unshadedBuffer.vertexBuffer());
}
RenderedBuffer buffer = shadedBuilder.endOrDiscardIfEmpty();
RenderedBuffer buffer = shadedBuilder.end();
return Pair.of(buffer, unshadedStartVertex);
}

View file

@ -71,7 +71,7 @@ Vertex FLWCreateVertex() {
ByteBuffer vertexBuffer = renderedBuffer.vertexBuffer();
int vertexCount = drawState.vertexCount();
if (unshadedStartVertex > 0 && unshadedStartVertex < vertexCount) {
if (unshadedStartVertex >= 0 && unshadedStartVertex < vertexCount) {
return createReader(vertexBuffer, vertexCount, unshadedStartVertex);
} else {
return createReader(vertexBuffer, vertexCount);

View file

@ -1,30 +0,0 @@
package com.jozufozu.flywheel.mixin;
import javax.annotation.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.jozufozu.flywheel.backend.gl.GlStateTracker;
import com.mojang.blaze3d.vertex.BufferUploader;
import com.mojang.blaze3d.vertex.VertexBuffer;
import com.mojang.blaze3d.vertex.VertexFormat;
@Mixin(BufferUploader.class)
public class BufferUploaderMixin {
@Shadow
@Nullable
private static VertexBuffer lastImmediateBuffer;
@Inject(method = "reset", at = @At("HEAD"))
private static void stopBufferUploaderFromClearingBufferStateIfNothingIsBound(CallbackInfo ci) {
// Trust our tracker over BufferUploader's.
if (GlStateTracker.getVertexArray() == 0) {
lastImmediateBuffer = null;
}
}
}

View file

@ -16,7 +16,6 @@ import com.jozufozu.flywheel.core.crumbling.CrumblingRenderer;
import com.jozufozu.flywheel.event.BeginFrameEvent;
import com.jozufozu.flywheel.event.ReloadRenderersEvent;
import com.jozufozu.flywheel.event.RenderLayerEvent;
import com.mojang.blaze3d.vertex.BufferUploader;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Matrix4f;
@ -58,7 +57,7 @@ public class LevelRendererMixin {
* This only gets injected if renderChunkLayer is not Overwritten
*/
@Group(name = "flywheel$renderLayer", min = 1, max = 2)
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/ShaderInstance;clear()V"), method = "renderChunkLayer")
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiling/ProfilerFiller;pop()V", ordinal = 1), method = "renderChunkLayer")
private void renderLayer(RenderType type, PoseStack stack, double camX, double camY, double camZ, Matrix4f p_172999_, CallbackInfo ci) {
flywheel$renderLayer(type, stack, camX, camY, camZ);
flywheel$LayerRendered = true;
@ -74,7 +73,6 @@ public class LevelRendererMixin {
flywheel$renderLayer(type, stack, camX, camY, camZ);
}
flywheel$LayerRendered = false;
BufferUploader.reset();
}
@Unique

View file

@ -1,5 +1,5 @@
modLoader = "javafml"
loaderVersion = "[41,)"
loaderVersion = "[43,)"
issueTrackerURL = "https://github.com/Jozufozu/Flywheel/issues"
license = "MIT"
@ -18,13 +18,13 @@ A modern engine for modded minecraft.'''
[[dependencies.flywheel]]
modId = "forge"
mandatory = true
versionRange = "[41.0.0,)"
versionRange = "[43.0.0,)"
ordering = "NONE"
side = "CLIENT"
[[dependencies.flywheel]]
modId = "minecraft"
mandatory = true
versionRange = "[1.19,1.20)"
versionRange = "[1.19.2,1.20)"
ordering = "NONE"
side = "CLIENT"

View file

@ -8,7 +8,6 @@
"BlockEntityRenderDispatcherAccessor",
"BlockEntityTypeMixin",
"BufferBuilderMixin",
"BufferUploaderMixin",
"CameraMixin",
"instancemanage.ChunkRebuildHooksMixin",
"instancemanage.ChunkRenderDispatcherAccessor",