From 3450ba3fb05ce5bf4457478ef48fa006987a89d9 Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Sun, 1 Dec 2024 20:09:36 +0100 Subject: [PATCH] Add renderer and render info settings --- .../engine/rendering/RenderingSubsystem.java | 24 ++-- .../RenderingSubsystemConfiguration.java | 104 ++++++++++++------ .../rendering/callback/WindowCallback.java | 2 +- .../engine/rendering/renderer/Renderer.java | 28 ++--- .../rendering/renderer/RenderingCode.java | 15 ++- .../engine/rendering/type/Window.java | 39 ++++++- .../{RenderingAdapter.java => Adapter.java} | 4 +- .../{RenderingPlatform.java => Platform.java} | 4 +- .../rendering/type/window/Renderer.java | 97 ++++++++++++++++ 9 files changed, 247 insertions(+), 70 deletions(-) rename rendering/src/main/java/de/staropensource/engine/rendering/type/window/{RenderingAdapter.java => Adapter.java} (95%) rename rendering/src/main/java/de/staropensource/engine/rendering/type/window/{RenderingPlatform.java => Platform.java} (95%) create mode 100644 rendering/src/main/java/de/staropensource/engine/rendering/type/window/Renderer.java diff --git a/rendering/src/main/java/de/staropensource/engine/rendering/RenderingSubsystem.java b/rendering/src/main/java/de/staropensource/engine/rendering/RenderingSubsystem.java index e67f4d6ee..323ab1a25 100644 --- a/rendering/src/main/java/de/staropensource/engine/rendering/RenderingSubsystem.java +++ b/rendering/src/main/java/de/staropensource/engine/rendering/RenderingSubsystem.java @@ -25,7 +25,6 @@ import de.staropensource.engine.base.implementable.Event; import de.staropensource.engine.base.implementable.SubsystemClass; import de.staropensource.engine.base.implementable.helper.EventHelper; import de.staropensource.engine.base.logging.Logger; -import de.staropensource.engine.base.utility.misc.NumberUtil; import de.staropensource.engine.base.utility.information.EngineInformation; import de.staropensource.engine.base.implementation.versioning.StarOpenSourceVersioningSystem; import de.staropensource.engine.base.event.InternalEngineShutdownEvent; @@ -36,18 +35,13 @@ import de.staropensource.engine.rendering.event.RenderingErrorEvent; import de.staropensource.engine.rendering.exception.NotOnMainThreadException; import de.staropensource.engine.rendering.renderer.Renderer; import de.staropensource.engine.rendering.type.Window; -import de.staropensource.engine.rendering.type.window.RenderingPlatform; -import de.staropensource.engine.rendering.type.window.VsyncMode; +import de.staropensource.engine.rendering.type.window.Platform; import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.lwjgl.glfw.*; import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.concurrent.atomic.AtomicReference; import static org.lwjgl.glfw.GLFW.*; @@ -160,10 +154,10 @@ public final class RenderingSubsystem extends SubsystemClass { Logger.diag("Setting initialization hints"); switch (RenderingSubsystemConfiguration.getInstance().getInitialPlatform()) { case ANY -> glfwInitHint(GLFW_PLATFORM, GLFW_ANY_PLATFORM); - case WAYLAND -> tryPlatform(GLFW_PLATFORM_WAYLAND, RenderingPlatform.WAYLAND); - case X11 -> tryPlatform(GLFW_PLATFORM_X11, RenderingPlatform.X11); - case WIN32 -> tryPlatform(GLFW_PLATFORM_WIN32, RenderingPlatform.WIN32); - case COCOA -> tryPlatform(GLFW_PLATFORM_COCOA, RenderingPlatform.COCOA); + case WAYLAND -> tryPlatform(GLFW_PLATFORM_WAYLAND, Platform.WAYLAND); + case X11 -> tryPlatform(GLFW_PLATFORM_X11, Platform.X11); + case WIN32 -> tryPlatform(GLFW_PLATFORM_WIN32, Platform.WIN32); + case COCOA -> tryPlatform(GLFW_PLATFORM_COCOA, Platform.COCOA); case NONE -> glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_NULL); } glfwInitHint(GLFW_WAYLAND_LIBDECOR, RenderingSubsystemConfiguration.getInstance().isInitialDisableLibdecor() ? GLFW_WAYLAND_DISABLE_LIBDECOR : GLFW_WAYLAND_PREFER_LIBDECOR); @@ -220,20 +214,20 @@ public final class RenderingSubsystem extends SubsystemClass { * and if so, specifies it as the platform to use. * * @param platform platform to try - * @param renderingPlatform {@link RenderingPlatform} used to log that the platform is unsupported (set to {@code null} to disable) + * @param renderingPlatform {@link Platform} used to log that the platform is unsupported (set to {@code null} to disable) * @since v1-alpha9 */ - private void tryPlatform(int platform, @Nullable RenderingPlatform renderingPlatform) { + private void tryPlatform(int platform, @Nullable Platform renderingPlatform) { if (glfwPlatformSupported(platform)) if (platform != GLFW_PLATFORM_WAYLAND) glfwInitHint(GLFW_PLATFORM, platform); else { Logger.warn("Wayland is not supported by the StarOpenSource Engine due to various issues with it, sorry."); - tryPlatform(GLFW_PLATFORM_X11, RenderingPlatform.X11); + tryPlatform(GLFW_PLATFORM_X11, Platform.X11); } else { if (renderingPlatform != null) - Logger.warn("Platform RenderingPlatform." + renderingPlatform.name() + " is not supported GLFW. Using RenderingPlatform.ANY instead"); + Logger.warn("Platform Platform." + renderingPlatform.name() + " is not supported GLFW. Using Platform.ANY instead"); glfwInitHint(GLFW_PLATFORM, GLFW_ANY_PLATFORM); } } diff --git a/rendering/src/main/java/de/staropensource/engine/rendering/RenderingSubsystemConfiguration.java b/rendering/src/main/java/de/staropensource/engine/rendering/RenderingSubsystemConfiguration.java index 5255d5646..82bf30d31 100644 --- a/rendering/src/main/java/de/staropensource/engine/rendering/RenderingSubsystemConfiguration.java +++ b/rendering/src/main/java/de/staropensource/engine/rendering/RenderingSubsystemConfiguration.java @@ -23,8 +23,9 @@ import de.staropensource.engine.base.implementable.Configuration; import de.staropensource.engine.base.logging.Logger; import de.staropensource.engine.base.utility.PropertiesReader; import de.staropensource.engine.rendering.event.RenderingErrorEvent; -import de.staropensource.engine.rendering.type.window.RenderingAdapter; -import de.staropensource.engine.rendering.type.window.RenderingPlatform; +import de.staropensource.engine.rendering.type.window.Adapter; +import de.staropensource.engine.rendering.type.window.Platform; +import de.staropensource.engine.rendering.type.window.Renderer; import de.staropensource.engine.rendering.type.window.VsyncMode; import lombok.Getter; import org.jetbrains.annotations.NotNull; @@ -124,6 +125,20 @@ public final class RenderingSubsystemConfiguration extends Configuration { */ private boolean debugWindowStates; + /** + * Contains if rendering information + * shall be visible on every window. + * + * @since v1-alpha0 + * -- GETTER -- + * Returns if rendering information + * shall be visible on every window. + * + * @return display rendering information? + * @since v1-alpha0 + */ + private boolean debugRenderInfo; + /** * Contains if to allow updates to a window's * position. May cause errors and crashes to @@ -151,20 +166,44 @@ public final class RenderingSubsystemConfiguration extends Configuration { * @return GLFW platform * @since v1-alpha9 */ - private RenderingPlatform initialPlatform; + private Platform initialPlatform; + + /** + * Contains the adapter bgfx shall use. + * + * @since v1-alpha9 + * -- GETTER -- + * Returns the adapter bgfx shall use. + * + * @return bgfx adapter + * @since v1-alpha9 + */ + private Adapter initialAdapter; + + /** + * Contains the renderer bgfx shall use. + * + * @since v1-alpha9 + * -- GETTER -- + * Returns the renderer bgfx shall use. + * + * @return bgfx renderer + * @since v1-alpha9 + */ + private Renderer initialRenderer; /** * Contains whether or not to disable support for * libdecor. *

- * Only affects the {@link RenderingPlatform#WAYLAND} platform. + * Only affects the {@link Platform#WAYLAND} platform. * * @since v1-alpha9 * -- GETTER -- * Returns whether or not to disable support for * libdecor. *

- * Only affects the {@link RenderingPlatform#WAYLAND} platform. + * Only affects the {@link Platform#WAYLAND} platform. * * @return libdecor support disabled? * @since v1-alpha9 @@ -197,18 +236,6 @@ public final class RenderingSubsystemConfiguration extends Configuration { private boolean errorRenderingFailures; - /** - * Contains the adapter bgfx shall use. - * - * @since v1-alpha9 - * -- GETTER -- - * Returns the adapter bgfx shall use. - * - * @return bgfx adapter - * @since v1-alpha9 - */ - private RenderingAdapter renderingAdapter; - /** * Contains which {@link VsyncMode} to use. *

@@ -279,26 +306,34 @@ public final class RenderingSubsystemConfiguration extends Configuration { case "debugInput" -> debugInput = parser.getBoolean(group + property); case "debugFrames" -> debugFrames = parser.getBoolean(group + property); case "debugWindowStates" -> debugWindowStates = parser.getBoolean(group + property); + case "debugRenderInfo" -> debugRenderInfo = parser.getBoolean(group + property); case "debugAllowPositionUpdates" -> debugAllowPositionUpdates = parser.getBoolean(group + property); case "initialPlatform" -> { try { - initialPlatform = RenderingPlatform.valueOf(parser.getString(group + property).toUpperCase()); + initialPlatform = Platform.valueOf(parser.getString(group + property).toUpperCase()); } catch (IllegalArgumentException ignored) { - Logger.error("Rendering platform " + parser.getString(group + property) + " is not valid"); + Logger.error("Platform '" + parser.getString(group + property) + "' is not valid"); + } + } + case "initialAdapter" -> { + try { + initialAdapter = Adapter.valueOf(parser.getString(group + property).toUpperCase()); + } catch (IllegalArgumentException exception) { + Logger.error("Adapter '" + parser.getString(group + property) + "' is not valid"); + } + } + case "initialRenderer" -> { + try { + initialRenderer = Renderer.valueOf(parser.getString(group + property).toUpperCase()); + } catch (IllegalArgumentException exception) { + Logger.error("Renderer '" + parser.getString(group + property) + "' is not valid"); } } case "initialDisableLibdecor" -> initialDisableLibdecor = parser.getBoolean(group + property); case "errorRenderingFailures" -> errorRenderingFailures = parser.getBoolean(group + property); - case "renderingAdapter" -> { - try { - renderingAdapter = RenderingAdapter.valueOf(parser.getString(group + property).toUpperCase()); - } catch (IllegalArgumentException exception) { - Logger.error("Rendering adapter " + parser.getString(group + property) + " is not valid"); - } - } case "vsyncMode" -> { try { vsyncMode = VsyncMode.valueOf(parser.getString(group + property).toUpperCase()); @@ -318,6 +353,7 @@ public final class RenderingSubsystemConfiguration extends Configuration { debugInput = false; debugFrames = false; debugWindowStates = false; + debugRenderInfo = false; debugAllowPositionUpdates = false; } } @@ -327,17 +363,19 @@ public final class RenderingSubsystemConfiguration extends Configuration { public void loadDefaultConfiguration() { debug = true; debugInput = false; - debugFrames = true; - debugWindowStates = true; + debugFrames = false; + debugWindowStates = false; + debugRenderInfo = true; debugAllowPositionUpdates = false; - initialPlatform = RenderingPlatform.ANY; + initialPlatform = Platform.ANY; + initialAdapter = Adapter.ANY; + initialRenderer = Renderer.ANY; initialDisableLibdecor = false; errorRenderingFailures = true; - renderingAdapter = RenderingAdapter.ANY; - vsyncMode = VsyncMode.OFF; + vsyncMode = VsyncMode.ON; maximumFramesPerSecond = 60; } @@ -349,14 +387,16 @@ public final class RenderingSubsystemConfiguration extends Configuration { case "debugInput" -> { return debugInput; } case "debugFrames" -> { return debugFrames; } case "debugWindowStates" -> { return debugWindowStates; } + case "debugRenderInfo" -> { return debugRenderInfo; } case "debugAllowPositionUpdates" -> { return debugAllowPositionUpdates; } case "initialPlatform" -> { return initialPlatform; } + case "initialAdapter" -> { return initialAdapter; } + case "initialRenderer" -> { return initialRenderer; } case "disableLibdecor" -> { return initialDisableLibdecor; } case "errorRenderingFailures" -> { return errorRenderingFailures; } - case "renderingAdapter" -> { return renderingAdapter; } case "vsyncMode" -> { return vsyncMode; } case "maximumFramesPerSecond" -> { return maximumFramesPerSecond; } default -> { return null; } diff --git a/rendering/src/main/java/de/staropensource/engine/rendering/callback/WindowCallback.java b/rendering/src/main/java/de/staropensource/engine/rendering/callback/WindowCallback.java index 13f15787e..f7634bc2a 100644 --- a/rendering/src/main/java/de/staropensource/engine/rendering/callback/WindowCallback.java +++ b/rendering/src/main/java/de/staropensource/engine/rendering/callback/WindowCallback.java @@ -31,7 +31,7 @@ import org.jetbrains.annotations.NotNull; */ @Getter @SuppressWarnings({ "JavadocDeclaration" }) -public class WindowCallback { +public abstract class WindowCallback { /** * Refers to the {@link Window} instance * this callback is tied to. diff --git a/rendering/src/main/java/de/staropensource/engine/rendering/renderer/Renderer.java b/rendering/src/main/java/de/staropensource/engine/rendering/renderer/Renderer.java index 10e869b91..fa2f5e566 100644 --- a/rendering/src/main/java/de/staropensource/engine/rendering/renderer/Renderer.java +++ b/rendering/src/main/java/de/staropensource/engine/rendering/renderer/Renderer.java @@ -28,6 +28,7 @@ import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; import org.jetbrains.annotations.NotNull; +import org.lwjgl.bgfx.BGFXInit; import java.time.LocalTime; import java.util.*; @@ -252,22 +253,20 @@ public final class Renderer { /** {@inheritDoc} */ @Override public void run() { - int offset = 7; + if (RenderingSubsystemConfiguration.getInstance().isDebugRenderInfo()) { + bgfx_dbg_text_printf(0, 0, 0x0f, "Time: " + NumberUtil.padNumbers(LocalTime.now().getHour(), 2) + ":" + NumberUtil.padNumbers(LocalTime.now().getMinute(), 2) + ":" + NumberUtil.padNumbers(LocalTime.now().getSecond(), 2)); + bgfx_dbg_text_printf(0, 1, 0x0f, "Frames: " + Renderer.getFrameCount()); + bgfx_dbg_text_printf(0, 2, 0x0f, "Frames/s: " + Renderer.getFramesPerSecond()); + bgfx_dbg_text_printf(0, 3, 0x0f, "Delta: " + Renderer.getDeltaTime() + "s"); + bgfx_dbg_text_printf(0, 4, 0x0f, "V-Sync mode: " + RenderingSubsystemConfiguration.getInstance().getVsyncMode().name()); + bgfx_dbg_text_printf(0, 6, 0x0f, "Rendering time:"); - bgfx_dbg_text_clear(0, false); - bgfx_dbg_text_printf(0, 0, 0x0f, "Time: " + NumberUtil.padNumbers(LocalTime.now().getHour(), 2) + ":" + NumberUtil.padNumbers(LocalTime.now().getMinute(), 2) + ":" + NumberUtil.padNumbers(LocalTime.now().getSecond(), 2)); - bgfx_dbg_text_printf(0, 1, 0x0f, "Frames: " + Renderer.getFrameCount()); - bgfx_dbg_text_printf(0, 2, 0x0f, "Frames/s: " + Renderer.getFramesPerSecond()); - bgfx_dbg_text_printf(0, 3, 0x0f, "Delta: " + Renderer.getDeltaTime() + "s"); - bgfx_dbg_text_printf(0, 4, 0x0f, "V-Sync mode: " + RenderingSubsystemConfiguration.getInstance().getVsyncMode().name()); - bgfx_dbg_text_printf(0, 6, 0x0f, "Rendering time:"); - for (String item : lastFrameTime.keySet()) { - bgfx_dbg_text_printf(0, offset, 0x0f, item + ": " + lastFrameTime.get(item) + "ms"); - offset += 1; + int offset = 7; + for (String item : lastFrameTime.keySet()) { + bgfx_dbg_text_printf(0, offset, 0x0f, item + ": " + lastFrameTime.get(item) + "ms"); + offset += 1; + } } - try { - Thread.sleep(0); - } catch (InterruptedException ignored) {} } }); @@ -344,6 +343,7 @@ public final class Renderer { @SuppressWarnings({ "InfiniteLoopStatement" }) private static void render() { while (true) { + RenderingCode.resetFrame(); RenderingCode.invokeFrameHandlers(); RenderingCode.renderWindows(); RenderingCode.waitForNextFrame(); diff --git a/rendering/src/main/java/de/staropensource/engine/rendering/renderer/RenderingCode.java b/rendering/src/main/java/de/staropensource/engine/rendering/renderer/RenderingCode.java index a4f5b9d54..cbc4a470d 100644 --- a/rendering/src/main/java/de/staropensource/engine/rendering/renderer/RenderingCode.java +++ b/rendering/src/main/java/de/staropensource/engine/rendering/renderer/RenderingCode.java @@ -103,6 +103,15 @@ final class RenderingCode { private static long timesPSO = System.currentTimeMillis() + 1000; + /** + * Resets all frame data. + * + * @since v1-alpha9 + */ + public static void resetFrame() { + bgfx_dbg_text_clear(0, false); + } + /** * Invokes all frame handlers. * @@ -145,11 +154,15 @@ final class RenderingCode { */ private static void resetBackBuffer() { int resetSettings = 0; + if (RenderingSubsystemConfiguration.getInstance().getVsyncMode() == VsyncMode.ON) resetSettings |= BGFX_RESET_TRANSPARENT_BACKBUFFER; + for (Window window : Window.getWindows()) - if (window.isTransparent()) + if (window.isTransparent()) { resetSettings |= BGFX_RESET_TRANSPARENT_BACKBUFFER; + break; + } bgfx_reset( Window.getWindows().getFirst().getSize().getX(), diff --git a/rendering/src/main/java/de/staropensource/engine/rendering/type/Window.java b/rendering/src/main/java/de/staropensource/engine/rendering/type/Window.java index 22cb45d99..cc83acf94 100644 --- a/rendering/src/main/java/de/staropensource/engine/rendering/type/Window.java +++ b/rendering/src/main/java/de/staropensource/engine/rendering/type/Window.java @@ -43,6 +43,7 @@ import org.lwjgl.system.MemoryStack; import java.io.Closeable; import java.nio.ByteBuffer; +import java.nio.DoubleBuffer; import java.nio.IntBuffer; import java.nio.file.Path; import java.util.*; @@ -453,8 +454,7 @@ public final class Window implements Closeable { updateState(); // Initialize bgfx - if (glfwGetPlatform() != GLFW_PLATFORM_NULL) - initializeBgfx(); + initializeBgfx(); // Declare window as ready windows.add(this); @@ -536,9 +536,26 @@ public final class Window implements Closeable { BGFXInit init = BGFXInit.calloc(stack); bgfx_init_ctor(init); + // Set renderer + if (glfwGetPlatform() == GLFW_PLATFORM_NULL) + init.type(BGFX_RENDERER_TYPE_NOOP); + else + switch (RenderingSubsystemConfiguration.getInstance().getInitialRenderer()) { + case ANY -> {} + case AGC -> init.type(BGFX_RENDERER_TYPE_AGC); + case DIRECT3D_11 -> init.type(BGFX_RENDERER_TYPE_DIRECT3D11); + case DIRECT3D_12 -> init.type(BGFX_RENDERER_TYPE_DIRECT3D12); + case GNM -> init.type(BGFX_RENDERER_TYPE_GNM); + case METAL -> init.type(BGFX_RENDERER_TYPE_METAL); + case NVM -> init.type(BGFX_RENDERER_TYPE_NVN); + case OPENGL -> init.type(BGFX_RENDERER_TYPE_OPENGL); + case OPENGL_ES -> init.type(BGFX_RENDERER_TYPE_OPENGLES); + case VULKAN -> init.type(BGFX_RENDERER_TYPE_VULKAN); + } + // Set adapter Logger.diag("Setting adapter"); - init.vendorId(switch (RenderingSubsystemConfiguration.getInstance().getRenderingAdapter()) { + init.vendorId(switch (RenderingSubsystemConfiguration.getInstance().getInitialAdapter()) { case ANY -> BGFX_PCI_ID_NONE; case SOFTWARE -> BGFX_PCI_ID_SOFTWARE_RASTERIZER; case AMD -> BGFX_PCI_ID_AMD; @@ -812,6 +829,22 @@ public final class Window implements Closeable { return glfwWindowShouldClose(internalWindowIdentifier); } + /** + * Returns the position of the cursor. + * + * @return cursor position inside the window + * @since v1-alpha9 + */ + public @NotNull Vec2i getCursorPosition() { + try (MemoryStack stack = stackPush()) { + DoubleBuffer x = stack.mallocDouble(1); + DoubleBuffer y = stack.mallocDouble(1); + + glfwGetCursorPos(internalWindowIdentifier, x, y); + return new Vec2i((int) x.get(), (int) y.get()); + } + } + /** * Sets the name of this window. *

diff --git a/rendering/src/main/java/de/staropensource/engine/rendering/type/window/RenderingAdapter.java b/rendering/src/main/java/de/staropensource/engine/rendering/type/window/Adapter.java similarity index 95% rename from rendering/src/main/java/de/staropensource/engine/rendering/type/window/RenderingAdapter.java rename to rendering/src/main/java/de/staropensource/engine/rendering/type/window/Adapter.java index 00ae02a2d..0b90d4bed 100644 --- a/rendering/src/main/java/de/staropensource/engine/rendering/type/window/RenderingAdapter.java +++ b/rendering/src/main/java/de/staropensource/engine/rendering/type/window/Adapter.java @@ -20,11 +20,11 @@ package de.staropensource.engine.rendering.type.window; /** - * Represents all available rendering adapters. + * Represents all available adapters. * * @since v1-alpha9 */ -public enum RenderingAdapter { +public enum Adapter { /** * Allows the bgfx to autodetect the adapter to use. * diff --git a/rendering/src/main/java/de/staropensource/engine/rendering/type/window/RenderingPlatform.java b/rendering/src/main/java/de/staropensource/engine/rendering/type/window/Platform.java similarity index 95% rename from rendering/src/main/java/de/staropensource/engine/rendering/type/window/RenderingPlatform.java rename to rendering/src/main/java/de/staropensource/engine/rendering/type/window/Platform.java index 15bada01c..fb89b899e 100644 --- a/rendering/src/main/java/de/staropensource/engine/rendering/type/window/RenderingPlatform.java +++ b/rendering/src/main/java/de/staropensource/engine/rendering/type/window/Platform.java @@ -20,11 +20,11 @@ package de.staropensource.engine.rendering.type.window; /** - * Represents all available rendering platforms. + * Represents all available platforms. * * @since v1-alpha9 */ -public enum RenderingPlatform { +public enum Platform { /** * Allows GLFW to autodetect the platform to use. * diff --git a/rendering/src/main/java/de/staropensource/engine/rendering/type/window/Renderer.java b/rendering/src/main/java/de/staropensource/engine/rendering/type/window/Renderer.java new file mode 100644 index 000000000..2bffc3572 --- /dev/null +++ b/rendering/src/main/java/de/staropensource/engine/rendering/type/window/Renderer.java @@ -0,0 +1,97 @@ +/* + * STAROPENSOURCE ENGINE SOURCE FILE + * Copyright (c) 2024 The StarOpenSource Engine Authors + * Licensed under the GNU Affero General Public License v3 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.staropensource.engine.rendering.type.window; + +/** + * Represents all available renderers. + * + * @since v1-alpha9 + */ +public enum Renderer { + /** + * Allows the bgfx to autodetect the renderer to use. + * + * @since v1-alpha9 + */ + ANY, + + /** + * Tells bgfx to use AGC for rendering. + * + * @since v1-alpha9 + */ + AGC, + + /** + * Tells bgfx to use Direct 3D 11 for rendering. + * + * @since v1-alpha9 + */ + DIRECT3D_11, + + /** + * Tells bgfx to use Direct 3D 12 for rendering. + * + * @since v1-alpha9 + */ + DIRECT3D_12, + + /** + * Tells bgfx to use GNM for rendering. + * + * @since v1-alpha9 + */ + GNM, + + /** + * Tells bgfx to use Metal for rendering. + * + * @since v1-alpha9 + */ + METAL, + + /** + * Tells bgfx to use NVM for rendering. + * + * @since v1-alpha9 + */ + NVM, + + /** + * Tells bgfx to use OpenGL for rendering. + * + * @since v1-alpha9 + */ + OPENGL, + + /** + * Tells bgfx to use OpenGL ES for rendering. + * + * @since v1-alpha9 + */ + OPENGL_ES, + + /** + * Tells bgfx to use Vulkan for rendering. + * + * @since v1-alpha9 + */ + VULKAN, +}