Load tinyexr in its own class loader

That way we can simply use whatever version we want and aren't tied to the
version of lwjgl which MC provides.

This fixes the OpenEXR export on 1.19 crashing either due to the windows
workaround or due to differing lwjgl versions (depending on OS).
And also enables OpenEXR export on MC versions using lwjgl2 (1.12.2 and below).
This commit is contained in:
Jonas Herzig
2022-06-26 11:57:24 +02:00
parent 814d0b7c17
commit 40f07279cf
7 changed files with 156 additions and 108 deletions

View File

@@ -1,4 +1,5 @@
import com.replaymod.gradle.preprocess.PreprocessTask
import static gg.essential.gradle.util.PrebundleKt.prebundle
buildscript {
def mcVersion
@@ -18,17 +19,17 @@ buildscript {
name = "fabric"
url = "https://maven.fabricmc.net/"
}
if (!fabric) {
maven {
name = "forge"
url = "https://maven.minecraftforge.net"
}
maven {
name = "forge"
url = "https://maven.minecraftforge.net"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven { url 'https://jitpack.io' }
maven { url "https://maven.architectury.dev" }
maven { url "https://repo.essential.gg/repository/maven-public" }
}
dependencies {
@@ -48,6 +49,7 @@ buildscript {
} else {
classpath 'com.github.ReplayMod:ForgeGradle:a8a9e0ca:all' // FG 1.2
}
classpath 'gg.essential:essential-gradle-toolkit:0.1.10'
}
}
@@ -323,13 +325,13 @@ dependencies {
shadow 'com.google.api-client:google-api-client-java6:1.20.0', shadeExclusions
shadow 'com.google.oauth-client:google-oauth-client-jetty:1.20.0'
if (mcVersion >= 11400) { // need lwjgl 3
for (suffix in ['', ':natives-linux', ':natives-windows', ':natives-macos']) {
shadow('org.lwjgl:lwjgl-tinyexr:3.2.2' + suffix) {
exclude group: 'org.lwjgl', module: 'lwjgl' // comes with MC
}
}
def lwjgl = configurations.create("lwjgl")
for (suffix in ['', ':natives-linux', ':natives-windows', ':natives-macos', ':natives-macos-arm64']) {
add(lwjgl.name, 'org.lwjgl:lwjgl:3.3.1' + suffix)
add(lwjgl.name, 'org.lwjgl:lwjgl-tinyexr:3.3.1' + suffix)
}
compileOnly('org.lwjgl:lwjgl-tinyexr:3.3.1')
shadow(prebundle(project, lwjgl, "com/replaymod/render/utils/lwjgl.jar", {}))
if (mcVersion < 11200) {
// The version which MC ships is too old, we'll need to ship our own