Skip to content
Draft

Vulkan #2545

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
d2315be
added AlertArmatureMask
codex128 Jul 24, 2023
2f1dae8
fixed docs and added another helper
codex128 Jul 24, 2023
a750f1c
made it easier to turn off priority checking
codex128 Jul 24, 2023
cd876d4
removed copy methods
codex128 Jul 25, 2023
9c9c2d8
updated license
codex128 Jan 19, 2024
83c95e5
updated javadoc
codex128 Jan 20, 2024
90e6cd8
renamed mask
codex128 Jan 21, 2024
0f410c0
Merge branch 'jMonkeyEngine:master' into master
codex128 Feb 29, 2024
9cf7dc4
Merge branch 'jMonkeyEngine:master' into master
codex128 Jun 7, 2024
7efa4c6
Merge remote-tracking branch 'origin/master'
codex128 Apr 26, 2025
0e25de2
Merge remote-tracking branch 'origin/master'
codex128 Jun 22, 2025
0c2d187
create vulkan context and prototyped vulkan instance creation in a te…
codex128 Jun 24, 2025
061a782
vulkan logical device
codex128 Jun 24, 2025
1b9f2e3
vulkan logical device
codex128 Jun 24, 2025
863e6a9
create interface over vulkan API
codex128 Jul 3, 2025
1b2ee3d
debug initial vulkan engine interface
codex128 Jul 27, 2025
e82ab06
debug initial vulkan engine interface
codex128 Jul 27, 2025
5aa391e
add shader attributes and gpu buffers
codex128 Jul 28, 2025
adb4e01
add uniforms; fix native crash and memory leaks
codex128 Aug 1, 2025
8e7ff36
added depth testing; added enums for image properties
codex128 Aug 1, 2025
beba5fe
added depth testing; added enums for image properties
codex128 Aug 1, 2025
4e31f0d
migrated instance, device, surface, and swapchain to new builder arc…
codex128 Aug 3, 2025
5f7d1ec
migrated instance, device, surface, and swapchain to new builder arc…
codex128 Aug 3, 2025
c4738ee
successfully abstracted all vulkan components
codex128 Aug 6, 2025
e0efc40
successfully abstracted all vulkan components
codex128 Aug 6, 2025
0c035ab
organized files
codex128 Aug 9, 2025
6a3171c
added MemorySize for clarity in allocating buffer sizes
codex128 Aug 9, 2025
bcb7014
managed to create acceptable prototype material system (still much to…
codex128 Aug 13, 2025
b168553
managed to create acceptable prototype material system (still much to…
codex128 Aug 13, 2025
6c0dbaf
altered material system slightly
codex128 Aug 13, 2025
f7d3679
basic material system is working
codex128 Aug 13, 2025
62882d4
basic material system is working
codex128 Aug 13, 2025
4a1970f
add device interfaces for different queue types
codex128 Aug 14, 2025
521c8a7
move pool management to logical device
codex128 Aug 14, 2025
a00411b
add stage mask to semaphores
codex128 Aug 15, 2025
d0340ab
figure out uniform details
codex128 Aug 16, 2025
ab0de0e
add Flag interface to handle bit flags
codex128 Aug 19, 2025
6657009
fix build error
codex128 Aug 19, 2025
72b0156
fix json error
codex128 Aug 19, 2025
ed6096e
extract GpuBuffer into an interface; create VersionedBuffer in prepar…
codex128 Aug 19, 2025
5587e17
fix build errors related to GpuBuffer interface extraction
codex128 Aug 19, 2025
6f97ff5
alter material system to support versions of resources per frame-in-f…
codex128 Aug 24, 2025
d4646f6
fix build and runtime errors (new material system is operational)
codex128 Aug 24, 2025
42a845a
fix warning on DescriptorSet destruction for DescriptorPools not crea…
codex128 Aug 24, 2025
ba4ea7f
use Flag for CommandPool creation instead of booleans
codex128 Aug 24, 2025
56a0a42
prototype meshes; improve usability; abstract images and buffers in p…
codex128 Aug 30, 2025
e29d2a9
fix image loader key type
codex128 Aug 30, 2025
85b3d95
mess around with meshes more
codex128 Sep 1, 2025
669ce8f
have uniforms use Resources/DataPipelines instead of VersionedResources
codex128 Sep 1, 2025
0fc9137
have uniforms use Resources/DataPipelines instead of VersionedResources
codex128 Sep 1, 2025
ab434fd
have uniforms use Resources/DataPipelines instead of VersionedResources
codex128 Sep 2, 2025
97750fd
simplified handling of DataPipe results by uniforms
codex128 Sep 2, 2025
bb7ab46
completed AdaptiveMesh; added CommandBatch system to properly update …
codex128 Sep 9, 2025
3099a26
fix vertex shader producing an unused varying
codex128 Sep 9, 2025
4756c04
rename updateStaticBuffers to updateSharedBuffers
codex128 Sep 9, 2025
519301e
add enum to represent common attribute names
codex128 Sep 9, 2025
20a2120
improve pipeline and sampler usability
codex128 Sep 9, 2025
2f3f8c5
improve pipeline and sampler usability
codex128 Sep 9, 2025
42d7525
preparing to alter Spatial
codex128 Sep 11, 2025
cb5c47a
move vulkan to core
codex128 Sep 12, 2025
29c1818
temporarily renamed Mesh to GLMesh to not conflict with the new Mesh …
codex128 Sep 12, 2025
1718bbf
Revert "temporarily renamed Mesh to GLMesh to not conflict with the n…
codex128 Sep 12, 2025
7fee9d2
temporarily renamed Mesh to GLMesh to not conflict with the new Mesh …
codex128 Sep 12, 2025
301b6bc
Revert "temporarily renamed Mesh to GLMesh to not conflict with the n…
codex128 Sep 12, 2025
e28d4df
Revert "Revert "temporarily renamed Mesh to GLMesh to not conflict wi…
codex128 Sep 12, 2025
d463d9c
Revert "temporarily renamed Mesh to GLMesh to not conflict with the n…
codex128 Sep 12, 2025
e3ee8be
Revert "Revert "temporarily renamed Mesh to GLMesh to not conflict wi…
codex128 Sep 12, 2025
65c076e
renamed new Mesh interface to NewMesh to not conflict with existing M…
codex128 Sep 12, 2025
115a985
renamed GLMesh back to Mesh
codex128 Sep 12, 2025
268988b
add BackedStaticBuffer
codex128 Sep 12, 2025
f23c5c8
make BIHTree compatible with NewMesh
codex128 Sep 12, 2025
c388da8
made BoundingVolume accept VertexReaders for computeFromPoints
codex128 Sep 13, 2025
e871c05
Geometry accepts NewMesh without errors
codex128 Sep 13, 2025
bc4ce97
Geometry accepts NewMesh without errors
codex128 Sep 13, 2025
d2e37e5
renamed vulkan material to NewMaterial
codex128 Sep 13, 2025
ef41a34
delete VertexModifier interface
codex128 Sep 13, 2025
1c45ac6
made Spatial iterable
codex128 Sep 13, 2025
49cc7f2
made Spatial iterable
codex128 Sep 13, 2025
1e2926d
setup vulkan test for rendering from the scene graph
codex128 Sep 13, 2025
a7c2f09
moved Mesh code to OldMesh; replaced NewMesh with Mesh, which has bee…
codex128 Sep 13, 2025
bd21a20
moved previous Mesh extensions to extend OldMesh
codex128 Sep 13, 2025
050e1df
moved Material to OldMaterial
codex128 Sep 13, 2025
93067db
renamed Texture to GlTexture and Image to GlImage, both implementing …
codex128 Sep 14, 2025
fe84d1e
added methods to Material interface for compatibility with old GlMate…
codex128 Sep 16, 2025
7e1f760
fix several incompatibilities
codex128 Sep 17, 2025
d3860c6
added GeometryBatch to cleanly and optimally handling renders; a lot …
codex128 Oct 10, 2025
ab514b7
added GeometryBatch to cleanly and optimally handling renders; a lot …
codex128 Oct 10, 2025
ebf9528
split Vulkan and OpenGL APIs on GeometryBatch
codex128 Oct 11, 2025
154d3ab
fixed build errors in GlVertexBuffer
codex128 Oct 11, 2025
d8dd146
changed command paradigm again; improved material set selection proce…
codex128 Oct 15, 2025
381b05d
start using Jackson to parse yaml matdefs
codex128 Oct 17, 2025
98163af
drafted a PipelineState system that I actually like and that will act…
codex128 Oct 18, 2025
eb7a6f1
drafted a PipelineState system that I actually like and that will act…
codex128 Oct 28, 2025
38b2ef2
deleted old deprecated animation system
codex128 Oct 28, 2025
c8db583
fixed build problems caused by new API
codex128 Oct 29, 2025
a574018
fix build problems, especially relating to FrameBuffers
codex128 Nov 1, 2025
b35e045
working on yet another rewrite of the mesh system
codex128 Nov 21, 2025
7235be7
working on yet another rewrite of the mesh system
codex128 Nov 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
improve pipeline and sampler usability
  • Loading branch information
codex128 committed Sep 9, 2025
commit 2f3f8c55094de5ea6735b9d15d7d4cf241a30b2d
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,11 @@ public void simpleInitApp() {
"Shaders/VulkanVertTest.glsl", ShaderType.Vertex)));
fragModule = new ShaderModule(device, assetManager.loadAsset(ShadercLoader.key(
"Shaders/VulkanFragTest.glsl", ShaderType.Fragment)));
pipeline = new GraphicsPipeline(device, pipelineLayout, renderPass, 0, meshDesc);
pipeline = new GraphicsPipeline(device, pipelineLayout, renderPass, 0);
try (GraphicsPipeline.Builder p = pipeline.build()) {
p.addShader(vertModule, ShaderStage.Vertex, "main");
p.addShader(fragModule, ShaderStage.Fragment, "main");
p.getVertexInput().setMesh(meshDesc);
p.getRasterization().setCullMode(CullMode.None);
p.getViewportState().addViewport();
p.getViewportState().addScissor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public BaseDescriptorWriter(Descriptor type, int binding, int arrayElement, int

@Override
public void populateWrite(MemoryStack stack, VkWriteDescriptorSet write) {
write.descriptorType(type.getVkEnum()).dstBinding(binding)
write.descriptorType(type.getEnum()).dstBinding(binding)
.dstArrayElement(arrayElement)
.descriptorCount(descriptorCount);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.jme3.vulkan.descriptors;

import com.jme3.vulkan.util.IntEnum;

import static org.lwjgl.vulkan.VK10.*;

public enum Descriptor {
public enum Descriptor implements IntEnum<Descriptor> {

UniformBuffer(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER),
UniformBufferDynamic(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC),
Expand All @@ -22,7 +24,8 @@ public enum Descriptor {
this.vkEnum = vkEnum;
}

public int getVkEnum() {
@Override
public int getEnum() {
return vkEnum;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
package com.jme3.vulkan.descriptors;

import com.jme3.vulkan.util.IntEnum;
import org.lwjgl.system.MemoryStack;
import org.lwjgl.vulkan.VkDescriptorPoolSize;

import static org.lwjgl.vulkan.VK10.*;

public class PoolSize {

private final Descriptor type;
private final IntEnum<Descriptor> type;
private final int size;

public PoolSize(Descriptor type, int size) {
public PoolSize(IntEnum<Descriptor> type, int size) {
this.type = type;
this.size = size;
}

public Descriptor getType() {
public IntEnum<Descriptor> getType() {
return type;
}

Expand All @@ -26,7 +25,7 @@ public int getSize() {
public static VkDescriptorPoolSize.Buffer aggregate(MemoryStack stack, PoolSize... sizes) {
VkDescriptorPoolSize.Buffer buffer = VkDescriptorPoolSize.calloc(sizes.length, stack);
for (PoolSize poolSize : sizes) {
buffer.get().set(poolSize.type.getVkEnum(), poolSize.size);
buffer.get().set(poolSize.type.getEnum(), poolSize.size);
}
buffer.flip();
return buffer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@

import com.jme3.vulkan.shader.ShaderStage;
import com.jme3.vulkan.util.Flag;
import com.jme3.vulkan.util.IntEnum;
import org.lwjgl.vulkan.VkDescriptorSetLayoutBinding;

public class SetLayoutBinding {

private final Descriptor type;
private final IntEnum<Descriptor> type;
private final int binding, descriptors;
private final Flag<ShaderStage> stages;

public SetLayoutBinding(Descriptor type, int binding, int descriptors) {
public SetLayoutBinding(IntEnum<Descriptor> type, int binding, int descriptors) {
this(type, binding, descriptors, ShaderStage.All);
}

public SetLayoutBinding(Descriptor type, int binding, int descriptors, Flag<ShaderStage> stages) {
public SetLayoutBinding(IntEnum<Descriptor> type, int binding, int descriptors, Flag<ShaderStage> stages) {
this.type = type;
this.binding = binding;
this.descriptors = descriptors;
Expand All @@ -23,14 +24,14 @@ public SetLayoutBinding(Descriptor type, int binding, int descriptors, Flag<Shad

@SuppressWarnings("DataFlowIssue")
public void fillLayoutBinding(VkDescriptorSetLayoutBinding layoutBinding) {
layoutBinding.descriptorType(type.getVkEnum())
layoutBinding.descriptorType(type.getEnum())
.binding(binding)
.descriptorCount(descriptors)
.stageFlags(stages.bits())
.pImmutableSamplers(null);
}

public Descriptor getType() {
public IntEnum<Descriptor> getType() {
return type;
}

Expand Down
17 changes: 10 additions & 7 deletions jme3-lwjgl3/src/main/java/com/jme3/vulkan/images/Sampler.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
public class Sampler extends AbstractNative<Long> {

public static final int U = 0, V = 1, W = 2;
public static final float LOD_CLAMP_NONE = VK_LOD_CLAMP_NONE;
public static final float DISABLE_ANISOTROPY = 0f;

private final LogicalDevice<?> device;
Expand All @@ -30,7 +29,7 @@ public class Sampler extends AbstractNative<Long> {
private IntEnum<CompareOp> compare = CompareOp.Always;
private float mipLodBias = 0f;
private float minLod = 0f;
private float maxLod = LOD_CLAMP_NONE;
private float maxLod = VK_LOD_CLAMP_NONE;
private boolean unnormalizedCoords = false;

public Sampler(LogicalDevice<?> device) {
Expand Down Expand Up @@ -66,6 +65,10 @@ public float getAnisotropy() {
return anisotropy;
}

public boolean isAnisotropyEnabled() {
return anisotropy > DISABLE_ANISOTROPY;
}

public IntEnum<BorderColor> getBorderColor() {
return borderColor;
}
Expand Down Expand Up @@ -145,8 +148,8 @@ public void setMinMagFilters(IntEnum<Filter> min, IntEnum<Filter> mag) {

public void setEdgeMode(int demension, IntEnum<AddressMode> a) {
if (demension < 0 || demension >= edgeModes.length) {
throw new IndexOutOfBoundsException("Invalid edge mode demension (" + demension + "). " +
"Must be between 0 (inclusive) and " + edgeModes.length + " (exclusive).");
throw new IndexOutOfBoundsException("Invalid demension index (" + demension + "). " +
"Must be 0 (U), 1 (V), or 2 (W).");
}
edgeModes[demension] = Objects.requireNonNull(a);
}
Expand Down Expand Up @@ -187,11 +190,11 @@ public void disableAnisotropy() {
setAnisotropy(DISABLE_ANISOTROPY);
}

public void setBorderColor(BorderColor c) {
public void setBorderColor(IntEnum<BorderColor> c) {
borderColor = Objects.requireNonNull(c);
}

public void setCompare(CompareOp c) {
public void setCompare(IntEnum<CompareOp> c) {
compare = Objects.requireNonNull(c);
}

Expand All @@ -208,7 +211,7 @@ public void setMaxLod(float lod) {
}

public void disableMaxLod() {
setMaxLod(LOD_CLAMP_NONE);
setMaxLod(VK_LOD_CLAMP_NONE);
}

public void setUnnormalizedCoords(boolean u) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@
import com.jme3.vulkan.frames.VersionedResource;
import com.jme3.vulkan.shader.ShaderStage;
import com.jme3.vulkan.util.Flag;
import com.jme3.vulkan.util.IntEnum;

public abstract class AbstractUniform <T> implements Uniform<T> {

protected final String name;
protected final Descriptor type;
protected final IntEnum<Descriptor> type;
protected final int bindingIndex;
protected final Flag<ShaderStage> stages;
protected VersionedResource<? extends T> resource;

public AbstractUniform(String name, Descriptor type, int bindingIndex, Flag<ShaderStage> stages) {
public AbstractUniform(String name, IntEnum<Descriptor> type, int bindingIndex, Flag<ShaderStage> stages) {
this.name = name;
this.type = type;
this.bindingIndex = bindingIndex;
Expand Down Expand Up @@ -50,7 +51,7 @@ public VersionedResource<? extends T> getResource() {
return resource;
}

public Descriptor getType() {
public IntEnum<Descriptor> getType() {
return type;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
import com.jme3.vulkan.descriptors.SetLayoutBinding;
import com.jme3.vulkan.shader.ShaderStage;
import com.jme3.vulkan.util.Flag;
import com.jme3.vulkan.util.IntEnum;
import org.lwjgl.system.MemoryStack;
import org.lwjgl.vulkan.VkDescriptorBufferInfo;
import org.lwjgl.vulkan.VkWriteDescriptorSet;

public class BufferUniform extends AbstractUniform<GpuBuffer> {

public BufferUniform(String name, Descriptor type, int bindingIndex, Flag<ShaderStage> stages) {
public BufferUniform(String name, IntEnum<Descriptor> type, int bindingIndex, Flag<ShaderStage> stages) {
super(name, type, bindingIndex, stages);
}

Expand All @@ -26,12 +27,12 @@ public void populateWrite(MemoryStack stack, VkWriteDescriptorSet write) {
.descriptorCount(1)
.dstArrayElement(0)
.dstBinding(bindingIndex)
.descriptorType(type.getVkEnum());
.descriptorType(type.getEnum());
}

@Override
public boolean isBindingCompatible(SetLayoutBinding binding) {
return type == binding.getType()
return type.is(binding.getType())
&& bindingIndex == binding.getBinding()
&& binding.getDescriptors() == 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
import com.jme3.vulkan.images.VulkanImage;
import com.jme3.vulkan.shader.ShaderStage;
import com.jme3.vulkan.util.Flag;
import com.jme3.vulkan.util.IntEnum;
import org.lwjgl.system.MemoryStack;
import org.lwjgl.vulkan.VkDescriptorImageInfo;
import org.lwjgl.vulkan.VkWriteDescriptorSet;

public class TextureUniform extends AbstractUniform<Texture> {

private final VulkanImage.Layout layout;
private final IntEnum<VulkanImage.Layout> layout;

public TextureUniform(String name, VulkanImage.Layout layout, int bindingIndex, Flag<ShaderStage> stages) {
public TextureUniform(String name, IntEnum<VulkanImage.Layout> layout, int bindingIndex, Flag<ShaderStage> stages) {
super(name, Descriptor.CombinedImageSampler, bindingIndex, stages);
this.layout = layout;
}
Expand All @@ -27,20 +28,20 @@ public void populateWrite(MemoryStack stack, VkWriteDescriptorSet write) {
.sampler(tex.getNativeObject())
.imageLayout(layout.getEnum());
write.pImageInfo(info)
.descriptorType(type.getVkEnum())
.descriptorType(type.getEnum())
.dstBinding(bindingIndex)
.dstArrayElement(0)
.descriptorCount(1);
}

@Override
public boolean isBindingCompatible(SetLayoutBinding binding) {
return type == binding.getType()
return type.is(binding.getType())
&& bindingIndex == binding.getBinding()
&& binding.getDescriptors() == 1;
}

public VulkanImage.Layout getLayout() {
public IntEnum<VulkanImage.Layout> getLayout() {
return layout;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ public class GraphicsPipeline extends Pipeline {

private final RenderPass compat;
private final int subpassIndex;
private final MeshDescription mesh;

public GraphicsPipeline(LogicalDevice<?> device, PipelineLayout layout, RenderPass compat, int subpassIndex, MeshDescription mesh) {
public GraphicsPipeline(LogicalDevice<?> device, PipelineLayout layout, RenderPass compat, int subpassIndex) {
super(device, PipelineBindPoint.Graphics, layout);
this.compat = compat;
this.subpassIndex = subpassIndex;
this.mesh = mesh;
}

public RenderPass getCompat() {
Expand All @@ -46,7 +44,7 @@ public class Builder extends AbstractNative.Builder<GraphicsPipeline> {

private final Collection<ShaderStageInfo> stages = new ArrayList<>();
private final DynamicState dynamic = new DynamicState();
private final VertexInputState vertexInput = new VertexInputState(mesh);
private final VertexInputState vertexInput = new VertexInputState();
private final InputAssemblyState inputAssembly = new InputAssemblyState();
private final ViewportState viewport = new ViewportState();
private final DepthStencilState depthStencil = new DepthStencilState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ public class VertexInputState implements PipelineState<VkPipelineVertexInputStat

private MeshDescription mesh;

public VertexInputState(MeshDescription mesh) {
setMesh(mesh);
}

@Override
public VkPipelineVertexInputStateCreateInfo toStruct(MemoryStack stack) {
Objects.requireNonNull(mesh, "Mesh description is not defined.");
Expand Down
16 changes: 9 additions & 7 deletions jme3-lwjgl3/src/main/java/com/jme3/vulkan/surface/Swapchain.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

public class Swapchain extends AbstractNative<Long> {

public enum PresentMode {
public enum PresentMode implements IntEnum<PresentMode> {

FirstInFirstOut(KHRSurface.VK_PRESENT_MODE_FIFO_KHR),
FirstInFirstOutRelaxed(KHRSurface.VK_PRESENT_MODE_FIFO_RELAXED_KHR),
Expand All @@ -45,7 +45,8 @@ public enum PresentMode {
this.vkEnum = vkEnum;
}

public int getVkEnum() {
@Override
public int getEnum() {
return vkEnum;
}

Expand Down Expand Up @@ -251,7 +252,7 @@ public class Builder extends AbstractNative.Builder<Swapchain> {

private VkSurfaceFormatKHR selectedFormat;
private VkExtent2D selectedExtent;
private PresentMode selectedMode;
private IntEnum<PresentMode> selectedMode;
private Integer selectedImageCount;

private Swapchain base;
Expand Down Expand Up @@ -304,7 +305,7 @@ protected void build() {
.imageUsage(imageUsage.bits())
.preTransform(caps.currentTransform())
.compositeAlpha(KHRSurface.VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR)
.presentMode(selectedMode.getVkEnum())
.presentMode(selectedMode.getEnum())
.clipped(true);
if (base != null) {
create.oldSwapchain(base.getNativeObject());
Expand Down Expand Up @@ -357,10 +358,11 @@ public VkSurfaceFormatKHR selectFormat(int... preferredFormats) {
return (selectedFormat = formats.get(0));
}

public PresentMode selectMode(PresentMode... preferredModes) {
for (PresentMode m : preferredModes) {
@SafeVarargs
public final IntEnum<PresentMode> selectMode(IntEnum<PresentMode>... preferredModes) {
for (IntEnum<PresentMode> m : preferredModes) {
for (int i = 0; i < modes.limit(); i++) {
if (modes.get(i) == m.getVkEnum()) {
if (modes.get(i) == m.getEnum()) {
return (selectedMode = m);
}
}
Expand Down