Skip to content

Commit

Permalink
Remove Swapchain Images option
Browse files Browse the repository at this point in the history
  • Loading branch information
thr3343 committed Nov 5, 2023
1 parent 937f2f4 commit 6aef636
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 35 deletions.
1 change: 0 additions & 1 deletion src/main/java/net/vulkanmod/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
public class Config {

public int frameQueueSize = 2;
public int minImageCount = 3;
public VideoResolution resolution = VideoResolution.getFirstAvailable();
public boolean windowedFullscreen = false;
public boolean guiOptimizations = false;
Expand Down
32 changes: 1 addition & 31 deletions src/main/java/net/vulkanmod/config/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,6 @@ public class Options {
static Window window = Minecraft.getInstance().getWindow();
public static boolean fullscreenDirty = false;

private static final int minImages;

private static final int maxImages;


static
{
try(MemoryStack stack = MemoryStack.stackPush())
{
Device.SurfaceProperties surfaceProperties = Device.querySurfaceProperties(device.getPhysicalDevice(), stack);
minImages = surfaceProperties.capabilities.minImageCount();
int maxImageCount = surfaceProperties.capabilities.maxImageCount();

boolean hasInfiniteSwapChain = maxImageCount == 0; //Applicable if Mesa/RADV Driver are present
maxImages = hasInfiniteSwapChain ? 64 : maxImageCount;
}
}


public static Option<?>[] getVideoOpts() {
Expand Down Expand Up @@ -193,20 +176,7 @@ public static Option<?>[] getOtherOpts() {
config.frameQueueSize = value;
Renderer.scheduleSwapChainUpdate();
}, () -> config.frameQueueSize)
.setTooltip(Component.nullToEmpty("""
Manages the tradeoff between FPS and input lag
Most GPUs only require 2 for max performance
and usually don't have any performance benefits with 3 or higher""")),
new RangeOption("SwapChain Images", minImages,
maxImages, 1,
value -> {
config.minImageCount = value;
Renderer.scheduleSwapChainUpdate();
}, () -> config.minImageCount)
.setTooltip(Component.nullToEmpty("""
Sets the number of Swapchain images
Optimised automatically for best performance
This can be reduced to minimise input lag but at the cost of decreased FPS""")),
.setTooltip(Component.nullToEmpty("")),
new SwitchOption("Gui Optimizations",
value -> config.guiOptimizations = value,
() -> config.guiOptimizations)
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/net/vulkanmod/vulkan/framebuffer/SwapChain.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

public class SwapChain extends Framebuffer {
private static int DEFAULT_DEPTH_FORMAT = 0;
private static final int DEFAULT_IMAGE_COUNT = 3;

public static int getDefaultDepthFormat() {
return DEFAULT_DEPTH_FORMAT;
Expand Down Expand Up @@ -101,10 +102,8 @@ public void createSwapChain() {
return;
}
//minImageCount depends on driver: Mesa/RADV needs a min of 4, but most other drivers are at least 2 or 3
if(Initializer.CONFIG.minImageCount < surfaceProperties.capabilities.minImageCount())
Initializer.CONFIG.minImageCount = surfaceProperties.capabilities.minImageCount();

int requestedFrames = Initializer.CONFIG.minImageCount;
int requestedFrames = Math.max(DEFAULT_IMAGE_COUNT, surfaceProperties.capabilities.minImageCount());

IntBuffer imageCount = stack.ints(requestedFrames);
// IntBuffer imageCount = stack.ints(Math.max(surfaceProperties.capabilities.minImageCount(), preferredImageCount));
Expand Down

0 comments on commit 6aef636

Please sign in to comment.