getCoreFeatures
Get the Features Supported by the Core
getCoreFeatures is the core interface used for feature compatibility detection. Because different versions of the Runtime Core kernel engine differ in rendering capability, multithreading support, and underlying protocols, this method allows developers to dynamically obtain the "feature list" supported by the current kernel at runtime.
It is key to ensuring games run smoothly on engines of varying performance, and to implementing "progressive enhancement" or "graceful degradation".
Method Declaration
java
/**
* Return the features supported by the Runtime Core.
* This API is mainly used to determine the compatibility of Core functionality.
*
* @return A string array containing feature identifiers (e.g. ["webgl2", "worker", "etc2"])
*/
String[] getCoreFeatures();Runtime Behavior
- Capability declaration: When loading, the engine self-checks the underlying environment (such as GPU driver, instruction set), and returns the available advanced capabilities packed in an array.
- Hard compatibility check: If a high-performance game requires
webgl2to run, the business layer should check whether the list contains that keyword before starting. - Dynamic matching: Even if the kernel version is the same, the returned
Featuresmay differ across phone hardware due to device limitations.
Common Feature Identifier Examples
Although the specific identifiers change with SDK version updates, common features typically include:
| Feature Identifier | Description |
|---|---|
| "webgl2" | Supports WebGL 2.0 rendering, providing more advanced shader support. |
| "multithread" | Supports multithreaded logic, improving the efficiency of complex games. |
| "etc2" / "astc" | Supports specific hardware texture compression formats, reducing video memory usage. |
| "wasm" | Supports WebAssembly, allowing high-performance C++/Rust-compiled logic to run. |
Example
java
// Check whether the current kernel supports WebGL2
String[] features = coreHandle.getCoreFeatures();
boolean isWebGL2Supported = false;
if (features != null) {
for (String feature : features) {
if ("webgl2".equalsIgnoreCase(feature)) {
isWebGL2Supported = true;
break;
}
}
}
if (isWebGL2Supported) {
Log.i("SUDOP", "Great! Enabling high-fidelity graphics mode.");
} else {
Log.w("SUDOP", "WebGL2 not supported. Falling back to basic rendering.");
}Notes
- Null check: Although the handle is not null after a normal load, it is recommended to check the returned array for null or length, to guard against extreme initialization failures.
- Feature prefix: Some versions may add a prefix to features (such as
rt.feature.webgl2); when doing string comparison, it is recommended to consult the specific integration guide for the current version. - Timing requirement: This must be called via the
SUDRTGameCoreHandleinstance after theloadCoreonSuccesscallback.
