mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-12-27 07:26:48 +01:00
Lazily instantiate DrawBuffers
- Iris/Oculus create wrapper RenderTypes whose DrawBuffers are never used. Creating the DrawBuffer on retrieval solves this inefficiency. - Add 1.18.2 as a Minecraft version to the issue template
This commit is contained in:
parent
70616d381a
commit
832c94f2ba
3 changed files with 8 additions and 1 deletions
1
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
1
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
|
@ -90,6 +90,7 @@ body:
|
|||
label: Minecraft Version
|
||||
description: The version of Minecraft you were using when the bug occured
|
||||
options:
|
||||
- "1.18.2"
|
||||
- "1.18.1"
|
||||
- "1.18"
|
||||
- "1.17.1"
|
||||
|
|
|
@ -2,6 +2,8 @@ package com.jozufozu.flywheel.backend.instancing;
|
|||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
import com.jozufozu.flywheel.backend.model.BufferBuilderExtension;
|
||||
import com.jozufozu.flywheel.backend.model.DirectVertexConsumer;
|
||||
import com.mojang.blaze3d.platform.MemoryTracker;
|
||||
|
@ -20,6 +22,7 @@ public class DrawBuffer {
|
|||
private ByteBuffer backingBuffer;
|
||||
private int expectedVertices;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public DrawBuffer(RenderType parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
|
|
@ -14,11 +14,14 @@ import net.minecraft.client.renderer.RenderType;
|
|||
public class RenderTypeMixin implements RenderTypeExtension {
|
||||
|
||||
@Unique
|
||||
private final DrawBuffer flywheel$drawBuffer = new DrawBuffer((RenderType) (Object) this);
|
||||
private DrawBuffer flywheel$drawBuffer;
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public DrawBuffer flywheel$getDrawBuffer() {
|
||||
if (flywheel$drawBuffer == null) {
|
||||
flywheel$drawBuffer = new DrawBuffer((RenderType) (Object) this);
|
||||
}
|
||||
return flywheel$drawBuffer;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue