Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
graphics.scenery:spirvcrossj
Advanced tools
Java bindings for Khronos' SPIRV-Cross and glslang
SPIRV-cross is a nifty library from the Khronos Group to enable GLSL shader reflection and conversion of SPIR-V binaries to different GLSL version.
glslang is the Khronos Group GLSL reference compiler and validator, providing the other direction.
spirvcrossj provides a wrapper for Java and other JVM languages for both of SPIRV-cross and glslang.
In the profiles
section of your pom.xml
, add the following profiles:
<profile>
<id>spirvcrossj-natives-linux</id>
<activation>
<os>
<family>unix</family>
</os>
</activation>
<properties>
<spirvcrossj.natives>natives-linux</spirvcrossj.natives>
</properties>
</profile>
<profile>
<id>spirvcrossj-natives-macos</id>
<activation>
<os>
<family>mac</family>
</os>
</activation>
<properties>
<spirvcrossj.natives>natives-macos</spirvcrossj.natives>
</properties>
</profile>
<profile>
<id>spirvcrossj-natives-windows</id>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<properties>
<spirvcrossj.natives>natives-windows</spirvcrossj.natives>
</properties>
</profile>
In case you are using lwjgl3, you can also use the lwjgl-natives-linux
, etc. profiles that are already defined. Replace any usages of spirvcrossj.natives
with lwjgl.natives
, then.
Finally, add the following dependencies:
<dependency>
<groupId>graphics.scenery</groupId>
<artifactId>spirvcrossj</artifactId>
<version>0.8.0-1.1.106.0</version>
</dependency>
<dependency>
<groupId>graphics.scenery</groupId>
<artifactId>spirvcrossj</artifactId>
<version>${spirvcrossj.version}</version>
<classifier>${spirvcrossj.natives}</classifier>
<scope>runtime</scope>
</dependency>
First of all, you need to have mavenCentral
:
repositories {
..
mavenCentral()
..
}
Then, under dependencies
section, exploiting the lwjgl native switch
:
dependencies {
..
ext.spirvCrossVersion = "0.8.0-1.1.106"
compile "graphics.scenery:spirvcrossj:$spirvCrossVersion"
switch (OperatingSystem.current()) {
case OperatingSystem.WINDOWS:
ext.lwjglNatives = "natives-windows"
break
case OperatingSystem.LINUX:
ext.lwjglNatives = "natives-linux"
break
case OperatingSystem.MAC_OS:
ext.lwjglNatives = "natives-macos"
break
}
runtime "graphics.scenery:spirvcrossj:$spirvCrossVersion:$lwjglNatives"
..
}
Don't forget to add at the top of your build.gradle
:
import org.gradle.internal.os.OperatingSystem
You can take a look to a build.gradle
here
To build the wrapper, you need the following prerequisites:
By default, a debug build is done. To do a release build, add --config Release
in the cmake --build
step.
On OSX and Linux, you can simply run build.sh
or follow these steps:
# get SPIRV-cross source code, only needed after initial clone
git submodule init
git submodule update
# do CMAKE build
mkdir build
cd build
cmake ..
cmake --build .
# build Maven artifact
cd ../java-wrapper
mvn install
Please note that 32bit builds are not supported.
# get SPIRV-cross source code, only needed after initial clone
git submodule init
git submodule update
# do CMAKE build
mkdir build
cd build
cmake -G "Visual Studio 14 2015 Win64" ..
cmake --build .
# build Maven artifact
cd ../java-wrapper
mvn install
You can run the JUnit tests e.g. in Eclipse or IntelliJ after executing the steps above. The loader will pick up either the newly generated JNI libraries, or load the ones from the JAR. Alternatively, the tests can be executed via Maven, as mvn test
.
In all cases, two tests are performed:
TestVulkanToGLSL.java
).TestGLSLToVulkan.java
).The input files for these tests are taken from the tests in the repositories of glslang and SPIRV-cross and are expected to compile.
See the tests for how to use the library. For both SPIRV-cross and glslang, the syntax is very similar to the original C++ version.
FAQs
Java bindings for Khronos' SPIRV-Cross and glslang
We found that graphics.scenery:spirvcrossj demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.