mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 21:58:31 +09:00
[Feat] (MG_Backend, android-plugin): show format capability tables in POST
This commit is contained in:
@@ -525,6 +525,9 @@ namespace MobileGL::MG_Util::SelfTest {
|
||||
summary.capsValid = true;
|
||||
const MG_External::GLESCapabilities& caps = summary.caps;
|
||||
builder.report.rendererInfo = format("{} ({})", caps.GLESRendererString, caps.GLESVersionString);
|
||||
builder.report.formatCapabilities.emplace();
|
||||
MG_Backend::DirectGLES::PopulateFormatCapabilities(
|
||||
glesFuncs, caps, builder.report.formatCapabilities.value());
|
||||
EvaluateGlesChecklist(builder, caps, glesFuncs);
|
||||
ProbeGlesTimerQuery(builder, caps, glesFuncs);
|
||||
} while (false);
|
||||
@@ -980,6 +983,9 @@ namespace MobileGL::MG_Util::SelfTest {
|
||||
getInstanceProcAddr(instance, "vkGetPhysicalDeviceFeatures2"));
|
||||
const auto vkGetPhysicalDeviceProperties2Fn = reinterpret_cast<PFN_vkGetPhysicalDeviceProperties2>(
|
||||
getInstanceProcAddr(instance, "vkGetPhysicalDeviceProperties2"));
|
||||
const auto vkGetPhysicalDeviceFormatPropertiesFn =
|
||||
reinterpret_cast<PFN_vkGetPhysicalDeviceFormatProperties>(
|
||||
getInstanceProcAddr(instance, "vkGetPhysicalDeviceFormatProperties"));
|
||||
|
||||
// The instance is destroyed from a scope guard so it is released on every early-return
|
||||
// path and even if a String/format allocation throws while report rows are being built.
|
||||
@@ -1059,6 +1065,14 @@ namespace MobileGL::MG_Util::SelfTest {
|
||||
summary.deviceName = String(properties.deviceName);
|
||||
summary.apiVersionString = VkApiVersionToString(properties.apiVersion);
|
||||
summary.driverVersionString = driverVersionString;
|
||||
if (vkGetPhysicalDeviceFormatPropertiesFn != nullptr) {
|
||||
MG_External::VulkanCapabilities formatProbeCapabilities{};
|
||||
BackendLoader::FillInVulkanCapabilities(formatProbeCapabilities, properties);
|
||||
builder.report.formatCapabilities.emplace();
|
||||
MG_Backend::DirectVulkan::PopulateFormatCapabilities(
|
||||
physicalDevice, vkGetPhysicalDeviceFormatPropertiesFn, formatProbeCapabilities,
|
||||
builder.report.formatCapabilities.value());
|
||||
}
|
||||
|
||||
// The chosen-device facts (name, enumeration count, graphics queue) ride along
|
||||
// on both outcomes so the device API verdict never hides them.
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
#include <Includes.h>
|
||||
#include <MG_Backend/BackendObject.h>
|
||||
|
||||
namespace MobileGL::MG_Util::SelfTest {
|
||||
// One row of a backend power-on self-test (POST) report.
|
||||
@@ -33,6 +34,7 @@ namespace MobileGL::MG_Util::SelfTest {
|
||||
String verdict = "UNSUPPORTED"; // "OK" | "DEGRADED" | "UNSUPPORTED"
|
||||
String rendererInfo;
|
||||
Vector<PostCheck> checks;
|
||||
Optional<MG_Backend::FormatCapabilityCache> formatCapabilities;
|
||||
};
|
||||
|
||||
// Probes the DEVICE GLES driver with self-contained EGL boilerplate (1x1 pbuffer
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#ifdef __ANDROID__
|
||||
|
||||
#include "DriverPost.h"
|
||||
#include <MG_Util/Converters/MGToStr/TextureEnumConverter.h>
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
@@ -19,6 +20,9 @@ namespace {
|
||||
using MobileGL::SizeT;
|
||||
using MobileGL::String;
|
||||
using MobileGL::StringStream;
|
||||
using MobileGL::Uint64;
|
||||
using MobileGL::MG_Backend::FormatCapabilityCache;
|
||||
using MobileGL::MG_Backend::FormatCapabilityFlags;
|
||||
using MobileGL::MG_Util::SelfTest::BackendPostReport;
|
||||
using MobileGL::MG_Util::SelfTest::PostCheck;
|
||||
|
||||
@@ -70,6 +74,55 @@ namespace {
|
||||
out << '"' << EscapeJsonString(value) << '"';
|
||||
}
|
||||
|
||||
Uint64 BuildFormatCapabilityMask(FormatCapabilityFlags capabilities) {
|
||||
Uint64 mask = 0;
|
||||
for (SizeT capabilityIndex = 0;
|
||||
capabilityIndex < MobileGL::MG_Backend::kReportedFormatCapabilities.size(); ++capabilityIndex) {
|
||||
if (MobileGL::MG_Backend::HasFormatCapability(
|
||||
capabilities, MobileGL::MG_Backend::kReportedFormatCapabilities[capabilityIndex])) {
|
||||
mask |= 1ull << capabilityIndex;
|
||||
}
|
||||
}
|
||||
return mask;
|
||||
}
|
||||
|
||||
void AppendFormatCapabilitiesJson(StringStream& out, const FormatCapabilityCache& cache) {
|
||||
out << ",\"formatCapabilities\":{\"capabilities\":[";
|
||||
for (SizeT capabilityIndex = 0;
|
||||
capabilityIndex < MobileGL::MG_Backend::kReportedFormatCapabilities.size(); ++capabilityIndex) {
|
||||
if (capabilityIndex != 0) {
|
||||
out << ',';
|
||||
}
|
||||
AppendJsonString(
|
||||
out, MobileGL::MG_Backend::GetFormatCapabilityName(
|
||||
MobileGL::MG_Backend::kReportedFormatCapabilities[capabilityIndex]));
|
||||
}
|
||||
out << "],\"targets\":[";
|
||||
for (SizeT targetIndex = 0; targetIndex < MobileGL::MG_Backend::kFormatCapabilityTargetCount;
|
||||
++targetIndex) {
|
||||
if (targetIndex != 0) {
|
||||
out << ',';
|
||||
}
|
||||
out << "{\"name\":";
|
||||
AppendJsonString(out, MobileGL::MG_Backend::GetFormatCapabilityTargetName(targetIndex));
|
||||
out << ",\"rows\":[";
|
||||
for (SizeT formatIndex = 0; formatIndex < MobileGL::MG_Backend::kFormatCapabilityFormatCount;
|
||||
++formatIndex) {
|
||||
if (formatIndex != 0) {
|
||||
out << ',';
|
||||
}
|
||||
out << '[';
|
||||
AppendJsonString(
|
||||
out, MobileGL::MG_Util::ConvertTextureInternalFormatToString(
|
||||
static_cast<MobileGL::TextureInternalFormat>(formatIndex)));
|
||||
out << ',' << BuildFormatCapabilityMask(cache.FullCaps[targetIndex][formatIndex]);
|
||||
out << ',' << BuildFormatCapabilityMask(cache.CaveatCaps[targetIndex][formatIndex]) << ']';
|
||||
}
|
||||
out << "]}";
|
||||
}
|
||||
out << "]}";
|
||||
}
|
||||
|
||||
void AppendBackendReportJson(StringStream& out, const BackendPostReport& report) {
|
||||
out << "{\"available\":" << (report.available ? "true" : "false");
|
||||
out << ",\"verdict\":";
|
||||
@@ -90,7 +143,11 @@ namespace {
|
||||
AppendJsonString(out, check.detail);
|
||||
out << '}';
|
||||
}
|
||||
out << "]}";
|
||||
out << ']';
|
||||
if (report.formatCapabilities.has_value()) {
|
||||
AppendFormatCapabilitiesJson(out, report.formatCapabilities.value());
|
||||
}
|
||||
out << '}';
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
||||
Reference in New Issue
Block a user