feat: add Android particle capacity baseline
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled
This commit is contained in:
@@ -23,6 +23,7 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
|
||||
private var maskMode = MASK_GLOBAL
|
||||
private var fixtureMode = FIXTURE_UNIFORM_EAST
|
||||
private var timeMix = 0.0f
|
||||
private var particleCount = PARTICLE_COUNT_256
|
||||
private var timeWindowMode = false
|
||||
private var styleLoadEpoch = 0L
|
||||
private var styleReady = false
|
||||
@@ -33,6 +34,7 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
|
||||
maskMode = savedInstanceState?.getInt(STATE_MASK_MODE, MASK_GLOBAL) ?: MASK_GLOBAL
|
||||
fixtureMode = savedInstanceState?.getInt(STATE_FIXTURE_MODE, FIXTURE_UNIFORM_EAST) ?: FIXTURE_UNIFORM_EAST
|
||||
timeMix = savedInstanceState?.getFloat(STATE_TIME_MIX, 0.0f) ?: 0.0f
|
||||
particleCount = savedInstanceState?.getInt(STATE_PARTICLE_COUNT, PARTICLE_COUNT_256) ?: PARTICLE_COUNT_256
|
||||
timeWindowMode = savedInstanceState?.getBoolean(STATE_TIME_WINDOW, false) ?: false
|
||||
super.onCreate(savedInstanceState)
|
||||
Log.i(
|
||||
@@ -96,6 +98,12 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
|
||||
findViewById<Button>(R.id.validationMix0).setOnClickListener { setTimeMix(0.0f) }
|
||||
findViewById<Button>(R.id.validationMix50).setOnClickListener { setTimeMix(0.5f) }
|
||||
findViewById<Button>(R.id.validationMix100).setOnClickListener { setTimeMix(1.0f) }
|
||||
findViewById<Button>(R.id.validationParticle256).setOnClickListener { setParticleCount(PARTICLE_COUNT_256) }
|
||||
findViewById<Button>(R.id.validationParticle1024).setOnClickListener { setParticleCount(PARTICLE_COUNT_1024) }
|
||||
findViewById<Button>(R.id.validationParticle4096).setOnClickListener { setParticleCount(PARTICLE_COUNT_4096) }
|
||||
findViewById<Button>(R.id.validationParticle16384).setOnClickListener { setParticleCount(PARTICLE_COUNT_16384) }
|
||||
findViewById<Button>(R.id.validationParticle65536).setOnClickListener { setParticleCount(PARTICLE_COUNT_65536) }
|
||||
findViewById<Button>(R.id.validationParticle1048576).setOnClickListener { setParticleCount(PARTICLE_COUNT_1048576) }
|
||||
findViewById<Button>(R.id.validationAdvanceWindow).setOnClickListener {
|
||||
timeWindowMode = true
|
||||
fixtureMode = FIXTURE_UNIFORM_NORTH
|
||||
@@ -164,6 +172,30 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
|
||||
Log.i(TAG, "ParticleGPU: event=MIX_PROPERTY_ONLY value=$timeMix styleEpoch=$styleLoadEpoch")
|
||||
}
|
||||
|
||||
private fun setParticleCount(requestedParticleCount: Int) {
|
||||
if (!styleReady) {
|
||||
Log.i(TAG, "ParticleGPU: event=PARTICLE_COUNT_REJECTED reason=STYLE_LOADING requestedParticleCount=$requestedParticleCount styleEpoch=$styleLoadEpoch")
|
||||
return
|
||||
}
|
||||
if (!enabled) {
|
||||
Log.i(TAG, "ParticleGPU: event=PARTICLE_COUNT_REJECTED reason=DISABLED requestedParticleCount=$requestedParticleCount styleEpoch=$styleLoadEpoch")
|
||||
return
|
||||
}
|
||||
Log.i(TAG, "ParticleGPU: event=PARTICLE_COUNT_REQUEST requestedParticleCount=$requestedParticleCount styleEpoch=$styleLoadEpoch")
|
||||
if (!maplibreMap.setStyleLayerFloatProperty(
|
||||
PARTICLE_LAYER_ID,
|
||||
"raster-particle-particle-count",
|
||||
requestedParticleCount.toFloat()
|
||||
)
|
||||
) {
|
||||
Log.i(TAG, "ParticleGPU: event=PARTICLE_COUNT_REJECTED reason=CORE_PROPERTY_REJECTED requestedParticleCount=$requestedParticleCount styleEpoch=$styleLoadEpoch")
|
||||
return
|
||||
}
|
||||
particleCount = requestedParticleCount
|
||||
status.text = statusText()
|
||||
Log.i(TAG, "ParticleGPU: event=PARTICLE_COUNT_APPLIED requestedParticleCount=$requestedParticleCount effectiveParticleCount=$particleCount styleEpoch=$styleLoadEpoch")
|
||||
}
|
||||
|
||||
private fun statusText(): String {
|
||||
val mask = when (maskMode) {
|
||||
MASK_OCEAN_A -> "OCEAN A"
|
||||
@@ -178,7 +210,7 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
|
||||
} else {
|
||||
"EAST"
|
||||
}
|
||||
return "$mask · $runtime · $fields · MIX ${(timeMix * 100).toInt()}%"
|
||||
return "$mask · $runtime · $fields · MIX ${(timeMix * 100).toInt()}% · $particleCount particles"
|
||||
}
|
||||
|
||||
private fun validationStyle(active: Boolean, enabled: Boolean): String {
|
||||
@@ -191,7 +223,7 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
|
||||
val particleLayer = if (enabled) {
|
||||
"""{"id":"particle-raster-core","type":"raster-particle","source":"particle-fixture",
|
||||
"paint":{"raster-particle-active":$active,"raster-particle-mask-mode":$maskMode,
|
||||
"raster-particle-time-mix":$timeMix}},"""
|
||||
"raster-particle-time-mix":$timeMix,"raster-particle-particle-count":$particleCount}},"""
|
||||
} else {
|
||||
""
|
||||
}
|
||||
@@ -239,6 +271,7 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
|
||||
outState.putInt(STATE_MASK_MODE, maskMode)
|
||||
outState.putInt(STATE_FIXTURE_MODE, fixtureMode)
|
||||
outState.putFloat(STATE_TIME_MIX, timeMix)
|
||||
outState.putInt(STATE_PARTICLE_COUNT, particleCount)
|
||||
outState.putBoolean(STATE_TIME_WINDOW, timeWindowMode)
|
||||
super.onSaveInstanceState(outState)
|
||||
mapView.onSaveInstanceState(outState)
|
||||
@@ -256,6 +289,7 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
|
||||
private const val STATE_MASK_MODE = "particle_validation.mask_mode"
|
||||
private const val STATE_FIXTURE_MODE = "particle_validation.fixture_mode"
|
||||
private const val STATE_TIME_MIX = "particle_validation.time_mix"
|
||||
private const val STATE_PARTICLE_COUNT = "particle_validation.particle_count"
|
||||
private const val STATE_TIME_WINDOW = "particle_validation.time_window"
|
||||
private const val PARTICLE_LAYER_ID = "particle-raster-core"
|
||||
private const val MASK_GLOBAL = 0
|
||||
@@ -263,5 +297,11 @@ class ParticleCoreLayerValidationActivity : AppCompatActivity() {
|
||||
private const val MASK_OCEAN_B = 2
|
||||
private const val FIXTURE_UNIFORM_EAST = 0
|
||||
private const val FIXTURE_UNIFORM_NORTH = 1
|
||||
private const val PARTICLE_COUNT_256 = 256
|
||||
private const val PARTICLE_COUNT_1024 = 1024
|
||||
private const val PARTICLE_COUNT_4096 = 4096
|
||||
private const val PARTICLE_COUNT_16384 = 16384
|
||||
private const val PARTICLE_COUNT_65536 = 65536
|
||||
private const val PARTICLE_COUNT_1048576 = 1048576
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,26 @@
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="34dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button android:id="@+id/validationParticle256" style="@style/ParticleValidationButton" android:layout_width="0dp" android:layout_weight="1" android:text="@string/particle_validation_particles_256" />
|
||||
<Button android:id="@+id/validationParticle1024" style="@style/ParticleValidationButton" android:layout_width="0dp" android:layout_weight="1" android:text="@string/particle_validation_particles_1024" />
|
||||
<Button android:id="@+id/validationParticle4096" style="@style/ParticleValidationButton" android:layout_width="0dp" android:layout_weight="1" android:text="@string/particle_validation_particles_4096" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="34dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button android:id="@+id/validationParticle16384" style="@style/ParticleValidationButton" android:layout_width="0dp" android:layout_weight="1" android:text="@string/particle_validation_particles_16384" />
|
||||
<Button android:id="@+id/validationParticle65536" style="@style/ParticleValidationButton" android:layout_width="0dp" android:layout_weight="1" android:text="@string/particle_validation_particles_65536" />
|
||||
<Button android:id="@+id/validationParticle1048576" style="@style/ParticleValidationButton" android:layout_width="0dp" android:layout_weight="1" android:text="@string/particle_validation_particles_1048576" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="34dp"
|
||||
|
||||
@@ -29,6 +29,12 @@
|
||||
<string name="particle_validation_mix_0">MIX 0%</string>
|
||||
<string name="particle_validation_mix_50">MIX 50%</string>
|
||||
<string name="particle_validation_mix_100">MIX 100%</string>
|
||||
<string name="particle_validation_particles_256">256</string>
|
||||
<string name="particle_validation_particles_1024">1K</string>
|
||||
<string name="particle_validation_particles_4096">4K</string>
|
||||
<string name="particle_validation_particles_16384">16K</string>
|
||||
<string name="particle_validation_particles_65536">64K</string>
|
||||
<string name="particle_validation_particles_1048576">1M</string>
|
||||
<string name="particle_validation_global_active_status">40-01 GLOBAL ACTIVE: offline field simulation and current-frame composite.</string>
|
||||
<string name="particle_validation_global_static_status">40-01 GLOBAL STATIC: zero-step bootstrap and frozen composite.</string>
|
||||
<string name="particle_validation_ocean_a_status">40-01 OCEAN_ONLY_A: shared coastal-mask consumer.</string>
|
||||
|
||||
Reference in New Issue
Block a user