mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-12-27 23:47:09 +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.debug.export', 'true'
|
||||||
property 'mixin.env.remapRefMap', 'true'
|
property 'mixin.env.remapRefMap', 'true'
|
||||||
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
|
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
|
||||||
|
property 'flw.loadRenderDoc', 'true'
|
||||||
|
|
||||||
arg '-mixin.config=flywheel.mixins.json'
|
arg '-mixin.config=flywheel.mixins.json'
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.jozufozu.flywheel.backend.model;
|
package com.jozufozu.flywheel.backend.model;
|
||||||
|
|
||||||
|
import com.jozufozu.flywheel.core.Formats;
|
||||||
import com.jozufozu.flywheel.core.model.Model;
|
import com.jozufozu.flywheel.core.model.Model;
|
||||||
|
|
||||||
public enum FallbackAllocator implements ModelAllocator {
|
public enum FallbackAllocator implements ModelAllocator {
|
||||||
|
@ -7,7 +8,7 @@ public enum FallbackAllocator implements ModelAllocator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BufferedModel alloc(Model model, Callback allocationCallback) {
|
public BufferedModel alloc(Model model, Callback allocationCallback) {
|
||||||
IndexedModel out = new IndexedModel(model);
|
IndexedModel out = new IndexedModel(model, Formats.POS_TEX_NORMAL);
|
||||||
allocationCallback.onAlloc(out);
|
allocationCallback.onAlloc(out);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import com.jozufozu.flywheel.core.model.Model;
|
||||||
*/
|
*/
|
||||||
public class IndexedModel implements BufferedModel {
|
public class IndexedModel implements BufferedModel {
|
||||||
|
|
||||||
|
protected final VertexType type;
|
||||||
protected final Model model;
|
protected final Model model;
|
||||||
protected final GlPrimitive primitiveMode;
|
protected final GlPrimitive primitiveMode;
|
||||||
protected ElementBuffer ebo;
|
protected ElementBuffer ebo;
|
||||||
|
@ -27,6 +28,11 @@ public class IndexedModel implements BufferedModel {
|
||||||
protected boolean deleted;
|
protected boolean deleted;
|
||||||
|
|
||||||
public IndexedModel(Model model) {
|
public IndexedModel(Model model) {
|
||||||
|
this(model, model.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
public IndexedModel(Model model, VertexType type) {
|
||||||
|
this.type = type;
|
||||||
this.model = model;
|
this.model = model;
|
||||||
this.primitiveMode = GlPrimitive.TRIANGLES;
|
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.
|
// mirror it in system memory, so we can write to it, and upload our model.
|
||||||
try (MappedBuffer buffer = vbo.getBuffer()) {
|
try (MappedBuffer buffer = vbo.getBuffer()) {
|
||||||
model.writeInto(buffer.unwrap());
|
type.createWriter(buffer.unwrap())
|
||||||
|
.writeVertexList(model.getReader());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Flywheel.LOGGER.error(String.format("Error uploading model '%s':", model.name()), e);
|
Flywheel.LOGGER.error(String.format("Error uploading model '%s':", model.name()), e);
|
||||||
}
|
}
|
||||||
|
@ -81,7 +88,7 @@ public class IndexedModel implements BufferedModel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VertexType getType() {
|
public VertexType getType() {
|
||||||
return model.getType();
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getVertexCount() {
|
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.api.vertex.VertexType;
|
||||||
import com.jozufozu.flywheel.backend.model.ElementBuffer;
|
import com.jozufozu.flywheel.backend.model.ElementBuffer;
|
||||||
import com.jozufozu.flywheel.core.Formats;
|
import com.jozufozu.flywheel.core.Formats;
|
||||||
import com.jozufozu.flywheel.core.QuadConverter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A model that can be rendered by flywheel.
|
* 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",
|
"BlockEntityTypeMixin",
|
||||||
"BufferBuilderMixin",
|
"BufferBuilderMixin",
|
||||||
"CameraMixin",
|
"CameraMixin",
|
||||||
"instancemanage.ChunkRebuildHooksMixin",
|
|
||||||
"instancemanage.ChunkRenderDispatcherAccessor",
|
|
||||||
"ClientLevelMixin",
|
"ClientLevelMixin",
|
||||||
|
"ClientMainMixin",
|
||||||
"EntityTypeMixin",
|
"EntityTypeMixin",
|
||||||
"FixFabulousDepthMixin",
|
"FixFabulousDepthMixin",
|
||||||
"FrustumMixin",
|
"FrustumMixin",
|
||||||
"GlStateManagerMixin",
|
"GlStateManagerMixin",
|
||||||
"instancemanage.InstanceAddMixin",
|
|
||||||
"instancemanage.InstanceRemoveMixin",
|
|
||||||
"LevelRendererAccessor",
|
"LevelRendererAccessor",
|
||||||
"LevelRendererMixin",
|
"LevelRendererMixin",
|
||||||
"PausedPartialTickAccessor",
|
"PausedPartialTickAccessor",
|
||||||
"instancemanage.RenderChunkAccessor",
|
|
||||||
"instancemanage.RenderChunkMixin",
|
|
||||||
"RenderTexturesMixin",
|
"RenderTexturesMixin",
|
||||||
"RenderTypeMixin",
|
"RenderTypeMixin",
|
||||||
"atlas.AtlasDataMixin",
|
"atlas.AtlasDataMixin",
|
||||||
"atlas.SheetDataAccessor",
|
"atlas.SheetDataAccessor",
|
||||||
|
"instancemanage.ChunkRebuildHooksMixin",
|
||||||
|
"instancemanage.ChunkRenderDispatcherAccessor",
|
||||||
|
"instancemanage.InstanceAddMixin",
|
||||||
|
"instancemanage.InstanceRemoveMixin",
|
||||||
|
"instancemanage.RenderChunkAccessor",
|
||||||
|
"instancemanage.RenderChunkMixin",
|
||||||
"light.LightUpdateMixin",
|
"light.LightUpdateMixin",
|
||||||
"light.NetworkLightUpdateMixin",
|
"light.NetworkLightUpdateMixin",
|
||||||
"matrix.Matrix3fMixin",
|
"matrix.Matrix3fMixin",
|
||||||
|
|
Loading…
Reference in a new issue