Skip to content

Commit e76406c

Browse files
authored
Merge branch 'master' into fix/locked-canvas
2 parents feb5c1f + e77e5e5 commit e76406c

166 files changed

Lines changed: 6079 additions & 15802 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/main.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -443,29 +443,31 @@ jobs:
443443
name: Deploy Java Snapshot
444444
runs-on: ubuntu-latest
445445
if: github.event_name == 'push' && github.ref_name == 'master'
446+
permissions:
447+
contents: read
446448
steps:
447449

448450
# We need to clone everything again for uploadToMaven.sh ...
449451
- name: Clone the repo
450-
uses: actions/checkout@v6
452+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
451453
with:
452454
fetch-depth: 1
453455

454456
# Setup jdk 21 used for building Maven-style artifacts
455457
- name: Setup the java environment
456-
uses: actions/setup-java@v5
458+
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
457459
with:
458460
distribution: 'temurin'
459461
java-version: '21'
460462

461463
- name: Download natives for android
462-
uses: actions/download-artifact@v8.0.1
464+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
463465
with:
464466
name: android-natives
465467
path: build/native
466468

467469
- name: Download natives for iOS
468-
uses: actions/download-artifact@v8.0.1
470+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
469471
with:
470472
name: ios-natives
471473
path: jme3-ios-native/template/META-INF/robovm/ios/libs/jme3-ios-native.xcframework
@@ -482,7 +484,6 @@ jobs:
482484
-PcentralUsername=${{ secrets.CENTRAL_USERNAME }} \
483485
-PsigningKey='${{ secrets.SIGNING_KEY }}' \
484486
-PsigningPassword='${{ secrets.SIGNING_PASSWORD }}' \
485-
-PuseCommitHashAsVersionName=true \
486487
--console=plain --stacktrace
487488
fi
488489

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
**/.vscode/**
66
**/out/
77
/.gradle/
8+
**/.gradle/
89
/.nb-gradle/
910
/.idea/
1011
/dist/
@@ -45,4 +46,4 @@ javadoc_deploy.pub
4546
!.vscode/settings.json
4647
!.vscode/JME_style.xml
4748
!.vscode/extensions.json
48-
joysticks-*.txt
49+
joysticks-*.txt

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
"editor.formatOnPaste": false,
66
"editor.formatOnType": false,
77
"editor.formatOnSave": false,
8-
"java.jdt.ls.vmargs": "-Xms512M -Xmx2G -XX:+UseG1GC -XX:+UseStringDeduplication -XX:AdaptiveSizePolicyWeight=90"
8+
"java.jdt.ls.vmargs": "-Xms512M -Xmx4G -XX:+UseG1GC -XX:+UseStringDeduplication -XX:AdaptiveSizePolicyWeight=90"
99
}

build.gradle

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ buildscript {
1212
}
1313
}
1414

15+
plugins {
16+
id 'org.jmonkeyengine.nativeimage' apply false
17+
}
18+
1519
import org.gradle.api.file.RelativePath
1620

1721
// Set the license for IDEs that understand this
@@ -56,6 +60,25 @@ subprojects {
5660
}
5761
}
5862

63+
def nativeImagePluginBuild = gradle.includedBuild('jme3-nativeimage-plugin')
64+
def nativeImagePluginPublishTasks = [
65+
publish : ':publish',
66+
publishToMavenLocal : ':publishToMavenLocal',
67+
install : ':install',
68+
publishAllPublicationsToCentralRepository : ':publishAllPublicationsToCentralRepository',
69+
publishAllPublicationsToSNAPSHOTRepository : ':publishAllPublicationsToSNAPSHOTRepository',
70+
publishAllPublicationsToDistRepository : ':publishAllPublicationsToDistRepository'
71+
]
72+
73+
subprojects {
74+
tasks.configureEach { task ->
75+
String includedTaskPath = nativeImagePluginPublishTasks[task.name]
76+
if (includedTaskPath != null) {
77+
task.dependsOn nativeImagePluginBuild.task(includedTaskPath)
78+
}
79+
}
80+
}
81+
5982
tasks.register('run') {
6083
dependsOn ':jme3-examples:run'
6184
description = 'Run the jME3 examples'
@@ -280,10 +303,8 @@ if (skipPrebuildLibraries != "true" && buildNativeProjects != "true") {
280303
}) {
281304
eachFile { details ->
282305
def segments = details.relativePath.segments
283-
if (segments.length <= 1) {
284-
details.exclude()
285-
} else {
286-
details.relativePath = new RelativePath(details.isDirectory(), segments[1..-1] as String[])
306+
if (segments.length > 1) {
307+
details.path = segments[1..-1].join('/')
287308
}
288309
}
289310
includeEmptyDirs = false

common.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ java {
2424
}
2525
}
2626

27+
apply plugin: 'org.jmonkeyengine.nativeimage'
28+
2729
tasks.withType(JavaCompile) { // compile-time options:
2830
//options.compilerArgs << '-Xlint:deprecation' // to show deprecation warnings
2931
options.compilerArgs << '-Xlint:unchecked'

gradle/libs.versions.toml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
checkstyle = "13.3.0"
66
jacoco = "0.8.12"
77
lwjgl3 = "3.4.1"
8+
angle = "2026-05-09"
9+
saferalloc = "0.0.8"
810
nifty = "1.4.3"
911
spotbugs = "4.9.8"
1012

@@ -16,7 +18,6 @@ androidx-lifecycle-common = "androidx.lifecycle:lifecycle-common:2.7.0"
1618
android-build-gradle = "com.android.tools.build:gradle:9.1.0"
1719
android-support-appcompat = "com.android.support:appcompat-v7:28.0.0"
1820
androidx-test-runner = "androidx.test:runner:1.7.0"
19-
gradle-git = "org.ajoberstar:gradle-git:1.2.0"
2021
groovy-test = "org.apache.groovy:groovy-test:4.0.31"
2122
gson = "com.google.code.gson:gson:2.13.2"
2223
j-ogg-vorbis = "com.github.stephengold:j-ogg-vorbis:1.0.6"
@@ -36,9 +37,10 @@ lwjgl3-glfw = { module = "org.lwjgl:lwjgl-glfw", version.ref = "lwjgl3"
3637
lwjgl3-jawt = { module = "org.lwjgl:lwjgl-jawt", version.ref = "lwjgl3" }
3738
lwjgl3-jemalloc = { module = "org.lwjgl:lwjgl-jemalloc", version.ref = "lwjgl3" }
3839
lwjgl3-openal = { module = "org.lwjgl:lwjgl-openal", version.ref = "lwjgl3" }
39-
lwjgl3-opencl = { module = "org.lwjgl:lwjgl-opencl", version.ref = "lwjgl3" }
4040
lwjgl3-opengl = { module = "org.lwjgl:lwjgl-opengl", version.ref = "lwjgl3" }
4141
lwjgl3-sdl = { module = "org.lwjgl:lwjgl-sdl", version.ref = "lwjgl3" }
42+
lwjgl3-opengles = { module = "org.lwjgl:lwjgl-opengles", version.ref = "lwjgl3" }
43+
lwjgl3-egl = { module = "org.lwjgl:lwjgl-egl", version.ref = "lwjgl3" }
4244

4345
mokito-core = "org.mockito:mockito-core:5.23.0"
4446
mokito-junit-jupiter = "org.mockito:mockito-junit-jupiter:5.23.0"
@@ -53,8 +55,18 @@ vecmath = "javax.vecmath:vecmath:1.5.2"
5355

5456
stb-image = "org.ngengine:stb-image:2.30.4"
5557
imagewebp = "org.ngengine:image-webp-decoder:1.3.0"
58+
angle = { module = "org.ngengine:angle-natives", version.ref = "angle" }
59+
saferalloc = { module = "org.ngengine:saferalloc", version.ref = "saferalloc" }
60+
saferalloc-natives-linux-x8664 = { module = "org.ngengine:saferalloc-natives-linux-x86_64", version.ref = "saferalloc" }
61+
saferalloc-natives-linux-aarch64 = { module = "org.ngengine:saferalloc-natives-linux-aarch64", version.ref = "saferalloc" }
62+
saferalloc-natives-windows-x8664 = { module = "org.ngengine:saferalloc-natives-windows-x86_64", version.ref = "saferalloc" }
63+
saferalloc-natives-windows-aarch64 = { module = "org.ngengine:saferalloc-natives-windows-aarch64", version.ref = "saferalloc" }
64+
saferalloc-natives-macos-x8664 = { module = "org.ngengine:saferalloc-natives-macos-x86_64", version.ref = "saferalloc" }
65+
saferalloc-natives-macos-aarch64 = { module = "org.ngengine:saferalloc-natives-macos-aarch64", version.ref = "saferalloc" }
66+
saferalloc-natives-android = { module = "org.ngengine:saferalloc-natives-android", version.ref = "saferalloc" }
5667

5768
[bundles]
69+
saferalloc = ["saferalloc", "saferalloc-natives-linux-x8664", "saferalloc-natives-linux-aarch64", "saferalloc-natives-windows-x8664", "saferalloc-natives-windows-aarch64", "saferalloc-natives-macos-x8664", "saferalloc-natives-macos-aarch64", "saferalloc-natives-android"]
5870

5971
[plugins]
6072
jacoco = { id = "jacoco", version.ref = "jacoco" }

jme3-android/src/main/java/com/jme3/renderer/android/AndroidGL.java

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ public class AndroidGL implements GL, GL2, GLES_30, GLExt, GLFbo {
5151
public void resetStats() {
5252
}
5353

54+
@Override
55+
public boolean supportsGpuTimerQuery() {
56+
return false;
57+
}
58+
5459
private static int getLimitBytes(ByteBuffer buffer) {
5560
checkLimit(buffer);
5661
return buffer.limit();
@@ -100,6 +105,9 @@ public void glAttachShader(int program, int shader) {
100105

101106
@Override
102107
public void glBeginQuery(int target, int query) {
108+
if (target == GL.GL_TIME_ELAPSED) {
109+
throw new UnsupportedOperationException("64-bit GPU timer queries are not exposed by the Android GLES bindings");
110+
}
103111
GLES30.glBeginQuery(target, query);
104112
}
105113

@@ -287,6 +295,9 @@ public void glEnableVertexAttribArray(int index) {
287295

288296
@Override
289297
public void glEndQuery(int target) {
298+
if (target == GL.GL_TIME_ELAPSED) {
299+
throw new UnsupportedOperationException("64-bit GPU timer queries are not exposed by the Android GLES bindings");
300+
}
290301
GLES30.glEndQuery(target);
291302
}
292303

@@ -348,16 +359,13 @@ public String glGetProgramInfoLog(int program, int maxLength) {
348359

349360
@Override
350361
public long glGetQueryObjectui64(int query, int pname) {
351-
IntBuffer buff = IntBuffer.allocate(1);
352-
//FIXME This is wrong IMO should be glGetQueryObjectui64v with a LongBuffer but it seems the API doesn't provide it.
353-
GLES30.glGetQueryObjectuiv(query, pname, buff);
354-
return buff.get(0);
362+
throw new UnsupportedOperationException("64-bit query results are not exposed by the Android GLES bindings");
355363
}
356364

357365
@Override
358366
public int glGetQueryObjectiv(int query, int pname) {
359-
IntBuffer buff = IntBuffer.allocate(1);
360-
GLES30.glGetQueryiv(query, pname, buff);
367+
IntBuffer buff = (IntBuffer)tmpBuff.clear();
368+
GLES30.glGetQueryObjectuiv(query, pname, buff);
361369
return buff.get(0);
362370
}
363371

@@ -786,4 +794,9 @@ public void glGenVertexArrays(IntBuffer arrays) {
786794

787795
}
788796

797+
@Override
798+
public String glGetString(int name, int index) {
799+
return GLES30.glGetStringi(name, index);
800+
}
801+
789802
}

jme3-android/src/main/java/com/jme3/system/android/OGLESContext.java

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -669,21 +669,37 @@ private boolean renderFrameWithBlitSrgbConversion() {
669669
return false;
670670
}
671671

672+
FrameBuffer previousMainFramebuffer = renderer.getCurrentFrameBuffer();
673+
if (previousMainFramebuffer != null) {
674+
return false;
675+
}
676+
672677
rebuildLinearFrameBufferIfNeeded();
673678
if (linearFrameBuffer == null || !ensureBlitResources()) {
674679
return false;
675680
}
676681

682+
FrameBuffer restoreMainFramebuffer = previousMainFramebuffer;
683+
677684
renderer.setMainFrameBufferOverride(linearFrameBuffer);
678685
try {
679686
listener.update();
687+
FrameBuffer currentMainFramebuffer = renderer.getCurrentFrameBuffer();
688+
if (currentMainFramebuffer != linearFrameBuffer) {
689+
restoreMainFramebuffer = currentMainFramebuffer;
690+
}
680691
} finally {
681-
renderer.setMainFrameBufferOverride(null);
692+
renderer.setMainFrameBufferOverride(restoreMainFramebuffer);
682693
}
683694

684-
renderer.setFrameBuffer(null);
685-
blitGeometry.updateGeometricState();
686-
application.getRenderManager().renderGeometry(blitGeometry);
695+
renderer.setMainFrameBufferOverride(null);
696+
try {
697+
renderer.setFrameBuffer(null);
698+
blitGeometry.updateGeometricState();
699+
application.getRenderManager().renderGeometry(blitGeometry);
700+
} finally {
701+
renderer.setMainFrameBufferOverride(restoreMainFramebuffer);
702+
}
687703
return true;
688704
}
689705

@@ -778,12 +794,6 @@ public void onClick(DialogInterface dialog, int whichButton) {
778794
);
779795
}
780796

781-
@Override
782-
public com.jme3.opencl.Context getOpenCLContext() {
783-
logger.warning("OpenCL is not yet supported on android");
784-
return null;
785-
}
786-
787797
/**
788798
* Returns the height of the input surface.
789799
*

jme3-awt-dialogs/src/main/java/com/jme3/awt/AWTSettingsDialog.java

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ public interface SelectionListener {
129129
private JComboBox<String> colorDepthCombo = null;
130130
private JComboBox<String> displayFreqCombo = null;
131131
private JComboBox<String> antialiasCombo = null;
132+
private JComboBox<String> rendererCombo = null;
132133
private JLabel icon = null;
133134
private int selection = 0;
134135
private SelectionListener selectionListener = null;
@@ -463,6 +464,8 @@ public void keyPressed(KeyEvent e) {
463464
displayFreqCombo.addKeyListener(aListener);
464465
antialiasCombo = new JComboBox<>();
465466
antialiasCombo.addKeyListener(aListener);
467+
rendererCombo = setUpRendererChooser();
468+
rendererCombo.addKeyListener(aListener);
466469
fullscreenBox = new JCheckBox(resourceBundle.getString("checkbox.fullscreen"));
467470
fullscreenBox.setSelected(source.isFullscreen());
468471
fullscreenBox.addActionListener(new ActionListener() {
@@ -549,6 +552,20 @@ public void actionPerformed(ActionEvent e) {
549552
gbc.anchor = GridBagConstraints.WEST;
550553
mainPanel.add(antialiasCombo, gbc);
551554

555+
gbc = new GridBagConstraints();
556+
gbc.insets = new Insets(4, 4, 4, 4);
557+
gbc.gridx = 0;
558+
gbc.gridy = 4;
559+
gbc.anchor = GridBagConstraints.EAST;
560+
gbc.weightx = 0.5;
561+
mainPanel.add(new JLabel(resourceBundle.getString("label.renderer")), gbc);
562+
gbc = new GridBagConstraints();
563+
gbc.gridx = 1;
564+
gbc.gridy = 4;
565+
gbc.gridwidth = 3;
566+
gbc.anchor = GridBagConstraints.WEST;
567+
mainPanel.add(rendererCombo, gbc);
568+
552569
// Set the button action listeners. Cancel disposes without saving, OK
553570
// saves.
554571
ok.addActionListener(new ActionListener() {
@@ -583,14 +600,14 @@ public void actionPerformed(ActionEvent e) {
583600
gbc = new GridBagConstraints();
584601
gbc.gridx = 0;
585602
gbc.gridwidth = 2;
586-
gbc.gridy = 4;
603+
gbc.gridy = 5;
587604
gbc.anchor = GridBagConstraints.EAST;
588605
mainPanel.add(ok, gbc);
589606
gbc = new GridBagConstraints();
590607
gbc.insets = new Insets(4, 16, 4, 4);
591608
gbc.gridx = 2;
592609
gbc.gridwidth = 2;
593-
gbc.gridy = 4;
610+
gbc.gridy = 5;
594611
gbc.anchor = GridBagConstraints.WEST;
595612
mainPanel.add(cancel, gbc);
596613

@@ -662,6 +679,7 @@ private boolean verifyAndSaveCurrentSelection() {
662679
boolean fullscreen = fullscreenBox.isSelected();
663680
boolean vsync = vsyncBox.isSelected();
664681
boolean gamma = gammaBox.isSelected();
682+
String renderer = (String) rendererCombo.getSelectedItem();
665683

666684
String[] parts = display.split(" x ");
667685
int width = Integer.parseInt(parts[0]);
@@ -721,7 +739,7 @@ private boolean verifyAndSaveCurrentSelection() {
721739
source.setFullscreen(fullscreen);
722740
source.setVSync(vsync);
723741
source.setGammaCorrection(gamma);
724-
// source.setRenderer(renderer);
742+
source.setRenderer(renderer);
725743
source.setSamples(multisample);
726744

727745
String appTitle = source.getTitle();
@@ -762,6 +780,30 @@ public void actionPerformed(ActionEvent e) {
762780
return resolutionBox;
763781
}
764782

783+
private JComboBox<String> setUpRendererChooser() {
784+
JComboBox<String> rendererBox = new JComboBox<>();
785+
Set<String> renderers = new LinkedHashSet<>(Arrays.asList(
786+
AppSettings.ANGLE_GLES3,
787+
AppSettings.LWJGL_OPENGL32,
788+
AppSettings.LWJGL_OPENGL33,
789+
AppSettings.LWJGL_OPENGL40,
790+
AppSettings.LWJGL_OPENGL41,
791+
AppSettings.LWJGL_OPENGL42,
792+
AppSettings.LWJGL_OPENGL43,
793+
AppSettings.LWJGL_OPENGL44,
794+
AppSettings.LWJGL_OPENGL45
795+
));
796+
String currentRenderer = source.getRenderer();
797+
if (currentRenderer != null) {
798+
renderers.add(currentRenderer);
799+
}
800+
for (String renderer : renderers) {
801+
rendererBox.addItem(renderer);
802+
}
803+
rendererBox.setSelectedItem(currentRenderer);
804+
return rendererBox;
805+
}
806+
765807
/**
766808
* <code>updateDisplayChoices</code> updates the available color depth and
767809
* display frequency options to match the currently selected resolution.

0 commit comments

Comments
 (0)