Nuked the Vulkan subsystem

This commit is contained in:
JeremyStar™ 2024-07-21 16:39:02 +02:00
parent bf7a450be5
commit 00a3017c1e
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
2 changed files with 6 additions and 104 deletions

View file

@ -1,45 +0,0 @@
/*
* STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2024 The StarOpenSource Engine Contributors
* 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 <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.vulkan;
import de.staropensource.sosengine.base.types.vectors.Vec2i;
import de.staropensource.sosengine.graphics.classes.ApiManagementClass;
import de.staropensource.sosengine.graphics.classes.Window;
import org.jetbrains.annotations.NotNull;
/**
* The Vulkan API management class.
*
* @since v1-alpha0
*/
@SuppressWarnings({ "unused" })
public class VulkanManagement implements ApiManagementClass {
/**
* Constructs this class.
*/
public VulkanManagement() {}
/** {@inheritDoc} */
@NotNull
@Override
public Window createWindow(String title, Vec2i size) {
return null;
}
}

View file

@ -21,6 +21,7 @@ package de.staropensource.sosengine.graphics.vulkan;
import de.staropensource.sosengine.base.annotations.EngineSubsystem;
import de.staropensource.sosengine.base.annotations.EventListener;
import de.staropensource.sosengine.base.classes.SubsystemMainClass;
import de.staropensource.sosengine.base.data.info.EngineInformation;
import de.staropensource.sosengine.base.data.versioning.StarOpenSourceVersioningSystem;
import de.staropensource.sosengine.base.logging.LoggerInstance;
@ -29,17 +30,12 @@ import de.staropensource.sosengine.base.types.DependencyVector;
import de.staropensource.sosengine.base.types.EventPriority;
import de.staropensource.sosengine.base.types.logging.LogIssuer;
import de.staropensource.sosengine.base.utility.Miscellaneous;
import de.staropensource.sosengine.graphics.GraphicsSubsystem;
import de.staropensource.sosengine.graphics.classes.ApiMainClass;
import de.staropensource.sosengine.graphics.classes.ApiManagementClass;
import de.staropensource.sosengine.graphics.vulkan.events.GraphicsErrorEvent;
import lombok.Getter;
import org.jetbrains.annotations.NotNull;
import org.lwjgl.glfw.GLFWErrorCallback;
import java.util.Locale;
import static org.lwjgl.glfw.GLFW.*;
import static org.lwjgl.glfw.GLFW.glfwSetErrorCallback;
import static org.lwjgl.glfw.GLFW.glfwTerminate;
/**
* The main object for the Vulkan Graphics API.
@ -48,7 +44,7 @@ import static org.lwjgl.glfw.GLFW.*;
*/
@SuppressWarnings({ "unused", "JavadocDeclaration", "JavadocBlankLines" })
@EngineSubsystem
public final class VulkanSubsystem implements ApiMainClass {
public final class VulkanSubsystem implements SubsystemMainClass {
/**
* Contains the class instance.
*
@ -71,18 +67,6 @@ public final class VulkanSubsystem implements ApiMainClass {
*/
private final LoggerInstance logger = new LoggerInstance(new LogIssuer(getClass(), CodePart.ENGINE));
/**
* The Graphics API management class.
*
* @see ApiManagementClass
* @since v1-alpha0
*
* -- GETTER --
* {@inheritDoc}
*/
@Getter
private ApiManagementClass management;
/**
* Constructs this subsystem.
*
@ -94,7 +78,6 @@ public final class VulkanSubsystem implements ApiMainClass {
instance = this;
else {
instance.logger.crash("The subsystem tried to initialize twice");
return;
}
}
@ -102,50 +85,14 @@ public final class VulkanSubsystem implements ApiMainClass {
@NotNull
@Override
public String getName() {
return getApiName().toLowerCase(Locale.ROOT);
return "vulkan";
}
/** {@inheritDoc} */
@Override
public void initializeSubsystem() {
// Warn about instability
logger.warn("The Vulkan Graphics API is in an unfinished state. Trying to initialize the Graphics API will cause an engine crash.");
// Register Graphics API
GraphicsSubsystem.getInstance().registerGraphicsApi(this);
}
/** {@inheritDoc} */
@Override
public void initializeApi() {
logger.verb("Initializing Graphics API");
long initTime = Miscellaneous.measureExecutionTime(() -> {
logger.crash("The Vulkan Graphics API subsystem is unfinished.");
// Set error callback
try (GLFWErrorCallback errorCallback = GLFWErrorCallback.create(new GraphicsErrorEvent())) {
errorCallback.set();
}
// Initialize GLFW
if (!glfwInit())
logger.crash("Unable to initialize GLFW");
});
logger.info("Initialized Graphics API in " + initTime + "ms");
}
/** {@inheritDoc} */
@Override
public String getApiName() {
return "Vulkan";
}
/** {@inheritDoc} */
@Override
public boolean isCompatible() {
return false;
logger.warn("The Vulkan API is currently a stub and does not provide Vulkan as a Graphics API.\nIf you want to remove this message, remove the Vulkan subsystem from your dependencies.");
}
/**