mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-12-27 07:26:48 +01:00
AAAAAAAAAAAAMD
- Fixes issue rendering models in block format while using instancing on AMD - A very hacky fix, everything will be cleaner in 1.0 - Diagonalport flw.loadRenderDoc jvm arg from 1.18/culling
This commit is contained in:
parent
d51c373568
commit
9b56d16f55
6 changed files with 47 additions and 10 deletions
|
@ -44,6 +44,7 @@ minecraft {
|
|||
property 'mixin.debug.export', 'true'
|
||||
property 'mixin.env.remapRefMap', 'true'
|
||||
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
|
||||
property 'flw.loadRenderDoc', 'true'
|
||||
|
||||
arg '-mixin.config=flywheel.mixins.json'
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.jozufozu.flywheel.backend.model;
|
||||
|
||||
import com.jozufozu.flywheel.core.Formats;
|
||||
import com.jozufozu.flywheel.core.model.Model;
|
||||
|
||||
public enum FallbackAllocator implements ModelAllocator {
|
||||
|
@ -7,7 +8,7 @@ public enum FallbackAllocator implements ModelAllocator {
|
|||
|
||||
@Override
|
||||
public BufferedModel alloc(Model model, Callback allocationCallback) {
|
||||
IndexedModel out = new IndexedModel(model);
|
||||
IndexedModel out = new IndexedModel(model, Formats.POS_TEX_NORMAL);
|
||||
allocationCallback.onAlloc(out);
|
||||
return out;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import com.jozufozu.flywheel.core.model.Model;
|
|||
*/
|
||||
public class IndexedModel implements BufferedModel {
|
||||
|
||||
protected final VertexType type;
|
||||
protected final Model model;
|
||||
protected final GlPrimitive primitiveMode;
|
||||
protected ElementBuffer ebo;
|
||||
|
@ -27,6 +28,11 @@ public class IndexedModel implements BufferedModel {
|
|||
protected boolean deleted;
|
||||
|
||||
public IndexedModel(Model model) {
|
||||
this(model, model.getType());
|
||||
}
|
||||
|
||||
public IndexedModel(Model model, VertexType type) {
|
||||
this.type = type;
|
||||
this.model = model;
|
||||
this.primitiveMode = GlPrimitive.TRIANGLES;
|
||||
|
||||
|
@ -38,7 +44,8 @@ public class IndexedModel implements BufferedModel {
|
|||
|
||||
// mirror it in system memory, so we can write to it, and upload our model.
|
||||
try (MappedBuffer buffer = vbo.getBuffer()) {
|
||||
model.writeInto(buffer.unwrap());
|
||||
type.createWriter(buffer.unwrap())
|
||||
.writeVertexList(model.getReader());
|
||||
} catch (Exception e) {
|
||||
Flywheel.LOGGER.error(String.format("Error uploading model '%s':", model.name()), e);
|
||||
}
|
||||
|
@ -81,7 +88,7 @@ public class IndexedModel implements BufferedModel {
|
|||
|
||||
@Override
|
||||
public VertexType getType() {
|
||||
return model.getType();
|
||||
return type;
|
||||
}
|
||||
|
||||
public int getVertexCount() {
|
||||
|
|
|
@ -6,7 +6,6 @@ import com.jozufozu.flywheel.api.vertex.VertexList;
|
|||
import com.jozufozu.flywheel.api.vertex.VertexType;
|
||||
import com.jozufozu.flywheel.backend.model.ElementBuffer;
|
||||
import com.jozufozu.flywheel.core.Formats;
|
||||
import com.jozufozu.flywheel.core.QuadConverter;
|
||||
|
||||
/**
|
||||
* A model that can be rendered by flywheel.
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package com.jozufozu.flywheel.mixin;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import net.minecraft.client.main.Main;
|
||||
|
||||
@Mixin(Main.class)
|
||||
public class ClientMainMixin {
|
||||
|
||||
@Inject(method = "main", at = @At("HEAD"))
|
||||
private static void injectRenderDoc(CallbackInfo ci) {
|
||||
// Only try to load RenderDoc if a system property is set.
|
||||
if (System.getProperty("flw.loadRenderDoc") == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
System.loadLibrary("renderdoc");
|
||||
} catch (Throwable ignored) {
|
||||
// Oh well, we tried.
|
||||
// On Windows, RenderDoc installs to "C:\Program Files\RenderDoc\"
|
||||
System.err.println("Is RenderDoc in your PATH?");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,24 +9,25 @@
|
|||
"BlockEntityTypeMixin",
|
||||
"BufferBuilderMixin",
|
||||
"CameraMixin",
|
||||
"instancemanage.ChunkRebuildHooksMixin",
|
||||
"instancemanage.ChunkRenderDispatcherAccessor",
|
||||
"ClientLevelMixin",
|
||||
"ClientMainMixin",
|
||||
"EntityTypeMixin",
|
||||
"FixFabulousDepthMixin",
|
||||
"FrustumMixin",
|
||||
"GlStateManagerMixin",
|
||||
"instancemanage.InstanceAddMixin",
|
||||
"instancemanage.InstanceRemoveMixin",
|
||||
"LevelRendererAccessor",
|
||||
"LevelRendererMixin",
|
||||
"PausedPartialTickAccessor",
|
||||
"instancemanage.RenderChunkAccessor",
|
||||
"instancemanage.RenderChunkMixin",
|
||||
"RenderTexturesMixin",
|
||||
"RenderTypeMixin",
|
||||
"atlas.AtlasDataMixin",
|
||||
"atlas.SheetDataAccessor",
|
||||
"instancemanage.ChunkRebuildHooksMixin",
|
||||
"instancemanage.ChunkRenderDispatcherAccessor",
|
||||
"instancemanage.InstanceAddMixin",
|
||||
"instancemanage.InstanceRemoveMixin",
|
||||
"instancemanage.RenderChunkAccessor",
|
||||
"instancemanage.RenderChunkMixin",
|
||||
"light.LightUpdateMixin",
|
||||
"light.NetworkLightUpdateMixin",
|
||||
"matrix.Matrix3fMixin",
|
||||
|
|
Loading…
Reference in a new issue