From 0774f930754a3ef253c4885cc0791f1697e96a6c Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Sun, 25 Aug 2019 12:20:58 +0200 Subject: [PATCH 01/27] Update pom.xml --- phoenicis-tools/pom.xml | 67 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/phoenicis-tools/pom.xml b/phoenicis-tools/pom.xml index 388cdff8c3f..4cd6c72c976 100644 --- a/phoenicis-tools/pom.xml +++ b/phoenicis-tools/pom.xml @@ -26,6 +26,7 @@ phoenicis-tools ${project.basedir}/../ + 3.2.2 @@ -126,5 +127,71 @@ + + org.lwjgl + lwjgl + ${lwjgl.version} + + + org.lwjgl + lwjgl-glfw + ${lwjgl.version} + + + org.lwjgl + lwjgl-opengl + ${lwjgl.version} + + + org.lwjgl + lwjgl-vulkan + ${lwjgl.version} + + + org.lwjgl + lwjgl + ${lwjgl.version} + ${lwjgl.natives} + + + org.lwjgl + lwjgl-glfw + ${lwjgl.version} + ${lwjgl.natives} + + + org.lwjgl + lwjgl-opengl + ${lwjgl.version} + ${lwjgl.natives} + + + + lwjgl-natives-linux-amd64 + + + unix + amd64 + + + + natives-linux + + + + + lwjgl-natives-macos-amd64 + + + mac + amd64 + + + + natives-macos + natives-macos + + + From 1610c5ebe4f218f17901a1a93306f22b201d31d8 Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Sun, 25 Aug 2019 12:21:38 +0200 Subject: [PATCH 02/27] Add files via upload --- .../tools/system/GraphicsProperties.java | 50 ++++++++ .../system/GraphicsPropertiesFetcher.java | 115 ++++++++++++++++++ 2 files changed, 165 insertions(+) create mode 100644 phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java create mode 100644 phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java diff --git a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java new file mode 100644 index 00000000000..fc0a56cc1cc --- /dev/null +++ b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2015-2017 PÂRIS Quentin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.phoenicis.tools.system; + +import org.phoenicis.configuration.security.Safe; + +@Safe +public class GraphicsProperties { + public GraphicsProperties() { + vendor = "Unknown"; + openGLVersion = "Unsupported"; + vulkanVersion = "Unsupported"; + } + + public String toString() { + return vendor + " " + openGLVersion + " " + vulkanVersion; + } + + public String getVendor() { + return vendor; + } + + public String getOpenGLVersion() { + return openGLVersion; + } + + public String getVulkan() { + return vulkanVersion; + } + + public String vendor; + public String openGLVersion; + public String vulkanVersion; +} diff --git a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java new file mode 100644 index 00000000000..056dfadaf15 --- /dev/null +++ b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2015-2017 PÂRIS Quentin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package org.phoenicis.tools.system; + +import org.phoenicis.configuration.security.Safe; +import org.phoenicis.tools.system.GraphicsProperties; + +import org.lwjgl.*; +import org.lwjgl.glfw.*; +import org.lwjgl.opengl.*; +import org.lwjgl.vulkan.*; + +import static org.lwjgl.glfw.Callbacks.*; +import static org.lwjgl.glfw.GLFW.*; +import static org.lwjgl.opengl.GL11.*; +import static org.lwjgl.system.MemoryUtil.*; +import static org.lwjgl.glfw.GLFWVulkan.*; + +// Code from LWJGL tutorial +@Safe +public class GraphicsPropertiesFetcher { + private long window; + + /** + * Create an invisible glfx window and context, from which info will be retrieved + */ + private void init() { + GLFWErrorCallback.createPrint(System.err).set(); + + if (!glfwInit()) + throw new IllegalStateException("Unable to initialize GLFW"); + + glfwDefaultWindowHints(); + glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); + + window = glfwCreateWindow(300, 300, "Test Window", NULL, NULL); + if (window == NULL) + throw new RuntimeException("Failed to create the GLFW window for testing graphic card capabilities"); + } + + /** + * Destroy glfw window and context + */ + private void terminate() { + glfwFreeCallbacks(window); + glfwDestroyWindow(window); + + glfwTerminate(); + glfwSetErrorCallback(null).free(); + } + + /** + * Fetch graphics card vendor and OpenGL version + */ + private void FetchVendorOpenGLVersion(GraphicsProperties graphicsProperties) { + glfwMakeContextCurrent(window); + + GL.createCapabilities(); + + graphicsProperties.vendor = glGetString(GL_VENDOR); + graphicsProperties.openGLVersion = glGetString(GL_VERSION); + graphicsProperties.openGLVersion = graphicsProperties.openGLVersion.substring(0, graphicsProperties.openGLVersion.indexOf(' ')); + + GL.destroy(); + } + + /** + * Fetch Vulkan version + */ + private void FetchVulkanVersion(GraphicsProperties graphicsProperties) { + if (!glfwVulkanSupported()) { + return; + } + + int version = VK.getInstanceVersionSupported(); + + graphicsProperties.vulkanVersion = String.valueOf(version >> 22) + "." + + String.valueOf((version >> 12) & 0x3ff) + "." + + String.valueOf(version & 0xfff); + } + + /** + * Fetch the current graphics properties (vendor, OpenGL version, Vulkan version) of the system + * + * @return The current graphics properties inside a GraphicsProperties object + */ + public GraphicsProperties GetProperties() { + GraphicsProperties graphicsProperties = new GraphicsProperties(); + + init(); + + FetchVendorOpenGLVersion(graphicsProperties); + FetchVulkanVersion(graphicsProperties); + + terminate(); + + return graphicsProperties; + } +} From 0adb3783a37ee257c00cb669073e12de66e791a6 Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Sun, 25 Aug 2019 12:22:44 +0200 Subject: [PATCH 03/27] Update ToolsConfiguration.java --- .../main/java/org/phoenicis/tools/ToolsConfiguration.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/phoenicis-tools/src/main/java/org/phoenicis/tools/ToolsConfiguration.java b/phoenicis-tools/src/main/java/org/phoenicis/tools/ToolsConfiguration.java index adc77326df7..b9bd6139e75 100644 --- a/phoenicis-tools/src/main/java/org/phoenicis/tools/ToolsConfiguration.java +++ b/phoenicis-tools/src/main/java/org/phoenicis/tools/ToolsConfiguration.java @@ -31,6 +31,7 @@ import org.phoenicis.tools.system.ArchitectureFetcher; import org.phoenicis.tools.system.OperatingSystemFetcher; import org.phoenicis.tools.system.ScreenManager; +import org.phoenicis.tools.system.GraphicsPropertiesFetcher; import org.phoenicis.tools.system.SystemConfiguration; import org.phoenicis.tools.system.opener.AutomaticOpener; import org.phoenicis.tools.system.opener.Opener; @@ -167,4 +168,9 @@ public LnkParser lnkParser() { public ScreenManager screenManager() { return new ScreenManager(); } + + @Bean + public GraphicsPropertiesFetcher graphicsPropertiesFetcher() { + return new GraphicsPropertiesFetcher(); + } } From f9095d5f61f9ac0764daa5e287d20a1791986f0a Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Sun, 25 Aug 2019 12:23:31 +0200 Subject: [PATCH 04/27] Update GraphicsProperties.java --- .../tools/system/GraphicsProperties.java | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java index fc0a56cc1cc..18f85147814 100644 --- a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java +++ b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java @@ -24,27 +24,13 @@ public class GraphicsProperties { public GraphicsProperties() { vendor = "Unknown"; + renderer = "Unknown"; openGLVersion = "Unsupported"; vulkanVersion = "Unsupported"; } - public String toString() { - return vendor + " " + openGLVersion + " " + vulkanVersion; - } - - public String getVendor() { - return vendor; - } - - public String getOpenGLVersion() { - return openGLVersion; - } - - public String getVulkan() { - return vulkanVersion; - } - public String vendor; + public String renderer; public String openGLVersion; public String vulkanVersion; } From ec9a3efd4cc388c1ec26c5e15d5fdf8e53f0becf Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Sun, 25 Aug 2019 12:24:31 +0200 Subject: [PATCH 05/27] Update GraphicsPropertiesFetcher.java --- .../phoenicis/tools/system/GraphicsPropertiesFetcher.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java index 056dfadaf15..897b3a22b21 100644 --- a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java +++ b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java @@ -68,12 +68,13 @@ private void terminate() { /** * Fetch graphics card vendor and OpenGL version */ - private void FetchVendorOpenGLVersion(GraphicsProperties graphicsProperties) { + private void FetchVendorRendererOpenGLVersion(GraphicsProperties graphicsProperties) { glfwMakeContextCurrent(window); GL.createCapabilities(); graphicsProperties.vendor = glGetString(GL_VENDOR); + raphicsProperties.renderer = glGetString(GL_RENDERER); graphicsProperties.openGLVersion = glGetString(GL_VERSION); graphicsProperties.openGLVersion = graphicsProperties.openGLVersion.substring(0, graphicsProperties.openGLVersion.indexOf(' ')); @@ -105,7 +106,7 @@ public GraphicsProperties GetProperties() { init(); - FetchVendorOpenGLVersion(graphicsProperties); + FetchVendorRendererOpenGLVersion(graphicsProperties); FetchVulkanVersion(graphicsProperties); terminate(); From 3e6eeab710d0e2273146df8de0a17fa200ff23f9 Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Sun, 25 Aug 2019 12:26:28 +0200 Subject: [PATCH 06/27] Update GraphicsPropertiesFetcher.java --- .../org/phoenicis/tools/system/GraphicsPropertiesFetcher.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java index 897b3a22b21..2212df9ebc2 100644 --- a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java +++ b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java @@ -74,7 +74,7 @@ private void FetchVendorRendererOpenGLVersion(GraphicsProperties graphicsPropert GL.createCapabilities(); graphicsProperties.vendor = glGetString(GL_VENDOR); - raphicsProperties.renderer = glGetString(GL_RENDERER); + graphicsProperties.renderer = glGetString(GL_RENDERER); graphicsProperties.openGLVersion = glGetString(GL_VERSION); graphicsProperties.openGLVersion = graphicsProperties.openGLVersion.substring(0, graphicsProperties.openGLVersion.indexOf(' ')); From a424044f1162b42d1332b7bd814e484e974a6b3e Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Sun, 25 Aug 2019 12:31:48 +0200 Subject: [PATCH 07/27] Update GraphicsPropertiesFetcher.java --- .../tools/system/GraphicsPropertiesFetcher.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java index 2212df9ebc2..1ac56d77a75 100644 --- a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java +++ b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java @@ -49,8 +49,8 @@ private void init() { glfwDefaultWindowHints(); glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); - window = glfwCreateWindow(300, 300, "Test Window", NULL, NULL); - if (window == NULL) + this.window = glfwCreateWindow(300, 300, "Test Window", NULL, NULL); + if (this.window == NULL) throw new RuntimeException("Failed to create the GLFW window for testing graphic card capabilities"); } @@ -58,8 +58,8 @@ private void init() { * Destroy glfw window and context */ private void terminate() { - glfwFreeCallbacks(window); - glfwDestroyWindow(window); + glfwFreeCallbacks(this.window); + glfwDestroyWindow(this.window); glfwTerminate(); glfwSetErrorCallback(null).free(); @@ -69,7 +69,7 @@ private void terminate() { * Fetch graphics card vendor and OpenGL version */ private void FetchVendorRendererOpenGLVersion(GraphicsProperties graphicsProperties) { - glfwMakeContextCurrent(window); + glfwMakeContextCurrent(this.window); GL.createCapabilities(); From 090bd4e868377f250ef97ef3e4c41d32a726da37 Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Sun, 25 Aug 2019 12:56:06 +0200 Subject: [PATCH 08/27] Fix OpenGL library not being loadable multiple times --- .../tools/system/GraphicsPropertiesFetcher.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java index 1ac56d77a75..1550e4014e0 100644 --- a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java +++ b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java @@ -35,7 +35,7 @@ // Code from LWJGL tutorial @Safe public class GraphicsPropertiesFetcher { - private long window; + private long window = NULL; /** * Create an invisible glfx window and context, from which info will be retrieved @@ -46,7 +46,7 @@ private void init() { if (!glfwInit()) throw new IllegalStateException("Unable to initialize GLFW"); - glfwDefaultWindowHints(); + glfwDefaultWindowHints(); glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); this.window = glfwCreateWindow(300, 300, "Test Window", NULL, NULL); @@ -63,6 +63,7 @@ private void terminate() { glfwTerminate(); glfwSetErrorCallback(null).free(); + this.window = NULL; } /** @@ -76,9 +77,8 @@ private void FetchVendorRendererOpenGLVersion(GraphicsProperties graphicsPropert graphicsProperties.vendor = glGetString(GL_VENDOR); graphicsProperties.renderer = glGetString(GL_RENDERER); graphicsProperties.openGLVersion = glGetString(GL_VERSION); - graphicsProperties.openGLVersion = graphicsProperties.openGLVersion.substring(0, graphicsProperties.openGLVersion.indexOf(' ')); - - GL.destroy(); + graphicsProperties.openGLVersion = graphicsProperties.openGLVersion.substring(0, + graphicsProperties.openGLVersion.indexOf(' ')); } /** @@ -91,9 +91,9 @@ private void FetchVulkanVersion(GraphicsProperties graphicsProperties) { int version = VK.getInstanceVersionSupported(); - graphicsProperties.vulkanVersion = String.valueOf(version >> 22) + "." + - String.valueOf((version >> 12) & 0x3ff) + "." + - String.valueOf(version & 0xfff); + graphicsProperties.vulkanVersion = String.valueOf(version >> 22) + "." + + String.valueOf((version >> 12) & 0x3ff) + "." + + String.valueOf(version & 0xfff); } /** From 1d5b0269b57b29b09628d7127cf8f615fb78b19c Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Sun, 25 Aug 2019 13:01:20 +0200 Subject: [PATCH 09/27] Update GraphicsProperties.java --- .../org/phoenicis/tools/system/GraphicsProperties.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java index 18f85147814..ec04c8cbff3 100644 --- a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java +++ b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java @@ -22,15 +22,15 @@ @Safe public class GraphicsProperties { + public String vendor; + public String renderer; + public String openGLVersion; + public String vulkanVersion; + public GraphicsProperties() { vendor = "Unknown"; renderer = "Unknown"; openGLVersion = "Unsupported"; vulkanVersion = "Unsupported"; } - - public String vendor; - public String renderer; - public String openGLVersion; - public String vulkanVersion; } From cd869f365d0880eaa92059ac604c1b69df12b453 Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Sun, 25 Aug 2019 13:02:09 +0200 Subject: [PATCH 10/27] Update GraphicsPropertiesFetcher.java --- .../tools/system/GraphicsPropertiesFetcher.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java index 1550e4014e0..bb025a9c6da 100644 --- a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java +++ b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java @@ -69,7 +69,7 @@ private void terminate() { /** * Fetch graphics card vendor and OpenGL version */ - private void FetchVendorRendererOpenGLVersion(GraphicsProperties graphicsProperties) { + private void fetchVendorRendererOpenGLVersion(GraphicsProperties graphicsProperties) { glfwMakeContextCurrent(this.window); GL.createCapabilities(); @@ -84,7 +84,7 @@ private void FetchVendorRendererOpenGLVersion(GraphicsProperties graphicsPropert /** * Fetch Vulkan version */ - private void FetchVulkanVersion(GraphicsProperties graphicsProperties) { + private void fetchVulkanVersion(GraphicsProperties graphicsProperties) { if (!glfwVulkanSupported()) { return; } @@ -101,13 +101,13 @@ private void FetchVulkanVersion(GraphicsProperties graphicsProperties) { * * @return The current graphics properties inside a GraphicsProperties object */ - public GraphicsProperties GetProperties() { + public GraphicsProperties getProperties() { GraphicsProperties graphicsProperties = new GraphicsProperties(); init(); - FetchVendorRendererOpenGLVersion(graphicsProperties); - FetchVulkanVersion(graphicsProperties); + fetchVendorRendererOpenGLVersion(graphicsProperties); + fetchVulkanVersion(graphicsProperties); terminate(); From e3bb0f818b215a9c29ae21a1b9cf7cb588a2a815 Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Sun, 25 Aug 2019 13:08:13 +0200 Subject: [PATCH 11/27] Update GraphicsProperties.java --- .../org/phoenicis/tools/system/GraphicsProperties.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java index ec04c8cbff3..a714f7a6941 100644 --- a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java +++ b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java @@ -28,9 +28,9 @@ public class GraphicsProperties { public String vulkanVersion; public GraphicsProperties() { - vendor = "Unknown"; - renderer = "Unknown"; - openGLVersion = "Unsupported"; - vulkanVersion = "Unsupported"; + this.vendor = "Unknown"; + this.renderer = "Unknown"; + this.openGLVersion = "Unsupported"; + this.vulkanVersion = "Unsupported"; } } From 121ae07c2588a0683cc9f9dfe98e6d8daab021e0 Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Sun, 25 Aug 2019 16:53:51 +0200 Subject: [PATCH 12/27] Update GraphicsProperties.java --- .../java/org/phoenicis/tools/system/GraphicsProperties.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java index a714f7a6941..0e770dfb80f 100644 --- a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java +++ b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java @@ -21,6 +21,10 @@ import org.phoenicis.configuration.security.Safe; @Safe +/** + * This class contains some information about the graphics capabilities of the GPU: + * the GPU vendor, name (renderer), the OpenGL and Vulkan version + */ public class GraphicsProperties { public String vendor; public String renderer; From 7cb22be0a388d8326c4f774cec426d068c4f9518 Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Sun, 25 Aug 2019 17:00:16 +0200 Subject: [PATCH 13/27] Update GraphicsPropertiesFetcher.java --- .../system/GraphicsPropertiesFetcher.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java index bb025a9c6da..cfa93e8df89 100644 --- a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java +++ b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java @@ -34,24 +34,28 @@ // Code from LWJGL tutorial @Safe +/** + * This class fetch the required properties to fill the class GraphicsProperties, + * using LWJGL to create a dummy window and context in order to access OpenGL and Vulkan properties. + */ public class GraphicsPropertiesFetcher { private long window = NULL; /** - * Create an invisible glfx window and context, from which info will be retrieved + * Create an invisible glfx window and context, from which infos will be retrieved */ private void init() { GLFWErrorCallback.createPrint(System.err).set(); if (!glfwInit()) - throw new IllegalStateException("Unable to initialize GLFW"); + throw new IllegalStateException(tr("Unable to initialize GLFW for testing graphic card capabilities")); glfwDefaultWindowHints(); glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); this.window = glfwCreateWindow(300, 300, "Test Window", NULL, NULL); if (this.window == NULL) - throw new RuntimeException("Failed to create the GLFW window for testing graphic card capabilities"); + throw new IllegalStateException(tr("Failed to create the GLFW window for testing graphic card capabilities")); } /** @@ -70,15 +74,15 @@ private void terminate() { * Fetch graphics card vendor and OpenGL version */ private void fetchVendorRendererOpenGLVersion(GraphicsProperties graphicsProperties) { + //Allow LWJGL to connect with the glfw OpenGL context and to use gl* function glfwMakeContextCurrent(this.window); - GL.createCapabilities(); graphicsProperties.vendor = glGetString(GL_VENDOR); graphicsProperties.renderer = glGetString(GL_RENDERER); graphicsProperties.openGLVersion = glGetString(GL_VERSION); graphicsProperties.openGLVersion = graphicsProperties.openGLVersion.substring(0, - graphicsProperties.openGLVersion.indexOf(' ')); + graphicsProperties.openGLVersion.indexOf(' ')); //We only take to version number } /** @@ -89,8 +93,10 @@ private void fetchVulkanVersion(GraphicsProperties graphicsProperties) { return; } - int version = VK.getInstanceVersionSupported(); + //Gets normally maximum Vulkan version fully supported + int version = VK.getInstanceVersionSupported(); + //Convert the uint32 into a readable String (source: vulkaninfo source code) graphicsProperties.vulkanVersion = String.valueOf(version >> 22) + "." + String.valueOf((version >> 12) & 0x3ff) + "." + String.valueOf(version & 0xfff); From 2030616f84080ef1111dd474b1fa26e80b798fd0 Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Sun, 25 Aug 2019 17:00:48 +0200 Subject: [PATCH 14/27] Update GraphicsPropertiesFetcher.java --- .../org/phoenicis/tools/system/GraphicsPropertiesFetcher.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java index cfa93e8df89..f0cc2dd0f76 100644 --- a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java +++ b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java @@ -108,7 +108,7 @@ private void fetchVulkanVersion(GraphicsProperties graphicsProperties) { * @return The current graphics properties inside a GraphicsProperties object */ public GraphicsProperties getProperties() { - GraphicsProperties graphicsProperties = new GraphicsProperties(); + final GraphicsProperties graphicsProperties = new GraphicsProperties(); init(); From 3678f8f56a83072b9e3abe28b227cc8d84bf5e5c Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Sun, 25 Aug 2019 17:07:46 +0200 Subject: [PATCH 15/27] Fix travis and tr --- .../tools/system/GraphicsProperties.java | 2 +- .../tools/system/GraphicsPropertiesFetcher.java | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java index 0e770dfb80f..8428da2e36f 100644 --- a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java +++ b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java @@ -30,7 +30,7 @@ public class GraphicsProperties { public String renderer; public String openGLVersion; public String vulkanVersion; - + public GraphicsProperties() { this.vendor = "Unknown"; this.renderer = "Unknown"; diff --git a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java index f0cc2dd0f76..59982bb28c1 100644 --- a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java +++ b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java @@ -21,6 +21,8 @@ import org.phoenicis.configuration.security.Safe; import org.phoenicis.tools.system.GraphicsProperties; +import static org.phoenicis.configuration.localisation.Localisation.tr; + import org.lwjgl.*; import org.lwjgl.glfw.*; import org.lwjgl.opengl.*; @@ -55,7 +57,8 @@ private void init() { this.window = glfwCreateWindow(300, 300, "Test Window", NULL, NULL); if (this.window == NULL) - throw new IllegalStateException(tr("Failed to create the GLFW window for testing graphic card capabilities")); + throw new IllegalStateException( + tr("Failed to create the GLFW window for testing graphic card capabilities")); } /** @@ -74,7 +77,7 @@ private void terminate() { * Fetch graphics card vendor and OpenGL version */ private void fetchVendorRendererOpenGLVersion(GraphicsProperties graphicsProperties) { - //Allow LWJGL to connect with the glfw OpenGL context and to use gl* function + // Allow LWJGL to connect with the glfw OpenGL context and to use gl* function glfwMakeContextCurrent(this.window); GL.createCapabilities(); @@ -82,7 +85,7 @@ private void fetchVendorRendererOpenGLVersion(GraphicsProperties graphicsPropert graphicsProperties.renderer = glGetString(GL_RENDERER); graphicsProperties.openGLVersion = glGetString(GL_VERSION); graphicsProperties.openGLVersion = graphicsProperties.openGLVersion.substring(0, - graphicsProperties.openGLVersion.indexOf(' ')); //We only take to version number + graphicsProperties.openGLVersion.indexOf(' ')); // We only take to version number } /** @@ -93,10 +96,10 @@ private void fetchVulkanVersion(GraphicsProperties graphicsProperties) { return; } - //Gets normally maximum Vulkan version fully supported - int version = VK.getInstanceVersionSupported(); + // Gets normally maximum Vulkan version fully supported + int version = VK.getInstanceVersionSupported(); - //Convert the uint32 into a readable String (source: vulkaninfo source code) + // Convert the uint32 into a readable String (source: vulkaninfo source code) graphicsProperties.vulkanVersion = String.valueOf(version >> 22) + "." + String.valueOf((version >> 12) & 0x3ff) + "." + String.valueOf(version & 0xfff); From 1d700031a7a923309f59808f0da901d48640c12b Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Tue, 27 Aug 2019 16:40:39 +0200 Subject: [PATCH 16/27] Also fetch core context Version --- .../tools/system/GraphicsProperties.java | 6 ++- .../system/GraphicsPropertiesFetcher.java | 45 ++++++++++++++++--- 2 files changed, 44 insertions(+), 7 deletions(-) diff --git a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java index 8428da2e36f..fc8f38f49fe 100644 --- a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java +++ b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java @@ -28,13 +28,15 @@ public class GraphicsProperties { public String vendor; public String renderer; - public String openGLVersion; + public String openglVersion; + public String openglCoreVersion; public String vulkanVersion; public GraphicsProperties() { this.vendor = "Unknown"; this.renderer = "Unknown"; - this.openGLVersion = "Unsupported"; + this.openglVersion = "Unsupported"; + this.openglCoreVersion = "Unsupported"; this.vulkanVersion = "Unsupported"; } } diff --git a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java index 59982bb28c1..23caf30e4b5 100644 --- a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java +++ b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java @@ -21,6 +21,8 @@ import org.phoenicis.configuration.security.Safe; import org.phoenicis.tools.system.GraphicsProperties; +import java.util.ArrayList; +import java.util.Arrays; import static org.phoenicis.configuration.localisation.Localisation.tr; import org.lwjgl.*; @@ -46,12 +48,45 @@ public class GraphicsPropertiesFetcher { /** * Create an invisible glfx window and context, from which infos will be retrieved */ - private void init() { + private void init(GraphicsProperties graphicsProperties) { GLFWErrorCallback.createPrint(System.err).set(); if (!glfwInit()) throw new IllegalStateException(tr("Unable to initialize GLFW for testing graphic card capabilities")); + ArrayList> openglCoreVersion = new ArrayList>(); // Versions that + // distinguish core and + // compatibility + + openglCoreVersion.add(new ArrayList(Arrays.asList(6, 5, 4, 3, 2, 1, 0))); // OpenGL 4.x + openglCoreVersion.add(new ArrayList(Arrays.asList(3, 2))); // OpenGL 3.x + + boolean found = false; + for (int i = 0; i < openglCoreVersion.size(); ++i) { + if (!found) { + for (int j = 0; i < openglCoreVersion.get(i).size(); ++j) { + glfwDefaultWindowHints(); + glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, -i + 4); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, openglCoreVersion.get(i).get(j)); + glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); + + this.window = glfwCreateWindow(300, 300, "Test Window", NULL, NULL); + + if (this.window != NULL) { + // We found a working core context + found = true; + graphicsProperties.openglCoreVersion = String.valueOf(-i + 4) + "." + + String.valueOf(openglCoreVersion.get(i).get(j)); + glfwFreeCallbacks(this.window); + glfwDestroyWindow(this.window); + this.window = NULL; + break; + } + } + } + } + glfwDefaultWindowHints(); glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); @@ -83,9 +118,9 @@ private void fetchVendorRendererOpenGLVersion(GraphicsProperties graphicsPropert graphicsProperties.vendor = glGetString(GL_VENDOR); graphicsProperties.renderer = glGetString(GL_RENDERER); - graphicsProperties.openGLVersion = glGetString(GL_VERSION); - graphicsProperties.openGLVersion = graphicsProperties.openGLVersion.substring(0, - graphicsProperties.openGLVersion.indexOf(' ')); // We only take to version number + graphicsProperties.openglVersion = glGetString(GL_VERSION); + graphicsProperties.openglVersion = graphicsProperties.openglVersion.substring(0, + graphicsProperties.openglVersion.indexOf(' ')); // We only take to version number } /** @@ -113,7 +148,7 @@ private void fetchVulkanVersion(GraphicsProperties graphicsProperties) { public GraphicsProperties getProperties() { final GraphicsProperties graphicsProperties = new GraphicsProperties(); - init(); + init(graphicsProperties); fetchVendorRendererOpenGLVersion(graphicsProperties); fetchVulkanVersion(graphicsProperties); From f40bf657bd371594ff58f2a4319aae3a98289de7 Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Tue, 27 Aug 2019 16:46:46 +0200 Subject: [PATCH 17/27] Update GraphicsPropertiesFetcher.java --- .../phoenicis/tools/system/GraphicsPropertiesFetcher.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java index 23caf30e4b5..b5436251719 100644 --- a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java +++ b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java @@ -54,6 +54,7 @@ private void init(GraphicsProperties graphicsProperties) { if (!glfwInit()) throw new IllegalStateException(tr("Unable to initialize GLFW for testing graphic card capabilities")); + //We will now fetch maximum supported OpenGL core context version (3.2 -> 4.6) ArrayList> openglCoreVersion = new ArrayList>(); // Versions that // distinguish core and // compatibility @@ -61,6 +62,7 @@ private void init(GraphicsProperties graphicsProperties) { openglCoreVersion.add(new ArrayList(Arrays.asList(6, 5, 4, 3, 2, 1, 0))); // OpenGL 4.x openglCoreVersion.add(new ArrayList(Arrays.asList(3, 2))); // OpenGL 3.x + //We run through the versions than should provide a core context boolean found = false; for (int i = 0; i < openglCoreVersion.size(); ++i) { if (!found) { @@ -83,6 +85,8 @@ private void init(GraphicsProperties graphicsProperties) { this.window = NULL; break; } + + //No core context found, the context is then 3.1 or less, see fetchVendorRendererOpenGLVersion } } } @@ -118,7 +122,8 @@ private void fetchVendorRendererOpenGLVersion(GraphicsProperties graphicsPropert graphicsProperties.vendor = glGetString(GL_VENDOR); graphicsProperties.renderer = glGetString(GL_RENDERER); - graphicsProperties.openglVersion = glGetString(GL_VERSION); + graphicsProperties.openglVersion = glGetString(GL_VERSION); //The version can be inferior to openglCoreVersion + //If the compatibiltity context is not available for large OpenGL version graphicsProperties.openglVersion = graphicsProperties.openglVersion.substring(0, graphicsProperties.openglVersion.indexOf(' ')); // We only take to version number } From 386ecc0a4c30b1fa5d7e16dbbed339f0cb250193 Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Tue, 27 Aug 2019 16:48:09 +0200 Subject: [PATCH 18/27] Codacy I saw you --- .../tools/system/GraphicsPropertiesFetcher.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java index b5436251719..0e1f4042399 100644 --- a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java +++ b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java @@ -54,7 +54,7 @@ private void init(GraphicsProperties graphicsProperties) { if (!glfwInit()) throw new IllegalStateException(tr("Unable to initialize GLFW for testing graphic card capabilities")); - //We will now fetch maximum supported OpenGL core context version (3.2 -> 4.6) + // We will now fetch maximum supported OpenGL core context version (3.2 -> 4.6) ArrayList> openglCoreVersion = new ArrayList>(); // Versions that // distinguish core and // compatibility @@ -62,7 +62,7 @@ private void init(GraphicsProperties graphicsProperties) { openglCoreVersion.add(new ArrayList(Arrays.asList(6, 5, 4, 3, 2, 1, 0))); // OpenGL 4.x openglCoreVersion.add(new ArrayList(Arrays.asList(3, 2))); // OpenGL 3.x - //We run through the versions than should provide a core context + // We run through the versions than should provide a core context boolean found = false; for (int i = 0; i < openglCoreVersion.size(); ++i) { if (!found) { @@ -85,8 +85,8 @@ private void init(GraphicsProperties graphicsProperties) { this.window = NULL; break; } - - //No core context found, the context is then 3.1 or less, see fetchVendorRendererOpenGLVersion + + // No core context found, the context is then 3.1 or less, see fetchVendorRendererOpenGLVersion } } } @@ -122,8 +122,9 @@ private void fetchVendorRendererOpenGLVersion(GraphicsProperties graphicsPropert graphicsProperties.vendor = glGetString(GL_VENDOR); graphicsProperties.renderer = glGetString(GL_RENDERER); - graphicsProperties.openglVersion = glGetString(GL_VERSION); //The version can be inferior to openglCoreVersion - //If the compatibiltity context is not available for large OpenGL version + graphicsProperties.openglVersion = glGetString(GL_VERSION); // The version can be inferior to openglCoreVersion + // If the compatibiltity context is not available + // for large OpenGL version graphicsProperties.openglVersion = graphicsProperties.openglVersion.substring(0, graphicsProperties.openglVersion.indexOf(' ')); // We only take to version number } From 13fb641a0e437ff3a1d96d6e6658ce1da7b2e0a1 Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Tue, 27 Aug 2019 17:43:20 +0200 Subject: [PATCH 19/27] Update pom.xml --- phoenicis-tools/pom.xml | 56 ++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/phoenicis-tools/pom.xml b/phoenicis-tools/pom.xml index 4cd6c72c976..b0b312402ba 100644 --- a/phoenicis-tools/pom.xml +++ b/phoenicis-tools/pom.xml @@ -28,6 +28,34 @@ ${project.basedir}/../ 3.2.2 + + + lwjgl-natives-linux-amd64 + + + unix + amd64 + + + + natives-linux + + + + + lwjgl-natives-macos-amd64 + + + mac + amd64 + + + + natives-macos + natives-macos + + + com.sun.activation @@ -166,32 +194,4 @@ ${lwjgl.natives} - - - lwjgl-natives-linux-amd64 - - - unix - amd64 - - - - natives-linux - - - - - lwjgl-natives-macos-amd64 - - - mac - amd64 - - - - natives-macos - natives-macos - - - From 986beaf25b59aee72da449fbd18697e345580bbb Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Tue, 27 Aug 2019 18:21:15 +0200 Subject: [PATCH 20/27] Update pom.xml --- phoenicis-tools/pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/phoenicis-tools/pom.xml b/phoenicis-tools/pom.xml index b0b312402ba..d497503be02 100644 --- a/phoenicis-tools/pom.xml +++ b/phoenicis-tools/pom.xml @@ -193,5 +193,11 @@ ${lwjgl.version} ${lwjgl.natives} + + org.lwjgl + lwjgl-vulkan + ${lwjgl.version} + ${lwjgl.natives.vulkan} + From 5d50f1caf2646b72c45cd2f3a6b663ad2cee9f2e Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Fri, 6 Sep 2019 13:56:07 +0200 Subject: [PATCH 21/27] Update GraphicsProperties.java --- .../tools/system/GraphicsProperties.java | 50 +++++++++++++++++-- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java index fc8f38f49fe..ed43e609086 100644 --- a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java +++ b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java @@ -26,11 +26,11 @@ * the GPU vendor, name (renderer), the OpenGL and Vulkan version */ public class GraphicsProperties { - public String vendor; - public String renderer; - public String openglVersion; - public String openglCoreVersion; - public String vulkanVersion; + private String vendor; + private String renderer; + private String openglVersion; + private String openglCoreVersion; + private String vulkanVersion; public GraphicsProperties() { this.vendor = "Unknown"; @@ -39,4 +39,44 @@ public GraphicsProperties() { this.openglCoreVersion = "Unsupported"; this.vulkanVersion = "Unsupported"; } + + public void setVendor(String vendor) { + this.vendor = vendor; + } + + public void setRenderer(String renderer) { + this.renderer = renderer; + } + + public void setOpenGLVersion(String openglVersion) { + this.openglVersion = openglVersion; + } + + public void setOpenGLCoreVersion(String openglCoreVersion) { + this.openglCoreVersion = openglCoreVersion; + } + + public void setVulkanVersion(String vulkanVersion) { + this.vulkanVersion = vulkanVersion; + } + + public String getVendor() { + return this.vendor; + } + + public String getRenderer() { + return this.renderer; + } + + public String getOpenGLVersion() { + return this.openglVersion; + } + + public String getOpenGLCoreVersion() { + return this.openglCoreVersion; + } + + public String getVulkanVersion() { + return this.vulkanVersion; + } } From 62faa23e31311b6793859b8dd9bfa5215df8896f Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Fri, 6 Sep 2019 13:58:26 +0200 Subject: [PATCH 22/27] Update GraphicsPropertiesFetcher.java --- .../system/GraphicsPropertiesFetcher.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java index 0e1f4042399..e15c883f630 100644 --- a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java +++ b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java @@ -78,8 +78,8 @@ private void init(GraphicsProperties graphicsProperties) { if (this.window != NULL) { // We found a working core context found = true; - graphicsProperties.openglCoreVersion = String.valueOf(-i + 4) + "." - + String.valueOf(openglCoreVersion.get(i).get(j)); + graphicsProperties.setOpenGLCoreVersion(String.valueOf(-i + 4) + "." + + String.valueOf(openglCoreVersion.get(i).get(j))); glfwFreeCallbacks(this.window); glfwDestroyWindow(this.window); this.window = NULL; @@ -120,13 +120,13 @@ private void fetchVendorRendererOpenGLVersion(GraphicsProperties graphicsPropert glfwMakeContextCurrent(this.window); GL.createCapabilities(); - graphicsProperties.vendor = glGetString(GL_VENDOR); - graphicsProperties.renderer = glGetString(GL_RENDERER); - graphicsProperties.openglVersion = glGetString(GL_VERSION); // The version can be inferior to openglCoreVersion + graphicsProperties.setVendor(glGetString(GL_VENDOR)); + graphicsProperties.setRenderer(glGetString(GL_RENDERER)); + graphicsProperties.setOpenGLVersion(glGetString(GL_VERSION)); // The version can be inferior to openglCoreVersion // If the compatibiltity context is not available // for large OpenGL version - graphicsProperties.openglVersion = graphicsProperties.openglVersion.substring(0, - graphicsProperties.openglVersion.indexOf(' ')); // We only take to version number + graphicsProperties.setOpenGLVersion(graphicsProperties.getOpenGLVersion().substring(0, + graphicsProperties.getOpenGLVersion().indexOf(' '))); // We only take to version number } /** @@ -141,9 +141,9 @@ private void fetchVulkanVersion(GraphicsProperties graphicsProperties) { int version = VK.getInstanceVersionSupported(); // Convert the uint32 into a readable String (source: vulkaninfo source code) - graphicsProperties.vulkanVersion = String.valueOf(version >> 22) + "." + + graphicsProperties.setVulkanVersion(String.valueOf(version >> 22) + "." + String.valueOf((version >> 12) & 0x3ff) + "." + - String.valueOf(version & 0xfff); + String.valueOf(version & 0xfff)); } /** From 0d1559c576c665230c46bf8931bdc5d56bf38194 Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Thu, 3 Oct 2019 21:42:26 +0200 Subject: [PATCH 23/27] Update GraphicsPropertiesFetcher.java --- .../tools/system/GraphicsPropertiesFetcher.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java index e15c883f630..17875a1a070 100644 --- a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java +++ b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java @@ -20,6 +20,8 @@ import org.phoenicis.configuration.security.Safe; import org.phoenicis.tools.system.GraphicsProperties; +import org.phoenicis.tools.system.ArchitectureFetcher; +import org.phoenicis.tools.system.OperatingSystemFetcher; import java.util.ArrayList; import java.util.Arrays; @@ -153,13 +155,18 @@ private void fetchVulkanVersion(GraphicsProperties graphicsProperties) { */ public GraphicsProperties getProperties() { final GraphicsProperties graphicsProperties = new GraphicsProperties(); + + Architecture arch = fetchCurrentArchitecture(); + OperatingSystem os = fetchCurrentOperationSystem() + + if (arch == Architecture.AMD64 && (os == "linux" || os == "darwin)) { + init(graphicsProperties); - init(graphicsProperties); + fetchVendorRendererOpenGLVersion(graphicsProperties); + fetchVulkanVersion(graphicsProperties); - fetchVendorRendererOpenGLVersion(graphicsProperties); - fetchVulkanVersion(graphicsProperties); - - terminate(); + terminate(); + } return graphicsProperties; } From 35e9b1ef79d160d7302d240f288df0b7769e3a75 Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Thu, 3 Oct 2019 22:13:31 +0200 Subject: [PATCH 24/27] It builds --- phoenicis-tools/pom.xml | 56 +++++++++---------- .../tools/system/GraphicsProperties.java | 20 +++---- .../system/GraphicsPropertiesFetcher.java | 22 +++++--- 3 files changed, 52 insertions(+), 46 deletions(-) diff --git a/phoenicis-tools/pom.xml b/phoenicis-tools/pom.xml index d497503be02..1edbffaaa82 100644 --- a/phoenicis-tools/pom.xml +++ b/phoenicis-tools/pom.xml @@ -28,34 +28,6 @@ ${project.basedir}/../ 3.2.2 - - - lwjgl-natives-linux-amd64 - - - unix - amd64 - - - - natives-linux - - - - - lwjgl-natives-macos-amd64 - - - mac - amd64 - - - - natives-macos - natives-macos - - - com.sun.activation @@ -200,4 +172,32 @@ ${lwjgl.natives.vulkan} + + + lwjgl-natives-linux-amd64 + + + unix + amd64 + + + + natives-linux + + + + + lwjgl-natives-macos-amd64 + + + mac + amd64 + + + + natives-macos + natives-macos + + + diff --git a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java index ed43e609086..8ba1ddd807b 100644 --- a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java +++ b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsProperties.java @@ -39,43 +39,43 @@ public GraphicsProperties() { this.openglCoreVersion = "Unsupported"; this.vulkanVersion = "Unsupported"; } - + public void setVendor(String vendor) { this.vendor = vendor; } - + public void setRenderer(String renderer) { this.renderer = renderer; } - + public void setOpenGLVersion(String openglVersion) { this.openglVersion = openglVersion; } - + public void setOpenGLCoreVersion(String openglCoreVersion) { this.openglCoreVersion = openglCoreVersion; } - + public void setVulkanVersion(String vulkanVersion) { this.vulkanVersion = vulkanVersion; } - + public String getVendor() { return this.vendor; } - + public String getRenderer() { return this.renderer; } - + public String getOpenGLVersion() { return this.openglVersion; } - + public String getOpenGLCoreVersion() { return this.openglCoreVersion; } - + public String getVulkanVersion() { return this.vulkanVersion; } diff --git a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java index 17875a1a070..9c7cd8c9d09 100644 --- a/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java +++ b/phoenicis-tools/src/main/java/org/phoenicis/tools/system/GraphicsPropertiesFetcher.java @@ -22,6 +22,8 @@ import org.phoenicis.tools.system.GraphicsProperties; import org.phoenicis.tools.system.ArchitectureFetcher; import org.phoenicis.tools.system.OperatingSystemFetcher; +import org.phoenicis.entities.Architecture; +import org.phoenicis.entities.OperatingSystem; import java.util.ArrayList; import java.util.Arrays; @@ -124,9 +126,10 @@ private void fetchVendorRendererOpenGLVersion(GraphicsProperties graphicsPropert graphicsProperties.setVendor(glGetString(GL_VENDOR)); graphicsProperties.setRenderer(glGetString(GL_RENDERER)); - graphicsProperties.setOpenGLVersion(glGetString(GL_VERSION)); // The version can be inferior to openglCoreVersion - // If the compatibiltity context is not available - // for large OpenGL version + graphicsProperties.setOpenGLVersion(glGetString(GL_VERSION)); // The version can be inferior to + // openglCoreVersion + // If the compatibiltity context is not available + // for large OpenGL version graphicsProperties.setOpenGLVersion(graphicsProperties.getOpenGLVersion().substring(0, graphicsProperties.getOpenGLVersion().indexOf(' '))); // We only take to version number } @@ -155,11 +158,14 @@ private void fetchVulkanVersion(GraphicsProperties graphicsProperties) { */ public GraphicsProperties getProperties() { final GraphicsProperties graphicsProperties = new GraphicsProperties(); - - Architecture arch = fetchCurrentArchitecture(); - OperatingSystem os = fetchCurrentOperationSystem() - - if (arch == Architecture.AMD64 && (os == "linux" || os == "darwin)) { + + final OperatingSystemFetcher operatingSystemFetcher = new OperatingSystemFetcher(); + OperatingSystem os = operatingSystemFetcher.fetchCurrentOperationSystem(); + + final ArchitectureFetcher architectureFetcher = new ArchitectureFetcher(operatingSystemFetcher); + Architecture arch = architectureFetcher.fetchCurrentArchitecture(); + + if (arch == Architecture.AMD64 && (os == OperatingSystem.LINUX || os == OperatingSystem.MACOSX)) { init(graphicsProperties); fetchVendorRendererOpenGLVersion(graphicsProperties); From 8ebc6cab058a267ae1040d307d6473c08c0308bf Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Sat, 5 Oct 2019 10:52:49 +0200 Subject: [PATCH 25/27] Update pom.xml --- phoenicis-tools/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phoenicis-tools/pom.xml b/phoenicis-tools/pom.xml index 1edbffaaa82..9fa72647d84 100644 --- a/phoenicis-tools/pom.xml +++ b/phoenicis-tools/pom.xml @@ -26,7 +26,7 @@ phoenicis-tools ${project.basedir}/../ - 3.2.2 + 3.2.3 From a50e01305d7096664ec4d43bfcc7fc507ccb986e Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Sat, 5 Oct 2019 11:02:48 +0200 Subject: [PATCH 26/27] Update pom.xml --- phoenicis-tools/pom.xml | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/phoenicis-tools/pom.xml b/phoenicis-tools/pom.xml index 9fa72647d84..e97c26326e2 100644 --- a/phoenicis-tools/pom.xml +++ b/phoenicis-tools/pom.xml @@ -130,48 +130,46 @@ org.lwjgl lwjgl - ${lwjgl.version} org.lwjgl lwjgl-glfw - ${lwjgl.version} - + org.lwjgl lwjgl-opengl - ${lwjgl.version} org.lwjgl lwjgl-vulkan - ${lwjgl.version} org.lwjgl lwjgl - ${lwjgl.version} ${lwjgl.natives} org.lwjgl lwjgl-glfw - ${lwjgl.version} ${lwjgl.natives} org.lwjgl lwjgl-opengl - ${lwjgl.version} ${lwjgl.natives} - - org.lwjgl - lwjgl-vulkan - ${lwjgl.version} - ${lwjgl.natives.vulkan} - + + + + org.lwjgl + lwjgl-bom + ${lwjgl.version} + import + pom + + + lwjgl-natives-linux-amd64 @@ -183,7 +181,6 @@ natives-linux - @@ -196,8 +193,14 @@ natives-macos - natives-macos + + + org.lwjgl + lwjgl-vulkan + natives-macos + + From 36b1b4fafc37c2403ad935158ca70a2ef15cf429 Mon Sep 17 00:00:00 2001 From: ImperatorS79 Date: Fri, 10 Jan 2020 20:16:17 +0100 Subject: [PATCH 27/27] Test --- phoenicis-tools/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phoenicis-tools/pom.xml b/phoenicis-tools/pom.xml index e97c26326e2..cd278fca567 100644 --- a/phoenicis-tools/pom.xml +++ b/phoenicis-tools/pom.xml @@ -188,7 +188,7 @@ mac - amd64 + x86_64