mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-30 05:02:15 +09:00
[Feat] (Android plugin, renderer samples): add interactive tests and external trace replay
This commit is contained in:
1 parent
9560cca571
commit
04f7faedc1
17 files changed
+2328
-30
No files matched your search
@@ -126,7 +126,50 @@ val pluginRendererConfig = buildJsonValue {
|
||||
)
|
||||
}
|
||||
|
||||
val environmentSources = fileTree("../../MobileGL") {
|
||||
include("**/*.cpp", "**/*.h", "**/*.inc", "**/*.hpp", "**/*.c")
|
||||
exclude("MG_Test/**", "MG_IntegrationTest/**", "MG_Benchmark/**")
|
||||
}
|
||||
val environmentAssets = layout.buildDirectory.dir("generated/testEnvironment/assets")
|
||||
val generateTestEnvironment = tasks.register("generateTestEnvironment") {
|
||||
inputs.files(environmentSources)
|
||||
outputs.dir(environmentAssets)
|
||||
doLast {
|
||||
val names = sortedSetOf("LIBGL_ES", "POJAV_RENDERER", "VK_ICD_FILENAMES", "VK_DRIVER_FILES", "VK_LAYER_PATH")
|
||||
val types = mutableMapOf<String, String>()
|
||||
val name = Regex(""""(MOBILEGL_[A-Z0-9_]+)"""")
|
||||
val query = Regex("""QueryEnv(Flag|QuirkOverride|Uint32|MultiDrawMode|GLESMultiDrawMode)\s*\(\s*"(MOBILEGL_[A-Z0-9_]+)"""")
|
||||
val choices = mapOf(
|
||||
"Flag" to "Off=0|On=1",
|
||||
"QuirkOverride" to "Auto|ForceOn|ForceOff",
|
||||
"Uint32" to "number",
|
||||
"MultiDrawMode" to "auto|ext|indirect|unroll",
|
||||
"GLESMultiDrawMode" to "auto|ext|multiindirect|indirect|basevertex|drawelements|compute",
|
||||
)
|
||||
environmentSources.forEach { source ->
|
||||
val text = source.readText()
|
||||
name.findAll(text).forEach { names.add(it.groupValues[1]) }
|
||||
query.findAll(text).forEach { types[it.groupValues[2]] = choices.getValue(it.groupValues[1]) }
|
||||
}
|
||||
types.putAll(mapOf(
|
||||
"MOBILEGL_BACKEND_TYPE" to "DirectGLES|DirectVulkan",
|
||||
"MOBILEGL_TRANSPORT" to "monolith|inproc|spawn",
|
||||
"MOBILEGL_IPC_DATA" to "auto|shm|stream",
|
||||
"MOBILEGL_IPC_SURFACE" to "offscreen|server",
|
||||
"MOBILEGL_IPC_RECOVER" to choices.getValue("Flag"),
|
||||
"MOBILEGL_FPS_LOG" to choices.getValue("Flag"),
|
||||
"MOBILEGL_ES_CONTEXT_IDENTITY" to choices.getValue("Flag"),
|
||||
))
|
||||
names.remove("MOBILEGL_TEST_BACKEND_ENV_PRIORITY")
|
||||
val asset = environmentAssets.get().file("test-environment.tsv").asFile
|
||||
asset.parentFile.mkdirs()
|
||||
asset.writeText(names.joinToString("\n", postfix = "\n") { "$it\t${types[it].orEmpty()}" })
|
||||
}
|
||||
}
|
||||
tasks.named("preBuild").configure { dependsOn(generateTestEnvironment) }
|
||||
|
||||
android {
|
||||
sourceSets.getByName("main").assets.srcDir(environmentAssets)
|
||||
namespace = "top.mobilegl.plugin"
|
||||
compileSdk = 34
|
||||
ndkVersion = "27.3.13750724"
|
||||
@@ -260,12 +303,6 @@ android.applicationVariants.configureEach {
|
||||
}
|
||||
}
|
||||
|
||||
androidComponents {
|
||||
onVariants(selector().withFlavor("profile" to "plugin")) { variant ->
|
||||
variant.packaging.jniLibs.excludes.add("**/libtrace_replay_runner.so")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":MobileGL"))
|
||||
}
|
||||
Reference in new issue
Block a user