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')) println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
minecraft { minecraft {
// mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}" mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}"
mappings channel: 'official', version: "${minecraft_version}"
runs { runs {
client { client {
@ -114,8 +113,8 @@ dependencies {
// switch to implementation for debugging // switch to implementation for debugging
compileOnly fg.deobf("maven.modrinth:starlight-forge:1.0.2+1.18.2") 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("maven.modrinth:rubidium:0.6.1")
compileOnly fg.deobf("curse.maven:oculus-581495:3821406") compileOnly fg.deobf("maven.modrinth:oculus:1.19-1.2.5a")
// https://discord.com/channels/313125603924639766/725850371834118214/910619168821354497 // https://discord.com/channels/313125603924639766/725850371834118214/910619168821354497
// Prevent Mixin annotation processor from getting into IntelliJ's annotation processor settings // 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 info
mod_version = 0.6.5 mod_version = 0.6.5
artifact_minecraft_version = 1.19 artifact_minecraft_version = 1.19.2
minecraft_version = 1.19 minecraft_version = 1.19.2
forge_version = 41.0.94 forge_version = 43.0.8
# build dependency versions # build dependency versions
forgegradle_version = 5.1.53 forgegradle_version = 5.1.53
@ -14,7 +14,7 @@ mixingradle_version = 0.7-SNAPSHOT
mixin_version = 0.8.5 mixin_version = 0.8.5
librarian_version = 1.+ librarian_version = 1.+
cursegradle_version = 1.4.0 cursegradle_version = 1.4.0
parchment_version = 2022.07.10 parchment_version = 2022.08.10
# curseforge info # curseforge info
projectId = 486392 projectId = 486392

View file

@ -44,6 +44,10 @@ public class GlStateTracker {
public void restore() { public void restore() {
GlBufferType[] values = GlBufferType.values(); GlBufferType[] values = GlBufferType.values();
if (GlStateTracker.vao != 0) {
GlStateManager._glBindVertexArray(0);
}
for (int i = 0; i < values.length; i++) { for (int i = 0; i < values.length; i++) {
if (buffers[i] != GlStateTracker.buffers[i]) { if (buffers[i] != GlStateTracker.buffers[i]) {
GlStateManager._glBindBuffer(values[i].glEnum, 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. * Creating a PartialModel will make the associated modelLocation automatically load.
* PartialModels must be initialized during {@link net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent FMLClientSetupEvent}. * PartialModels must be initialized during {@link net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent FMLClientSetupEvent}.
* <br> * <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. * will have their bakedModel fields populated.
* <br> * <br>
* Attempting to create a PartialModel after ModelRegistryEvent will cause an error. * 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; this.name = name;
RenderedBuffer renderedBuffer = pair.first(); RenderedBuffer renderedBuffer = pair.first();
if (renderedBuffer == null) {
reader = null;
eboSupplier = () -> null;
return;
}
BufferBuilder.DrawState drawState = renderedBuffer.drawState(); BufferBuilder.DrawState drawState = renderedBuffer.drawState();
reader = Formats.BLOCK.createReader(renderedBuffer, pair.second()); reader = Formats.BLOCK.createReader(renderedBuffer, pair.second());
if (drawState.sequentialIndex()) { if (!drawState.sequentialIndex()) {
ByteBuffer src = renderedBuffer.indexBuffer(); ByteBuffer src = renderedBuffer.indexBuffer();
ByteBuffer indexBuffer = MemoryTracker.create(src.capacity()); ByteBuffer indexBuffer = MemoryTracker.create(src.capacity());
MemoryUtil.memCopy(src, indexBuffer); MemoryUtil.memCopy(src, indexBuffer);

View file

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

View file

@ -71,7 +71,7 @@ Vertex FLWCreateVertex() {
ByteBuffer vertexBuffer = renderedBuffer.vertexBuffer(); ByteBuffer vertexBuffer = renderedBuffer.vertexBuffer();
int vertexCount = drawState.vertexCount(); int vertexCount = drawState.vertexCount();
if (unshadedStartVertex > 0 && unshadedStartVertex < vertexCount) { if (unshadedStartVertex >= 0 && unshadedStartVertex < vertexCount) {
return createReader(vertexBuffer, vertexCount, unshadedStartVertex); return createReader(vertexBuffer, vertexCount, unshadedStartVertex);
} else { } else {
return createReader(vertexBuffer, vertexCount); 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.BeginFrameEvent;
import com.jozufozu.flywheel.event.ReloadRenderersEvent; import com.jozufozu.flywheel.event.ReloadRenderersEvent;
import com.jozufozu.flywheel.event.RenderLayerEvent; import com.jozufozu.flywheel.event.RenderLayerEvent;
import com.mojang.blaze3d.vertex.BufferUploader;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Matrix4f; import com.mojang.math.Matrix4f;
@ -58,7 +57,7 @@ public class LevelRendererMixin {
* This only gets injected if renderChunkLayer is not Overwritten * This only gets injected if renderChunkLayer is not Overwritten
*/ */
@Group(name = "flywheel$renderLayer", min = 1, max = 2) @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) { 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$renderLayer(type, stack, camX, camY, camZ);
flywheel$LayerRendered = true; flywheel$LayerRendered = true;
@ -74,7 +73,6 @@ public class LevelRendererMixin {
flywheel$renderLayer(type, stack, camX, camY, camZ); flywheel$renderLayer(type, stack, camX, camY, camZ);
} }
flywheel$LayerRendered = false; flywheel$LayerRendered = false;
BufferUploader.reset();
} }
@Unique @Unique

View file

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

View file

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