Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
501baa3
Re-implement 16-byte Vertex Format + use 4 Byte alignment
thr3343 Aug 16, 2024
2545ce3
Optimize format based on device architecture
thr3343 Sep 2, 2024
6eeb144
Adjust macro name
thr3343 Sep 2, 2024
1ee2e01
Merge branch '1.21' into VF16
thr3343 Oct 5, 2024
e76ded5
Implement CPU backface culling
xCollateral Oct 4, 2024
845e86b
Use VertexBuffer usage to determine memory type
xCollateral Sep 20, 2024
41c3d58
Improve clouds rendering
xCollateral Sep 20, 2024
5921d83
Use sorted index buffer on immediate rendering if needed
xCollateral Oct 11, 2024
863eaeb
Refactor skip allocation mixin to prevent null pointer exception
xCollateral Oct 12, 2024
5774bf3
Implement Fabric Rendering API
xCollateral Oct 12, 2024
5c11064
Update default config
xCollateral Oct 12, 2024
de23916
Add RenderAttachedBlockView interface implementation
xCollateral Oct 12, 2024
a290169
Implement IndexBuffer resize
xCollateral Oct 13, 2024
ef9388e
Add missing FAPI module
xCollateral Oct 13, 2024
a7ffe3d
Add backface culling setting's translatable components
xCollateral Oct 13, 2024
0ef9f9a
Use normal to calculate quad facing
xCollateral Oct 13, 2024
ca9cf7b
Add missing normal vector copy
xCollateral Oct 13, 2024
4ec5d6a
Improve glsl conversion
xCollateral Oct 21, 2024
eedfa54
Improve compatibility
xCollateral Oct 21, 2024
5c8bbfe
Add image format info
xCollateral Oct 21, 2024
b56a22d
Use custom color resolver if requested
xCollateral Oct 21, 2024
6c4fe7d
Refactor pipeline builder and creation
xCollateral Nov 9, 2024
48dbc22
Refactor: remove unused interface
xCollateral Nov 9, 2024
51fa204
Fix profiler result missing entries
xCollateral Nov 13, 2024
aebc01d
Add clouds shader
xCollateral Nov 17, 2024
39a53cc
Refactor terrain shader's uniform name
xCollateral Nov 17, 2024
31ef3de
Minimize upload and layout transition command buffers used per frame
xCollateral Nov 17, 2024
0a9168f
Use raw memory for section draw parameters
xCollateral Nov 17, 2024
34b8e0a
Use optimal swapchain image count
xCollateral Nov 17, 2024
2302da6
Revert clouds render distance
xCollateral Nov 18, 2024
abee6c8
Add shader namespace check
xCollateral Nov 18, 2024
52dd96f
Fix out of bounds error
xCollateral Nov 18, 2024
8da1470
Fix incorrect entity shaders
xCollateral Nov 18, 2024
3ac10f3
Use fixed size staging buffer
xCollateral Nov 23, 2024
3cfe478
Fix crash when clouds mesh is empty
xCollateral Nov 24, 2024
100fde1
Bump version
xCollateral Nov 24, 2024
1bbd0ac
Use non cached memory type
xCollateral Nov 24, 2024
349de86
Use level renderer light values to improve compatibility
xCollateral Nov 25, 2024
1139f7d
Set bound framebuffer on begin rendering
xCollateral Nov 25, 2024
4c47fb6
Improve mixin compatibility
xCollateral Nov 25, 2024
868bbf1
Reset blend function before drawing
xCollateral Nov 25, 2024
3f37e93
Improve framebuffer compatibility
xCollateral Dec 10, 2024
8b41398
Fix crash on setting texture parameter
xCollateral Dec 10, 2024
20dcc21
Implement missing methods
xCollateral Dec 10, 2024
1ad99e0
Improve set viewport compatibility
xCollateral Dec 10, 2024
ac508a7
Improve shader compatibility
xCollateral Dec 10, 2024
66bd4a4
Restart render pass if terminated early
xCollateral Dec 10, 2024
ab6c7d1
Remove reloadShaders injection
xCollateral Dec 10, 2024
1c189cf
Implement data cache for biome data
xCollateral Dec 10, 2024
70d5cdc
Bump fabric versions
xCollateral Dec 10, 2024
d8f2073
Refactor window mode option
xCollateral Dec 13, 2024
6ee4b39
Refactor CircularIntList
xCollateral Dec 21, 2024
1799d82
Fix wrong sampler binding
xCollateral Dec 21, 2024
2350b4a
Update Minecraft version dependency
xCollateral Dec 21, 2024
b96e46d
Move end frame injection
xCollateral Dec 21, 2024
cd876d3
Bump version
xCollateral Dec 21, 2024
4319366
Improve gl texture compatibility
xCollateral Dec 22, 2024
211ada8
Fix image upload sync bugs
xCollateral Dec 22, 2024
16e8cda
Add method overwrite
xCollateral Dec 22, 2024
5231929
Fix: buffer size
xCollateral Dec 22, 2024
93ef2a6
Fix polygon mode mixin using face as mode (#516)
Fox2Code Jan 15, 2025
6ce2277
Update gradle and fabric-loom versions
xCollateral Jan 16, 2025
4bfd020
Update FAPI version
xCollateral Jan 16, 2025
e0cfbbf
Bump version
xCollateral Jan 16, 2025
c7cbab6
Use uint32 index buffer type if required
xCollateral Jan 18, 2025
4cb7fab
Merge branch 'dev' into VF16
thr3343 Jan 28, 2025
79bd4b4
Don't force 4 Byte aligned format on RDNA
thr3343 Jan 28, 2025
e6e0088
Fix UV conversion typo
thr3343 Jan 29, 2025
a42450b
Implement flush method
xCollateral Feb 2, 2025
0506db2
Improve quad writing performance
xCollateral Feb 2, 2025
fe177f3
Merge branch 'dev' into VF16
thr3343 Feb 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 5 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.6.11'
id 'fabric-loom' version '1.9.2'
id 'maven-publish'
}

Expand All @@ -23,7 +23,6 @@ dependencies {
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

// Needed in order to load mod namespace
ext.includeModule = { name ->
var module = fabricApi.module(name, project.fabric_version)
modImplementation(module)
Expand All @@ -32,8 +31,11 @@ dependencies {

includeModule("fabric-api-base")
includeModule("fabric-resource-loader-v0")
includeModule("fabric-rendering-fluids-v1")
includeModule("fabric-rendering-v1")
includeModule("fabric-renderer-api-v1")
includeModule("fabric-rendering-fluids-v1")
includeModule("fabric-rendering-data-attachment-v1")
includeModule("fabric-block-view-api-v2")
}

project.ext.lwjglVersion = "3.3.3"
Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21
yarn_mappings=1.21+build.1
loader_version=0.16.5
minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3
loader_version=0.16.9

# Fabric API
fabric_version=0.102.0+1.21
fabric_version=0.114.0+1.21.1

# Mod Properties
mod_version = 0.4.8_dev
mod_version = 0.5.3-dev
maven_group = net.vulkanmod
archives_base_name = VulkanMod_1.21
archives_base_name = VulkanMod_1.21.1
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
6 changes: 4 additions & 2 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/main/java/net/vulkanmod/Initializer.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package net.vulkanmod;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.renderer.v1.RendererAccess;
import net.fabricmc.loader.api.FabricLoader;
import net.vulkanmod.config.Config;
import net.vulkanmod.config.Platform;
import net.vulkanmod.config.video.VideoModeManager;
import net.vulkanmod.render.chunk.build.frapi.VulkanModRenderer;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand Down Expand Up @@ -35,6 +37,8 @@ public void onInitializeClient() {
.resolve("vulkanmod_settings.json");

CONFIG = loadConfig(configPath);

RendererAccess.INSTANCE.registerRenderer(VulkanModRenderer.INSTANCE);
}

private static Config loadConfig(Path path) {
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/net/vulkanmod/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,19 @@ public class Config {

public int frameQueueSize = 2;
public VideoModeSet.VideoMode videoMode = VideoModeManager.getFirstAvailable().getVideoMode();
public boolean windowedFullscreen = false;
public int windowMode = 0;

public int advCulling = 2;
public boolean indirectDraw = false;
public boolean indirectDraw = true;

public boolean uniqueOpaqueLayer = true;
public boolean entityCulling = true;
public int device = -1;

public int ambientOcclusion = 1;

public boolean backFaceCulling = true;

public void write() {

if(!Files.exists(CONFIG_PATH.getParent())) {
Expand Down
55 changes: 40 additions & 15 deletions src/main/java/net/vulkanmod/config/gui/GuiRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ public abstract class GuiRenderer {
public static Font font;
public static GuiGraphics guiGraphics;
public static PoseStack pose;

public static BufferBuilder bufferBuilder;
public static boolean batching = false;

private static boolean batching = false;
private static boolean drawing = false;

public static void setPoseStack(PoseStack poseStack) {
pose = poseStack;
Expand Down Expand Up @@ -61,16 +62,14 @@ public static void fill(float x0, float y0, float x1, float y1, float z, int col

RenderSystem.setShader(GameRenderer::getPositionColorShader);

if (!batching)
bufferBuilder = Tesselator.getInstance().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR);
setupBufferBuilder();

bufferBuilder.addVertex(matrix4f, x0, y0, z).setColor(r, g, b, a);
bufferBuilder.addVertex(matrix4f, x0, y1, z).setColor(r, g, b, a);
bufferBuilder.addVertex(matrix4f, x1, y1, z).setColor(r, g, b, a);
bufferBuilder.addVertex(matrix4f, x1, y0, z).setColor(r, g, b, a);

if (!batching)
BufferUploader.drawWithShader(bufferBuilder.buildOrThrow());
submitIfNeeded();
}

public static void fillGradient(float x0, float y0, float x1, float y1, int color1, int color2) {
Expand All @@ -89,18 +88,14 @@ public static void fillGradient(float x0, float y0, float x1, float y1, float z,

Matrix4f matrix4f = pose.last().pose();

RenderSystem.setShader(GameRenderer::getPositionColorShader);

if (!batching)
bufferBuilder = Tesselator.getInstance().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR);
setupBufferBuilder();

bufferBuilder.addVertex(matrix4f, x0, y0, z).setColor(r1, g1, b1, a1);
bufferBuilder.addVertex(matrix4f, x0, y1, z).setColor(r2, g2, b2, a2);
bufferBuilder.addVertex(matrix4f, x1, y1, z).setColor(r2, g2, b2, a2);
bufferBuilder.addVertex(matrix4f, x1, y0, z).setColor(r1, g1, b1, a1);

if (!batching)
BufferUploader.drawWithShader(bufferBuilder.buildOrThrow());
submitIfNeeded();
}

public static void renderBoxBorder(float x0, float y0, float width, float height, float borderWidth, int color) {
Expand Down Expand Up @@ -147,13 +142,43 @@ public static int getMaxTextWidth(Font font, List<FormattedCharSequence> list) {
return maxWidth;
}

public static void beginBatch(VertexFormat.Mode mode, VertexFormat format) {
bufferBuilder = Tesselator.getInstance().begin(mode, format);
public static void beginBatch() {
batching = true;
}

public static void endBatch() {
BufferUploader.drawWithShader(bufferBuilder.buildOrThrow());
RenderSystem.setShader(GameRenderer::getPositionColorShader);
MeshData meshData = bufferBuilder.build();

if (meshData != null) {
BufferUploader.drawWithShader(meshData);
meshData.close();
}

batching = false;
drawing = false;
}

public static void flush() {
guiGraphics.flush();

if (batching) {
endBatch();
}
}

private static void setupBufferBuilder() {
if (!batching || !drawing) {
bufferBuilder = Tesselator.getInstance().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR);
drawing = true;
}
}

private static void submitIfNeeded() {
if (!batching) {
RenderSystem.setShader(GameRenderer::getPositionColorShader);
BufferUploader.drawWithShader(bufferBuilder.buildOrThrow());
drawing = false;
}
}
}
2 changes: 2 additions & 0 deletions src/main/java/net/vulkanmod/config/gui/VOptionList.java
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ protected void renderList(int mouseX, int mouseY) {

rowTop += entry.getTotalHeight();
}

GuiRenderer.flush();
}

private Entry getEntry(int j) {
Expand Down
29 changes: 19 additions & 10 deletions src/main/java/net/vulkanmod/config/option/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import net.vulkanmod.config.gui.OptionBlock;
import net.vulkanmod.config.video.VideoModeManager;
import net.vulkanmod.config.video.VideoModeSet;
import net.vulkanmod.config.video.WindowMode;
import net.vulkanmod.render.chunk.build.light.LightMode;
import net.vulkanmod.render.vertex.TerrainRenderType;
import net.vulkanmod.vulkan.Renderer;
import net.vulkanmod.vulkan.device.DeviceManager;

Expand Down Expand Up @@ -76,19 +78,18 @@ public static OptionBlock[] getVideoOpts() {
new OptionBlock("", new Option<?>[]{
resolutionOption,
RefreshRate,
new SwitchOption(Component.translatable("options.fullscreen"),
new CyclingOption<>(Component.translatable("vulkanmod.options.windowMode"),
WindowMode.values(),
value -> {
minecraftOptions.fullscreen().set(value);
// window.toggleFullScreen();
fullscreenDirty = true;
},
() -> minecraftOptions.fullscreen().get()),
new SwitchOption(Component.translatable("vulkanmod.options.windowedFullscreen"),
value -> {
config.windowedFullscreen = value;
boolean exclusiveFullscreen = value == WindowMode.EXCLUSIVE_FULLSCREEN;
minecraftOptions.fullscreen()
.set(exclusiveFullscreen);

config.windowMode = value.mode;
fullscreenDirty = true;
},
() -> config.windowedFullscreen),
() -> WindowMode.fromValue(config.windowMode))
.setTranslator(value -> Component.translatable(WindowMode.getComponentName(value))),
new RangeOption(Component.translatable("options.framerateLimit"),
10, 260, 10,
value -> Component.nullToEmpty(value == 260 ?
Expand Down Expand Up @@ -252,10 +253,18 @@ public static OptionBlock[] getOptimizationOpts() {
new SwitchOption(Component.translatable("vulkanmod.options.uniqueOpaqueLayer"),
value -> {
config.uniqueOpaqueLayer = value;
TerrainRenderType.updateMapping();
minecraft.levelRenderer.allChanged();
},
() -> config.uniqueOpaqueLayer)
.setTooltip(Component.translatable("vulkanmod.options.uniqueOpaqueLayer.tooltip")),
new SwitchOption(Component.translatable("vulkanmod.options.backfaceCulling"),
value -> {
config.backFaceCulling = value;
Minecraft.getInstance().levelRenderer.allChanged();
},
() -> config.backFaceCulling)
.setTooltip(Component.translatable("vulkanmod.options.backfaceCulling.tooltip")),
new SwitchOption(Component.translatable("vulkanmod.options.indirectDraw"),
value -> config.indirectDraw = value,
() -> config.indirectDraw)
Expand Down
31 changes: 31 additions & 0 deletions src/main/java/net/vulkanmod/config/video/WindowMode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package net.vulkanmod.config.video;

public enum WindowMode {
WINDOWED(0),
WINDOWED_FULLSCREEN(1),
EXCLUSIVE_FULLSCREEN(2);

public final int mode;

WindowMode(int mode) {
this.mode = mode;
}

public static WindowMode fromValue(int value) {
return switch (value) {
case 0 -> WINDOWED;
case 1 -> WINDOWED_FULLSCREEN;
case 2 -> EXCLUSIVE_FULLSCREEN;

default -> throw new IllegalStateException("Unexpected value: " + value);
};
}

public static String getComponentName(WindowMode windowMode) {
return switch (windowMode) {
case WINDOWED -> "vulkanmod.options.windowMode.windowed";
case WINDOWED_FULLSCREEN -> "vulkanmod.options.windowMode.windowedFullscreen";
case EXCLUSIVE_FULLSCREEN -> "options.fullscreen";
};
}
}
Loading