diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 60745c2c..8db075f9 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -37,8 +37,10 @@ jobs: run: chmod +x gradlew - name: Setup Gradle uses: gradle/actions/setup-gradle@v3 - - name: Execute Gradle build - run: ./gradlew build + - name: Build core module + run: ./gradlew :core:build + - name: Build other modules + run: ./gradlew build --parallel # - name: Upload build reports # uses: actions/upload-artifact@v4 # with: diff --git a/build.gradle.kts b/build.gradle.kts index 96371791..e8184839 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -118,7 +118,6 @@ artifactNameMap.forEach { (subprojectName, artifactName) -> allprojects { tasks.withType { options { - verbose() if (this is CoreJavadocOptions) { if (jdkEnablePreview.toBoolean()) { addBooleanOption("-enable-preview", true) diff --git a/generators/vulkan/src/main/kotlin/overrungl/vulkan/VulkanGenerator.kt b/generators/vulkan/src/main/kotlin/overrungl/vulkan/VulkanGenerator.kt index d8361ea1..149eac69 100644 --- a/generators/vulkan/src/main/kotlin/overrungl/vulkan/VulkanGenerator.kt +++ b/generators/vulkan/src/main/kotlin/overrungl/vulkan/VulkanGenerator.kt @@ -30,7 +30,11 @@ import kotlin.io.path.Path val UPPERCASE = Regex("([A-Z])") fun indent(indent: Int) = " ".repeat(indent) -fun removeConstPrefix(string: String) = string.removePrefix("VK_") +fun String.removeConstPrefix(): String { + val s = this.removePrefix("VK_") + return if (!s.first().isJavaIdentifierStart()) "_$s" else s +} + fun formatNumber(string: String) = string .removeSurrounding("(", ")") .removeSuffix("LL") @@ -161,13 +165,13 @@ class VKFile( * @since 0.1.0 */ fun main() { - val VK10 = VKFile( - "VK10", document = """ + val Vk10 = VKFile( + "Vk10", document = """ The Vulkan binding. @since 0.1.0 """.trimIndent() ) - VK10.superclasses.add("overrun.marshal.DirectAccess") + Vk10.superclasses.add("overrun.marshal.DirectAccess") val builder = DocumentBuilderFactory.newInstance().newDocumentBuilder() ClassLoader.getSystemResourceAsStream("vk.xml")!!.use { stream -> @@ -183,8 +187,11 @@ fun main() { } } + fun endsWithVendor(string: String) = + vendors.firstOrNull(string::endsWith) + fun removeVendorSuffix(string: String) = - vendors.firstOrNull { string.endsWith(it) } + endsWithVendor(string) ?.let { string.removeSuffix(it) } ?: string @@ -196,8 +203,8 @@ fun main() { enumsNode.childNodes.forEach { node -> if (node.nodeName == "enum") { val attrib = node.attributes - val name = removeConstPrefix(attrib["name"].nodeValue) - val alias = attrib["alias"]?.nodeValue?.let { removeConstPrefix(it) } + val name = attrib["name"].nodeValue.removeConstPrefix() + val alias = attrib["alias"]?.nodeValue?.removeConstPrefix() if (alias != null) { list.add(Constant(list.find { it.name == alias }!!.type, name, alias)) } else { @@ -206,7 +213,7 @@ fun main() { } } } - list.forEach(VK10::addComponent) + list.forEach(Vk10::addComponent) } else -> { @@ -214,6 +221,7 @@ fun main() { "enum" -> { val clazz = VKFile(enumName, classType = "enum") clazz.superinterfaces.add("overrun.marshal.CEnum") + val clazzVendor = endsWithVendor(enumName) val prefix = "${ removeVendorSuffix(enumName) .replace(UPPERCASE) { "_${it.groupValues[1]}" } @@ -224,14 +232,15 @@ fun main() { if (node.nodeName == "enum") { val attrib = node.attributes val name = - removeVendorSuffix(attrib["name"].nodeValue.removePrefix(prefix)) + attrib["name"].nodeValue.removePrefix(prefix) + .let { if (clazzVendor == endsWithVendor(it)) removeVendorSuffix(it) else it } .removeSuffix("_") - .removePrefix("VK_") + .removeConstPrefix() val alias = attrib["alias"]?.nodeValue ?.removePrefix(prefix) - ?.let { removeVendorSuffix(it) } + ?.let { if (clazzVendor == endsWithVendor(it)) removeVendorSuffix(it) else it } ?.removeSuffix("_") - ?.removePrefix("VK_") + ?.removeConstPrefix() if (alias != null) { clazz.addComponent( EnumValue( @@ -246,6 +255,9 @@ fun main() { name = name, args = listOf(attrib["value"].nodeValue), document = attrib["comment"]?.nodeValue + ?.replace("&", "&") + ?.replace("<", "<") + ?.replace(">", ">") ) ) } @@ -268,7 +280,7 @@ fun main() { } } } - VK10.generate() + Vk10.generate() } private inline fun NodeList.forEach(action: (Node) -> Unit) { diff --git a/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VK10.java b/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/Vk10.java similarity index 97% rename from modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VK10.java rename to modules/overrungl.vulkan/src/main/java/overrungl/vulkan/Vk10.java index 1c685222..63046205 100644 --- a/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VK10.java +++ b/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/Vk10.java @@ -21,7 +21,7 @@ * The Vulkan binding. * @since 0.1.0 */ -public interface VK10 extends overrun.marshal.DirectAccess { +public interface Vk10 extends overrun.marshal.DirectAccess { int MAX_PHYSICAL_DEVICE_NAME_SIZE = 256; int UUID_SIZE = 16; int LUID_SIZE = 8; diff --git a/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkDisplacementMicromapFormatNV.java b/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkDisplacementMicromapFormatNV.java index c8c420ab..53e2735c 100644 --- a/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkDisplacementMicromapFormatNV.java +++ b/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkDisplacementMicromapFormatNV.java @@ -18,9 +18,9 @@ package overrungl.vulkan; public enum VkDisplacementMicromapFormatNV implements overrun.marshal.CEnum { - 64_TRIANGLES_64_BYTES(1), - 256_TRIANGLES_128_BYTES(2), - 1024_TRIANGLES_128_BYTES(3), + _64_TRIANGLES_64_BYTES(1), + _256_TRIANGLES_128_BYTES(2), + _1024_TRIANGLES_128_BYTES(3), ; private final int value; VkDisplacementMicromapFormatNV(int value) { this.value = value; } diff --git a/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkDriverId.java b/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkDriverId.java index 9f8bacb6..7f232e77 100644 --- a/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkDriverId.java +++ b/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkDriverId.java @@ -41,7 +41,7 @@ public enum VkDriverId implements overrun.marshal.CEnum { /** * Intel Corporation */ - INTEL_OPEN_SOURCE(6), + INTEL_OPEN_SOURCE_MESA(6), /** * Imagination Technologies */ @@ -75,7 +75,7 @@ public enum VkDriverId implements overrun.marshal.CEnum { */ MOLTENVK(14), /** - * Core Avionics & Industrial Inc. + * Core Avionics & Industrial Inc. */ COREAVI_PROPRIETARY(15), /** @@ -117,7 +117,7 @@ public enum VkDriverId implements overrun.marshal.CEnum { /** * Imagination Technologies */ - IMAGINATION_OPEN_SOURCE(25), + IMAGINATION_OPEN_SOURCE_MESA(25), /** * Mesa open source project */ diff --git a/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkFragmentShadingRateNV.java b/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkFragmentShadingRateNV.java index 4a0838a1..967bba6f 100644 --- a/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkFragmentShadingRateNV.java +++ b/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkFragmentShadingRateNV.java @@ -18,17 +18,17 @@ package overrungl.vulkan; public enum VkFragmentShadingRateNV implements overrun.marshal.CEnum { - 1_INVOCATION_PER_PIXEL(0), - 1_INVOCATION_PER_1X2_PIXELS(1), - 1_INVOCATION_PER_2X1_PIXELS(4), - 1_INVOCATION_PER_2X2_PIXELS(5), - 1_INVOCATION_PER_2X4_PIXELS(6), - 1_INVOCATION_PER_4X2_PIXELS(9), - 1_INVOCATION_PER_4X4_PIXELS(10), - 2_INVOCATIONS_PER_PIXEL(11), - 4_INVOCATIONS_PER_PIXEL(12), - 8_INVOCATIONS_PER_PIXEL(13), - 16_INVOCATIONS_PER_PIXEL(14), + _1_INVOCATION_PER_PIXEL(0), + _1_INVOCATION_PER_1X2_PIXELS(1), + _1_INVOCATION_PER_2X1_PIXELS(4), + _1_INVOCATION_PER_2X2_PIXELS(5), + _1_INVOCATION_PER_2X4_PIXELS(6), + _1_INVOCATION_PER_4X2_PIXELS(9), + _1_INVOCATION_PER_4X4_PIXELS(10), + _2_INVOCATIONS_PER_PIXEL(11), + _4_INVOCATIONS_PER_PIXEL(12), + _8_INVOCATIONS_PER_PIXEL(13), + _16_INVOCATIONS_PER_PIXEL(14), NO_INVOCATIONS(15), ; private final int value; diff --git a/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkImageType.java b/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkImageType.java index 3b427cfe..bff6cd98 100644 --- a/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkImageType.java +++ b/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkImageType.java @@ -18,9 +18,9 @@ package overrungl.vulkan; public enum VkImageType implements overrun.marshal.CEnum { - 1D(0), - 2D(1), - 3D(2), + _1D(0), + _2D(1), + _3D(2), ; private final int value; VkImageType(int value) { this.value = value; } diff --git a/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkImageViewType.java b/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkImageViewType.java index cde4874e..51047f12 100644 --- a/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkImageViewType.java +++ b/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkImageViewType.java @@ -18,12 +18,12 @@ package overrungl.vulkan; public enum VkImageViewType implements overrun.marshal.CEnum { - 1D(0), - 2D(1), - 3D(2), + _1D(0), + _2D(1), + _3D(2), CUBE(3), - 1D_ARRAY(4), - 2D_ARRAY(5), + _1D_ARRAY(4), + _2D_ARRAY(5), CUBE_ARRAY(6), ; private final int value; diff --git a/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkLineRasterizationModeKHR.java b/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkLineRasterizationModeKHR.java index 4eaf9be0..49c059c8 100644 --- a/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkLineRasterizationModeKHR.java +++ b/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkLineRasterizationModeKHR.java @@ -19,13 +19,13 @@ public enum VkLineRasterizationModeKHR implements overrun.marshal.CEnum { DEFAULT(0), - DEFAULT(DEFAULT.value), + DEFAULT_EXT(DEFAULT.value), RECTANGULAR(1), - RECTANGULAR(RECTANGULAR.value), + RECTANGULAR_EXT(RECTANGULAR.value), BRESENHAM(2), - BRESENHAM(BRESENHAM.value), + BRESENHAM_EXT(BRESENHAM.value), RECTANGULAR_SMOOTH(3), - RECTANGULAR_SMOOTH(RECTANGULAR_SMOOTH.value), + RECTANGULAR_SMOOTH_EXT(RECTANGULAR_SMOOTH.value), ; private final int value; VkLineRasterizationModeKHR(int value) { this.value = value; } diff --git a/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkOpacityMicromapFormatEXT.java b/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkOpacityMicromapFormatEXT.java index b53e2ce5..eb4662f1 100644 --- a/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkOpacityMicromapFormatEXT.java +++ b/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkOpacityMicromapFormatEXT.java @@ -18,8 +18,8 @@ package overrungl.vulkan; public enum VkOpacityMicromapFormatEXT implements overrun.marshal.CEnum { - 2_STATE(1), - 4_STATE(2), + _2_STATE(1), + _4_STATE(2), ; private final int value; VkOpacityMicromapFormatEXT(int value) { this.value = value; } diff --git a/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkQueueGlobalPriorityKHR.java b/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkQueueGlobalPriorityKHR.java index 18843cba..42815ad3 100644 --- a/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkQueueGlobalPriorityKHR.java +++ b/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkQueueGlobalPriorityKHR.java @@ -22,10 +22,10 @@ public enum VkQueueGlobalPriorityKHR implements overrun.marshal.CEnum { MEDIUM(256), HIGH(512), REALTIME(1024), - LOW(LOW.value), - MEDIUM(MEDIUM.value), - HIGH(HIGH.value), - REALTIME(REALTIME.value), + LOW_EXT(LOW.value), + MEDIUM_EXT(MEDIUM.value), + HIGH_EXT(HIGH.value), + REALTIME_EXT(REALTIME.value), ; private final int value; VkQueueGlobalPriorityKHR(int value) { this.value = value; } diff --git a/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkResult.java b/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkResult.java index bda2416d..7897682a 100644 --- a/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkResult.java +++ b/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkResult.java @@ -55,7 +55,7 @@ public enum VkResult implements overrun.marshal.CEnum { */ ERROR_INITIALIZATION_FAILED(-3), /** - * The logical device has been lost. See <> + * The logical device has been lost. See <<devsandqueues-lost-device>> */ ERROR_DEVICE_LOST(-4), /** diff --git a/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkShaderFloatControlsIndependence.java b/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkShaderFloatControlsIndependence.java index f47893f2..570f696b 100644 --- a/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkShaderFloatControlsIndependence.java +++ b/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkShaderFloatControlsIndependence.java @@ -18,7 +18,7 @@ package overrungl.vulkan; public enum VkShaderFloatControlsIndependence implements overrun.marshal.CEnum { - 32_BIT_ONLY(0), + _32_BIT_ONLY(0), ALL(1), NONE(2), ; diff --git a/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkShadingRatePaletteEntryNV.java b/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkShadingRatePaletteEntryNV.java index 591032fe..c21c87fa 100644 --- a/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkShadingRatePaletteEntryNV.java +++ b/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkShadingRatePaletteEntryNV.java @@ -19,17 +19,17 @@ public enum VkShadingRatePaletteEntryNV implements overrun.marshal.CEnum { NO_INVOCATIONS(0), - 16_INVOCATIONS_PER_PIXEL(1), - 8_INVOCATIONS_PER_PIXEL(2), - 4_INVOCATIONS_PER_PIXEL(3), - 2_INVOCATIONS_PER_PIXEL(4), - 1_INVOCATION_PER_PIXEL(5), - 1_INVOCATION_PER_2X1_PIXELS(6), - 1_INVOCATION_PER_1X2_PIXELS(7), - 1_INVOCATION_PER_2X2_PIXELS(8), - 1_INVOCATION_PER_4X2_PIXELS(9), - 1_INVOCATION_PER_2X4_PIXELS(10), - 1_INVOCATION_PER_4X4_PIXELS(11), + _16_INVOCATIONS_PER_PIXEL(1), + _8_INVOCATIONS_PER_PIXEL(2), + _4_INVOCATIONS_PER_PIXEL(3), + _2_INVOCATIONS_PER_PIXEL(4), + _1_INVOCATION_PER_PIXEL(5), + _1_INVOCATION_PER_2X1_PIXELS(6), + _1_INVOCATION_PER_1X2_PIXELS(7), + _1_INVOCATION_PER_2X2_PIXELS(8), + _1_INVOCATION_PER_4X2_PIXELS(9), + _1_INVOCATION_PER_2X4_PIXELS(10), + _1_INVOCATION_PER_4X4_PIXELS(11), ; private final int value; VkShadingRatePaletteEntryNV(int value) { this.value = value; } diff --git a/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkVendorId.java b/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkVendorId.java index afc42042..1b53c206 100644 --- a/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkVendorId.java +++ b/modules/overrungl.vulkan/src/main/java/overrungl/vulkan/VkVendorId.java @@ -21,11 +21,11 @@ public enum VkVendorId implements overrun.marshal.CEnum { /** * Vivante vendor ID */ - (0x10001), + VIV(0x10001), /** * VeriSilicon vendor ID */ - (0x10002), + VSI(0x10002), /** * Kazan Software Renderer */ @@ -37,7 +37,7 @@ public enum VkVendorId implements overrun.marshal.CEnum { /** * Mesa vendor ID */ - (0x10005), + MESA(0x10005), /** * PoCL vendor ID */