4.3 KiB
MobileGL POST Format Capability Tables
Goal
Expose the format-capability results used during MobileGL backend startup in the Android plugin's driver POST screen. The screen must show the exact Full, Caveat, or None result for every backend, target, internal format, and capability without duplicating the backend's detection rules.
Existing Architecture
DriverPost.cppprobes the device GLES and Vulkan drivers beforeMobileGL::Initialize()and returns aBackendPostReportfor each backend.DriverPostJni.cppserializes those reports to JSON forPostActivity.PostActivityuses platform Android views and already supports collapsible check details and a collapsible raw report.- Backend startup fills a
FormatCapabilityCachein the DirectGLES and DirectVulkanInitCapabilities()paths.FullCapstakes precedence overCaveatCaps; an absent bit meansNone. - The capability matrix contains 12 targets, 75 internal formats, and 14 capability columns per backend.
Selected Approach
Extract callable format-probe entry points from the existing DirectGLES and DirectVulkan implementations. Backend startup and the POST will call these same functions, so their results cannot drift.
The POST will run each probe while its temporary driver resources are still valid:
- DirectGLES: after the GLES function table and capabilities have been populated, while the 1x1 pbuffer context is current.
- DirectVulkan: after selecting the physical device, while the Vulkan instance and physical device handles remain valid.
The resulting optional FormatCapabilityCache will be stored in each BackendPostReport. Failure to obtain a format table will not discard the existing POST checks or change their verdict; the UI will instead report that the format table is unavailable.
JSON Contract
The JNI report will add an optional formatCapabilities object to each backend. To avoid repeating tens of thousands of status strings, the object will contain:
- one ordered capability-name array;
- one entry per target;
- one compact row per internal format containing the format name, a Full bitmask, and a Caveat bitmask.
Java resolves each cell in this order:
- Full bit present:
Full. - Otherwise Caveat bit present:
Caveat. - Otherwise:
None.
This preserves the backend's current precedence and keeps the raw JSON reasonably small.
Android UI
Each backend section keeps its existing verdict, renderer string, and check table. A new Format capabilities subsection follows it.
- Each of the 11 texture targets and
Renderbufferis a separate, initially collapsed table. - Target headers can be expanded independently.
- Table content is created on expansion and removed when collapsed, preventing the activity from retaining roughly 27,000 status views.
- Each expanded table is placed in a horizontal scroll container.
- The first column contains internal-format names. The remaining columns use the ordered capability names from the JSON report.
- Every status cell displays its status text and uses the conventional color mapping:
Full: green background with white text.Caveat: yellow background with black text.None: red background with white text.
- Header and format-name cells use neutral dark backgrounds consistent with the existing POST theme.
- The existing raw-report toggle remains available at the end of the screen.
Performance and Lifecycle
- The existing single-flight native POST and cached JSON behavior remains unchanged.
- Format tables are lazily materialized and discarded on collapse.
- The JSON carries bitmasks rather than repeated
Full,Caveat, andNonestrings. - Existing configuration-change handling remains unchanged.
Validation
- Run focused source checks and
git diff --check. - Build the Android plugin APK with the repository's current Gradle workflow.
- If an Android target is connected, install the APK and open
PostActivity. - Verify both backend sections, all target toggles, horizontal scrolling, visible cell text, and the green/yellow/red mapping.
- Confirm collapsing a table removes its generated content and expanding it recreates the same values.
Non-Goals
- Changing the meanings of
Full,Caveat, orNone. - Changing POST verdict rules.
- Displaying sample-count vectors in this iteration.
- Replacing the existing platform-view UI with Compose, AppCompat, or WebView.