mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-29 20:52:16 +09:00
[Refactor] (android-plugin/app, MG_Util/SelfTest): simplify Android controls and driver diagnostics
This commit is contained in:
1 parent
0059ccdd79
commit
adfed91a1e
6 files changed
+352
-499
No files matched your search
@@ -1701,18 +1701,13 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
namespace {
|
namespace {
|
||||||
Optional<DriverBugFinding> ProbeLayeredBlitDestinationBug(const GLESFunctionsTable& gl) {
|
Optional<DriverBugFinding> ProbeLayeredBlitDestinationBug(const GLESFunctionsTable& gl) {
|
||||||
if (!BlitIgnoresDestinationArrayLayer(gl)) return std::nullopt;
|
if (!BlitIgnoresDestinationArrayLayer(gl)) return std::nullopt;
|
||||||
return DriverBugFinding{"glBlitFramebuffer ignores the destination array layer", DriverBugVerdict::Fixed,
|
return DriverBugFinding{
|
||||||
"a glBlitFramebuffer whose DRAW framebuffer attaches a non-zero array layer with "
|
"glBlitFramebuffer ignores the destination array layer", DriverBugVerdict::Fixed,
|
||||||
"glFramebufferTextureLayer writes to layer 0 instead, and raises no error doing "
|
"Blits silently write to array layer zero when a different destination layer "
|
||||||
"it. Measured here on the color aspect; the depth aspect behaves the same way on "
|
"is attached. The probe confirms this for color, and the same behavior has been "
|
||||||
"the device this was characterized on. The layer is honored everywhere else on "
|
"observed for depth. Source-layer selection works. MobileGL uses "
|
||||||
"the same driver - the blit's own SOURCE layer is read correctly, which is this "
|
"glCopyImageSubData for compatible color, depth and stencil blits. The driver "
|
||||||
"probe's control - so neither layered attachments nor blitting is withdrawn. "
|
"still handles scaling, flipping, format conversion, resolves and scissor clipping."};
|
||||||
"MobileGL performs such a blit with glCopyImageSubData instead, which takes the "
|
|
||||||
"destination layer explicitly and honors it here, and applies that substitute to "
|
|
||||||
"the depth and stencil aspects as well; a blit that scales, flips, changes format, "
|
|
||||||
"resolves samples or is clipped by the scissor cannot be expressed as a copy and "
|
|
||||||
"is still handed to the driver"};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===================== EXPLICIT VERTEX INPUT LOCATION CEILING =====================
|
// ===================== EXPLICIT VERTEX INPUT LOCATION CEILING =====================
|
||||||
@@ -2544,130 +2539,99 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
Optional<DriverBugFinding> ProbeExplicitVertexInputLocationCeilingBug(const GLESFunctionsTable& gl) {
|
Optional<DriverBugFinding> ProbeExplicitVertexInputLocationCeilingBug(const GLESFunctionsTable& gl) {
|
||||||
const VertexInputLocationCeilingMeasurement& measurement = ExplicitVertexInputLocationCeiling(gl);
|
const VertexInputLocationCeilingMeasurement& measurement = ExplicitVertexInputLocationCeiling(gl);
|
||||||
if (!measurement.detected) return std::nullopt;
|
if (!measurement.detected) return std::nullopt;
|
||||||
String detail = format("GL_MAX_VERTEX_ATTRIBS is {} but the ESSL compiler refuses "
|
String detail = format("The driver advertises {} vertex inputs, but the ESSL compiler rejects explicit "
|
||||||
"layout(location = N) on a vertex input for every N at or above {} - so {} of "
|
"locations at or above {}.",
|
||||||
"the {} attributes advertised cannot be declared at all",
|
measurement.advertisedMaxVertexAttribs, measurement.usableLocations);
|
||||||
measurement.advertisedMaxVertexAttribs, measurement.usableLocations,
|
|
||||||
measurement.advertisedMaxVertexAttribs - measurement.usableLocations,
|
|
||||||
measurement.advertisedMaxVertexAttribs);
|
|
||||||
if (!measurement.driverMessage.empty()) {
|
if (!measurement.driverMessage.empty()) {
|
||||||
detail += format(" - the driver says \"{}\"", measurement.driverMessage);
|
detail += format(" The driver reported \"{}\".", measurement.driverMessage);
|
||||||
}
|
}
|
||||||
detail += measurement.bindAttribLocationReachesAdvertisedMax
|
detail += measurement.bindAttribLocationReachesAdvertisedMax
|
||||||
? format(". The same driver ACCEPTS glBindAttribLocation({}) on an unqualified "
|
? format(" glBindAttribLocation can still bind an unqualified input at location {}.",
|
||||||
"input and resolves it correctly, so the attributes are there and only "
|
|
||||||
"the layout qualifier is capped",
|
|
||||||
measurement.advertisedMaxVertexAttribs - 1)
|
measurement.advertisedMaxVertexAttribs - 1)
|
||||||
: ". glBindAttribLocation does not reach those locations either, so the "
|
: " glBindAttribLocation cannot reach the highest advertised location either.";
|
||||||
"attributes appear genuinely absent rather than merely unspellable";
|
detail += format(" MobileGL reports {} usable locations because it emits explicit locations.",
|
||||||
detail += format(". MobileGL emits its vertex inputs as layout qualifiers, so it advertises the "
|
measurement.usableLocations);
|
||||||
"{} locations it can actually deliver rather than the {} the driver claims. An "
|
|
||||||
"application asking for more used to be handed a count it could not build a "
|
|
||||||
"shader against, which failed at the stage compile with no way back",
|
|
||||||
measurement.usableLocations, measurement.advertisedMaxVertexAttribs);
|
|
||||||
return DriverBugFinding{"Vertex input layout(location) capped below GL_MAX_VERTEX_ATTRIBS",
|
return DriverBugFinding{"Vertex input layout(location) capped below GL_MAX_VERTEX_ATTRIBS",
|
||||||
DriverBugVerdict::Fixed, Move(detail)};
|
DriverBugVerdict::Fixed, Move(detail)};
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<DriverBugFinding> ProbeGeometryWriteAfterEmitBug(const GLESFunctionsTable& gl) {
|
Optional<DriverBugFinding> ProbeGeometryWriteAfterEmitBug(const GLESFunctionsTable& gl) {
|
||||||
if (!GeometryStageSsboWriteAfterEmitDropped(gl)) return std::nullopt;
|
if (!GeometryStageSsboWriteAfterEmitDropped(gl)) return std::nullopt;
|
||||||
String detail = "the driver silently discards shader storage buffer writes a geometry shader "
|
String detail = "The driver drops geometry shader storage writes after the last vertex emission. "
|
||||||
"issues after its last EmitVertex()/EndPrimitive(); the identical write issued "
|
"Writes before emission succeed for points and triangles. ";
|
||||||
"BEFORE the emit lands, for both point and triangle geometry shaders. ";
|
|
||||||
// The repair follows the knob, so the row describes what this process does.
|
// The repair follows the knob, so the row describes what this process does.
|
||||||
if (MG_Config::Features.EsprytDeferGeometryEmits == MG_Config::QuirkOverride::ForceOff) {
|
if (MG_Config::Features.EsprytDeferGeometryEmits == MG_Config::QuirkOverride::ForceOff) {
|
||||||
detail += "THE REPAIR IS DISABLED in this process (MOBILEGL_ESPRYT_DEFER_GEOMETRY_EMITS), so a "
|
detail += "MOBILEGL_ESPRYT_DEFER_GEOMETRY_EMITS disables the workaround in this process.";
|
||||||
"geometry shader that writes after emitting loses those writes";
|
|
||||||
return DriverBugFinding{"Geometry-stage storage writes after EmitVertex", DriverBugVerdict::Unfixable,
|
return DriverBugFinding{"Geometry-stage storage writes after EmitVertex", DriverBugVerdict::Unfixable,
|
||||||
Move(detail)};
|
Move(detail)};
|
||||||
}
|
}
|
||||||
detail += "DirectGLES defers every EmitVertex()/EndPrimitive() of a geometry stage that writes "
|
detail += "DirectGLES saves vertex outputs and replays emission after the shader finishes. "
|
||||||
"memory: the outputs are snapshotted at each emit and the vertices replayed after the "
|
"MOBILEGL_ESPRYT_DEFER_GEOMETRY_EMITS controls this workaround.";
|
||||||
"shader body returns (DeferGeometryEmitsPass), so every write lands before any emit; "
|
|
||||||
"override with MOBILEGL_ESPRYT_DEFER_GEOMETRY_EMITS";
|
|
||||||
return DriverBugFinding{"Geometry-stage storage writes after EmitVertex", DriverBugVerdict::Fixed,
|
return DriverBugFinding{"Geometry-stage storage writes after EmitVertex", DriverBugVerdict::Fixed,
|
||||||
Move(detail)};
|
Move(detail)};
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<DriverBugFinding> ProbeStaleSharedMemoryLoadBug(const GLESFunctionsTable& gl) {
|
Optional<DriverBugFinding> ProbeStaleSharedMemoryLoadBug(const GLESFunctionsTable& gl) {
|
||||||
if (!SharedMemoryLoadsGoStale(gl)) return std::nullopt;
|
if (!SharedMemoryLoadsGoStale(gl)) return std::nullopt;
|
||||||
String detail = "the ES compiler treats ordinary loads from shared variables as pure: two reads of one "
|
String detail = "Ordinary shared-memory reads can reuse stale values across barrier() or "
|
||||||
"shared word separated by a store and barrier() (memoryBarrierShared() too) return the "
|
"memoryBarrierShared() and can move past a later store. Atomic reads stay ordered. ";
|
||||||
"first value, and a read can move past a later store; atomicAdd(x, 0u) reads of the same "
|
|
||||||
"words stay in place. ";
|
|
||||||
if (MG_Config::Features.EsprytAtomicSubgroupScratch == MG_Config::QuirkOverride::ForceOff) {
|
if (MG_Config::Features.EsprytAtomicSubgroupScratch == MG_Config::QuirkOverride::ForceOff) {
|
||||||
detail += "THE REPAIR IS DISABLED in this process (MOBILEGL_ESPRYT_ATOMIC_SUBGROUP_SCRATCH), so "
|
detail += "MOBILEGL_ESPRYT_ATOMIC_SUBGROUP_SCRATCH disables the workaround, so emulated subgroup "
|
||||||
"an emulated subgroup operation can see the lanes of an earlier one";
|
"operations can read values from earlier operations.";
|
||||||
return DriverBugFinding{"Shared-memory loads go stale across barrier()", DriverBugVerdict::Unfixable,
|
return DriverBugFinding{"Shared-memory loads go stale across barrier()", DriverBugVerdict::Unfixable,
|
||||||
Move(detail)};
|
Move(detail)};
|
||||||
}
|
}
|
||||||
detail += "DirectGLES's subgroup emulation reads its workgroup scratch through atomic loads "
|
detail += "DirectGLES uses atomic reads for emulated subgroup scratch. Application shared-memory code "
|
||||||
"(EmulateSubgroupsPass), so emulated subgroup operations see every lane's current value; "
|
"runs as written. MOBILEGL_ESPRYT_ATOMIC_SUBGROUP_SCRATCH controls this workaround.";
|
||||||
"an application's own shared-memory code is passed through as written; override with "
|
|
||||||
"MOBILEGL_ESPRYT_ATOMIC_SUBGROUP_SCRATCH";
|
|
||||||
return DriverBugFinding{"Shared-memory loads go stale across barrier()", DriverBugVerdict::Fixed,
|
return DriverBugFinding{"Shared-memory loads go stale across barrier()", DriverBugVerdict::Fixed,
|
||||||
Move(detail)};
|
Move(detail)};
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<DriverBugFinding> ProbeEmptyImageUnitBug(const GLESFunctionsTable& gl) {
|
Optional<DriverBugFinding> ProbeEmptyImageUnitBug(const GLESFunctionsTable& gl) {
|
||||||
if (!EmptyImageUnitsReadNonzero(gl)) return std::nullopt;
|
if (!EmptyImageUnitsReadNonzero(gl)) return std::nullopt;
|
||||||
String detail = "a load through an image unit with no texture bound returns alpha 1 where GL 4.6 8.26 "
|
String detail =
|
||||||
"says every channel is 0. ";
|
"An unbound image unit reads alpha 1. OpenGL 4.6 section 8.26 specifies zero in all channels. ";
|
||||||
if (MG_Config::Features.EsprytInvalidImagePlaceholder == MG_Config::QuirkOverride::ForceOff) {
|
if (MG_Config::Features.EsprytInvalidImagePlaceholder == MG_Config::QuirkOverride::ForceOff) {
|
||||||
detail += "THE REPAIR IS DISABLED in this process (MOBILEGL_ESPRYT_INVALID_IMAGE_PLACEHOLDER), so "
|
detail += "MOBILEGL_ESPRYT_INVALID_IMAGE_PLACEHOLDER disables the workaround in this process.";
|
||||||
"a load through an invalid image unit reads alpha 1";
|
|
||||||
return DriverBugFinding{"Empty image units read nonzero", DriverBugVerdict::Unfixable, Move(detail)};
|
return DriverBugFinding{"Empty image units read nonzero", DriverBugVerdict::Unfixable, Move(detail)};
|
||||||
}
|
}
|
||||||
detail += "DirectGLES binds an image unit whose texture lacks the bound level to a zeroed 1x1 texture "
|
detail += "DirectGLES substitutes a zeroed 1x1 texture of the bound image type when the level is missing. "
|
||||||
"of the bind's shape, so its loads read 0 (a store through that unit can still be read back "
|
"Texel zero can retain writes within the same pass. Unbound units stay empty. "
|
||||||
"through the same unit at texel 0 within one pass); a unit the application left empty stays "
|
"MOBILEGL_ESPRYT_INVALID_IMAGE_PLACEHOLDER controls this workaround.";
|
||||||
"empty; override with MOBILEGL_ESPRYT_INVALID_IMAGE_PLACEHOLDER";
|
|
||||||
return DriverBugFinding{"Empty image units read nonzero", DriverBugVerdict::Fixed, Move(detail)};
|
return DriverBugFinding{"Empty image units read nonzero", DriverBugVerdict::Fixed, Move(detail)};
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<DriverBugFinding> ProbeR32FMultisampleSwizzleBug(const GLESFunctionsTable& gl) {
|
Optional<DriverBugFinding> ProbeR32FMultisampleSwizzleBug(const GLESFunctionsTable& gl) {
|
||||||
if (!R32FMultisampleSwizzleCorrupted(gl)) return std::nullopt;
|
if (!R32FMultisampleSwizzleCorrupted(gl)) return std::nullopt;
|
||||||
return DriverBugFinding{"R32F multisample fetch through a swizzled alpha", DriverBugVerdict::Unfixable,
|
return DriverBugFinding{"R32F multisample fetch through a swizzled alpha", DriverBugVerdict::Unfixable,
|
||||||
"texelFetch() on an R32F GL_TEXTURE_2D_MULTISAMPLE texture whose "
|
"With a nondefault alpha swizzle, texelFetch reads uninitialized alpha for "
|
||||||
"GL_TEXTURE_SWIZZLE_A is not the default returns uninitialized memory - a "
|
"nonzero samples starting with the second such program in the context. "
|
||||||
"different value every run - for any sample index other than 0, from the SECOND "
|
"Sample zero, red-channel reads and the default swizzle work. R32F multisampling "
|
||||||
"such program in the context onward. The identical fetch with the default alpha "
|
"and swizzles remain available. Widening to RG32F would double storage."};
|
||||||
"swizzle, at sample index 0, or through .x instead of .w is correct, so neither "
|
|
||||||
"R32F multisample targets nor texture swizzles are withdrawn. No substitute was "
|
|
||||||
"adopted: widening every R32F multisample target to RG32F would sidestep it and "
|
|
||||||
"doubles multisample memory, which was declined. A shader that fetches a non-zero "
|
|
||||||
"sample through a swizzled alpha cannot be relied on here"};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<DriverBugFinding> ProbeImageLocationPerNameBug(const GLESFunctionsTable& gl) {
|
Optional<DriverBugFinding> ProbeImageLocationPerNameBug(const GLESFunctionsTable& gl) {
|
||||||
const ImageLocationBudgetMeasurement& measurement = ImageLocationPerNameBudget(gl);
|
const ImageLocationBudgetMeasurement& measurement = ImageLocationPerNameBudget(gl);
|
||||||
if (!measurement.detected) return std::nullopt;
|
if (!measurement.detected) return std::nullopt;
|
||||||
String detail = format("this driver's image-location budget is charged per distinct uniform NAME, not per "
|
String detail = format("The driver counts distinct image uniform names. With {} uniforms per stage "
|
||||||
"image unit: a vertex+geometry+fragment program declaring {} image uniform(s) per "
|
"across vertex, geometry and fragment stages, linking succeeds with {} shared "
|
||||||
"stage links when all three stages share one set of names ({} distinct) and is "
|
"names and fails with {} stage-specific names. Bindings, qualifiers and stores "
|
||||||
"rejected when each stage names its own copies ({} distinct), with the same "
|
"are identical.",
|
||||||
"bindings, the same qualifiers and the same stores either way",
|
|
||||||
measurement.perStageImageUniforms, measurement.controlDistinctNames,
|
measurement.perStageImageUniforms, measurement.controlDistinctNames,
|
||||||
measurement.subjectDistinctNames);
|
measurement.subjectDistinctNames);
|
||||||
if (!measurement.driverMessage.empty()) {
|
if (!measurement.driverMessage.empty()) {
|
||||||
detail += format(" - the driver says \"{}\"", measurement.driverMessage);
|
detail += format(" The driver reported \"{}\".", measurement.driverMessage);
|
||||||
}
|
}
|
||||||
detail += ". MobileGL names a repaired image uniform after the REPAIR rather than after the "
|
detail += " MobileGL shares the same uniform name across stages when they use the same image repair.";
|
||||||
"stage, so stages that use an image alike keep one shared name and stay merged; "
|
|
||||||
"applications never see the link failure";
|
|
||||||
return DriverBugFinding{"Image locations charged per uniform name", DriverBugVerdict::Fixed, Move(detail)};
|
return DriverBugFinding{"Image locations charged per uniform name", DriverBugVerdict::Fixed, Move(detail)};
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<DriverBugFinding> ProbeCrossStageImageQualifierMergeBug(const GLESFunctionsTable& gl) {
|
Optional<DriverBugFinding> ProbeCrossStageImageQualifierMergeBug(const GLESFunctionsTable& gl) {
|
||||||
if (!CrossStageImageQualifierMergeDropsWrites(gl)) return std::nullopt;
|
if (!CrossStageImageQualifierMergeDropsWrites(gl)) return std::nullopt;
|
||||||
return DriverBugFinding{"Cross-stage image qualifier merge discards writes", DriverBugVerdict::Fixed,
|
return DriverBugFinding{"Cross-stage image qualifier merge discards writes", DriverBugVerdict::Fixed,
|
||||||
"an image declared `coherent writeonly` in one stage and `coherent readonly` in "
|
"The driver merges same-name coherent read-only and write-only images across "
|
||||||
"another under the SAME name is merged into one uniform whose writing stage's "
|
"stages and drops the stores. MobileGL gives the two uniforms distinct names, "
|
||||||
"imageStore()s are then silently discarded - every fragment reads the "
|
"which preserves the writes."};
|
||||||
"pre-store value. The identical shader pair with the two halves renamed keeps "
|
|
||||||
"every store, which is what proves the stage's image writes work and only the "
|
|
||||||
"merge is at fault. MobileGL renames the two halves (mg_imageWo_ / mg_imageRo_) so "
|
|
||||||
"the driver cannot merge them, and application behavior is correct"};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<DriverBugFinding> ProbeImageCoherencyResidualBug(const GLESFunctionsTable& gl) {
|
Optional<DriverBugFinding> ProbeImageCoherencyResidualBug(const GLESFunctionsTable& gl) {
|
||||||
@@ -2678,18 +2642,12 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
};
|
};
|
||||||
return DriverBugFinding{
|
return DriverBugFinding{
|
||||||
"Image write-to-read ordering within one invocation", DriverBugVerdict::Unfixable,
|
"Image write-to-read ordering within one invocation", DriverBugVerdict::Unfixable,
|
||||||
format("an imageLoad() does not observe the imageStore() that precedes it in the same "
|
format("An image read after a write in the same fragment invocation returned stale data for {} of {} "
|
||||||
"fragment invocation for {} of {} texels ({:.2f}%) under the STRONGEST shape "
|
"texels ({:.2f}%) even with coherent volatile declarations and both image and general memory "
|
||||||
"ESSL offers - a `coherent volatile` readonly/writeonly pair on one binding "
|
"barriers. "
|
||||||
"with both memoryBarrierImage() and memoryBarrier() between the store and the "
|
"MobileGL's coherent declarations and image barrier missed {} texels ({:.2f}%). "
|
||||||
"read - which is what leaves nothing to substitute. The shape MobileGL emits "
|
"Removing them caused all texels to fail. Separate draws synchronized with glMemoryBarrier "
|
||||||
"today (`coherent` plus memoryBarrierImage()) misses {} ({:.2f}%) on this "
|
"and glFinish read back every write.",
|
||||||
"driver. The same dependency split across two draws with a glMemoryBarrier and "
|
|
||||||
"a glFinish between them is clean, so writes do become visible; it is the "
|
|
||||||
"ordering inside one invocation that is not honored. MobileGL keeps the "
|
|
||||||
"coherent pair and the barrier - without them every texel is wrong - and a "
|
|
||||||
"shader that reads back its own image write within one invocation cannot be "
|
|
||||||
"relied on here",
|
|
||||||
measurement.mismatchedTexels, measurement.totalTexels, percentOf(measurement.mismatchedTexels),
|
measurement.mismatchedTexels, measurement.totalTexels, percentOf(measurement.mismatchedTexels),
|
||||||
measurement.emittedShapeMismatchedTexels, percentOf(measurement.emittedShapeMismatchedTexels))};
|
measurement.emittedShapeMismatchedTexels, percentOf(measurement.emittedShapeMismatchedTexels))};
|
||||||
}
|
}
|
||||||
@@ -2697,21 +2655,12 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
Optional<DriverBugFinding> ProbeLocatedIoBlockPayloadBug(const GLESFunctionsTable& gl) {
|
Optional<DriverBugFinding> ProbeLocatedIoBlockPayloadBug(const GLESFunctionsTable& gl) {
|
||||||
const LocatedIoBlockMeasurement& measurement = LocatedIoBlocksLosePayload(gl);
|
const LocatedIoBlockMeasurement& measurement = LocatedIoBlocksLosePayload(gl);
|
||||||
if (!measurement.detected) return std::nullopt;
|
if (!measurement.detected) return std::nullopt;
|
||||||
String detail = "an inter-stage interface block that carries an explicit layout(location = N) "
|
String detail = "With tessellation or geometry stages, an explicit interface block location causes "
|
||||||
"delivers NOTHING once a geometry (or tessellation) stage is in the pipeline: the "
|
"the consumer to read zeros even though compilation, linking and drawing succeed. "
|
||||||
"stages compile, the program links with an empty info log, the draw raises no "
|
"The payload arrives when the location qualifier is removed.";
|
||||||
"error, and the consuming stage reads zeroes. The byte-identical program with the "
|
|
||||||
"qualifier removed from the blocks carries its payload correctly, which is what "
|
|
||||||
"makes this a LOCATION defect rather than an interface-block one - blocks "
|
|
||||||
"themselves work here";
|
|
||||||
detail += measurement.alsoAffectsVertexToFragment
|
detail += measurement.alsoAffectsVertexToFragment
|
||||||
? ". A located block between a VERTEX and a FRAGMENT stage is lost on "
|
? " Located blocks also fail in vertex-to-fragment programs, outside the workaround's scope."
|
||||||
"this driver too, so the defect is wider than the repair below "
|
: " Located blocks work in vertex-to-fragment programs.";
|
||||||
"reaches: MobileGL only drops the qualifier for programs that have a "
|
|
||||||
"tessellation or geometry stage, and a located block in a plain "
|
|
||||||
"vertex+fragment program is still emitted as the application wrote it"
|
|
||||||
: ". A located block between a VERTEX and a FRAGMENT stage is delivered "
|
|
||||||
"correctly on the same driver, which is what scopes the repair";
|
|
||||||
// The repair can be switched off from the environment, and a report that said
|
// The repair can be switched off from the environment, and a report that said
|
||||||
// "Fixed" while the strip was disabled would be describing a build nobody is
|
// "Fixed" while the strip was disabled would be describing a build nobody is
|
||||||
// running. The verdict follows what this process will actually do, not what the
|
// running. The verdict follows what this process will actually do, not what the
|
||||||
@@ -2719,15 +2668,11 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
const Bool repairDisabled =
|
const Bool repairDisabled =
|
||||||
MG_Config::Features.EsprytUnlocatedIoBlocks == MG_Config::QuirkOverride::ForceOff;
|
MG_Config::Features.EsprytUnlocatedIoBlocks == MG_Config::QuirkOverride::ForceOff;
|
||||||
if (repairDisabled) {
|
if (repairDisabled) {
|
||||||
detail += ". THE REPAIR IS DISABLED in this process: MOBILEGL_ESPRYT_UNLOCATED_IO_BLOCKS "
|
detail += " MOBILEGL_ESPRYT_UNLOCATED_IO_BLOCKS forces the faulty qualifiers on. "
|
||||||
"is set to force located blocks ON, so DirectGLES emits the location "
|
"The workaround is inactive.";
|
||||||
"qualifier the driver cannot honor and the payload is lost. Unset the "
|
|
||||||
"variable to get the repair back";
|
|
||||||
} else {
|
} else {
|
||||||
detail += ". MobileGL emits a tessellation/geometry program's interface blocks with no "
|
detail += " MobileGL removes generated block locations in tessellation and geometry programs. "
|
||||||
"location qualifier at all (StripIoBlockLocationsPass) and lets ES match them "
|
"The driver then matches blocks by name and member order.";
|
||||||
"by block name and member sequence, which it does; the locations were invented "
|
|
||||||
"by the cross-stage IO resolver rather than written by the application";
|
|
||||||
}
|
}
|
||||||
return DriverBugFinding{"Located inter-stage interface blocks carry no payload",
|
return DriverBugFinding{"Located inter-stage interface blocks carry no payload",
|
||||||
(repairDisabled || measurement.alsoAffectsVertexToFragment)
|
(repairDisabled || measurement.alsoAffectsVertexToFragment)
|
||||||
@@ -2746,28 +2691,18 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
// its Auto default - which is also what the widening itself consults, so the row
|
// its Auto default - which is also what the widening itself consults, so the row
|
||||||
// and the behavior cannot disagree.
|
// and the behavior cannot disagree.
|
||||||
const Bool widened = MG_Config::Features.EsprytWidenPacked16Storage != MG_Config::QuirkOverride::ForceOff;
|
const Bool widened = MG_Config::Features.EsprytWidenPacked16Storage != MG_Config::QuirkOverride::ForceOff;
|
||||||
String detail = "the driver stores SOME 16-bit packed images (RGB565 / RGB5_A1 / RGBA4) with the "
|
String detail = "The driver reverses the packed fields of some RGB565, RGB5_A1 and RGBA4 allocations. "
|
||||||
"R/G/B/A fields packed from the other end of the word - which allocations get the "
|
"This depends on image shape and context history. The probe found it at all three levels "
|
||||||
"*_REV layout depends on shape and context history (measured here on a 30x30x12 "
|
"of a 30x30x12 array. A raw glCopyImageSubData between different layouts changed a "
|
||||||
"three-level 2D array, every level of it) - so a glCopyImageSubData, a raw "
|
"RGB5_A1 word from 0x0047 to 0x8C20. Uploads and readbacks within one image succeed. ";
|
||||||
"texel-block move, between a mirrored allocation and a plain one lands the fields "
|
|
||||||
"reversed (a 5551 word 0x0047 arrives as 0x8C20). Uploads and readbacks of the "
|
|
||||||
"same image are clean - the driver decodes its own layout consistently, which is "
|
|
||||||
"this probe's second control - so only the raw-copy path ever crosses the two "
|
|
||||||
"layouts. ";
|
|
||||||
if (widened) {
|
if (widened) {
|
||||||
detail += "MobileGL stores these three formats as 8-bit-per-channel ES storage on this "
|
detail += "MobileGL uses RGB8 or RGBA8 storage to preserve exact packed values at twice the "
|
||||||
"driver instead (GL_RGB8 / GL_RGBA8, the storage their canonical shadow "
|
"storage cost. MOBILEGL_ESPRYT_WIDEN_PACKED16_STORAGE controls storage widening.";
|
||||||
"already holds and the client word round-trips through exactly), so no "
|
|
||||||
"16-bit packed image is left for a copy to disagree about, at twice the "
|
|
||||||
"memory for images of those formats; override with "
|
|
||||||
"MOBILEGL_ESPRYT_WIDEN_PACKED16_STORAGE";
|
|
||||||
return DriverBugFinding{
|
return DriverBugFinding{
|
||||||
"glCopyImageSubData mirrors 16-bit packed texels between differently-laid-out images",
|
"glCopyImageSubData mirrors 16-bit packed texels between differently-laid-out images",
|
||||||
DriverBugVerdict::Fixed, detail};
|
DriverBugVerdict::Fixed, detail};
|
||||||
}
|
}
|
||||||
detail += "MOBILEGL_ESPRYT_WIDEN_PACKED16_STORAGE=0 keeps the native narrow storage, so such "
|
detail += "MOBILEGL_ESPRYT_WIDEN_PACKED16_STORAGE=0 keeps native storage and leaves raw copies affected.";
|
||||||
"copies are left exactly as the driver delivers them, mirrored words included";
|
|
||||||
return DriverBugFinding{
|
return DriverBugFinding{
|
||||||
"glCopyImageSubData mirrors 16-bit packed texels between differently-laid-out images",
|
"glCopyImageSubData mirrors 16-bit packed texels between differently-laid-out images",
|
||||||
DriverBugVerdict::Unfixable, detail};
|
DriverBugVerdict::Unfixable, detail};
|
||||||
@@ -2810,22 +2745,15 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
using namespace MG_Backend::DirectVulkan;
|
using namespace MG_Backend::DirectVulkan;
|
||||||
if (EvaluateWireDepthResolveProbe(measurement) != WireDepthResolveProbeVerdict::RenderPassResolveBroken)
|
if (EvaluateWireDepthResolveProbe(measurement) != WireDepthResolveProbeVerdict::RenderPassResolveBroken)
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
String detail =
|
String detail = "A draw-free SAMPLE_ZERO render pass leaves the resolve target unwritten. "
|
||||||
"a render pass whose subpass carries a VK_KHR_depth_stencil_resolve attachment (SAMPLE_ZERO) and "
|
"The shader control resolves the same 4x4, 4-sample images (depth 0.25 and stencil 0x5A "
|
||||||
"records no draw leaves its single-sample resolve target unwritten, while MobileGL's shader "
|
"over depth 0.75 and stencil 0xA5). ";
|
||||||
"resolve pass fed the same multisample inputs resolves them correctly - measured here on 4x4 "
|
|
||||||
"4-sample images cleared to depth 0.25 / stencil 0x5A over a depth 0.75 / stencil 0xA5 "
|
|
||||||
"sentinel: ";
|
|
||||||
detail += DescribeWireDepthResolveProbe(measurement);
|
detail += DescribeWireDepthResolveProbe(measurement);
|
||||||
detail += ". On the split, inproc and tcp transports a multisample depth/stencil resolve "
|
detail += ". Split, inproc and TCP transports try the sample-zero shader resolve first and use the "
|
||||||
"(glBlitFramebuffer out of a multisample framebuffer) therefore takes the shader pass "
|
"render pass for any aspect the shader cannot write. The monolith transport skips this pass.";
|
||||||
"first - sample 0 fetched and written through gl_FragDepth / gl_FragStencilRefARB - and "
|
|
||||||
"keeps the render pass only as the fallback for what the shader cannot write; the "
|
|
||||||
"monolith transport never records that render pass";
|
|
||||||
if (!shaderStencilExport) {
|
if (!shaderStencilExport) {
|
||||||
detail += ". THIS DEVICE HAS NO VK_EXT_shader_stencil_export, so a fragment shader cannot write "
|
detail += " Without VK_EXT_shader_stencil_export, the shader resolves depth only. Stencil still uses "
|
||||||
"the stencil aspect: a STENCIL resolve still falls back to the render pass and reads "
|
"the faulty render pass and remains unwritten.";
|
||||||
"back unwritten. Depth is repaired, stencil is not";
|
|
||||||
}
|
}
|
||||||
return DriverBugFinding{"Depth/stencil render-pass resolve writes nothing",
|
return DriverBugFinding{"Depth/stencil render-pass resolve writes nothing",
|
||||||
shaderStencilExport ? DriverBugVerdict::Fixed : DriverBugVerdict::Unfixable,
|
shaderStencilExport ? DriverBugVerdict::Fixed : DriverBugVerdict::Unfixable,
|
||||||
@@ -2865,14 +2793,13 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
MGLOG_I("Driver POST: E5B9G9R9 transfer probe verdict=%s: %s", WireE5TransferProbeVerdictName(verdict),
|
MGLOG_I("Driver POST: E5B9G9R9 transfer probe verdict=%s: %s", WireE5TransferProbeVerdictName(verdict),
|
||||||
DescribeWireE5TransferProbe(measurement).c_str());
|
DescribeWireE5TransferProbe(measurement).c_str());
|
||||||
if (verdict != WireE5TransferProbeVerdict::TransferReadNormalizes) return std::nullopt;
|
if (verdict != WireE5TransferProbeVerdict::TransferReadNormalizes) return std::nullopt;
|
||||||
String detail = "vkCmdCopyImageToBuffer out of a 30x30 VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 image returns "
|
String detail = "vkCmdCopyImageToBuffer changes the encoding of noncanonical E5B9G9R9 texels in a "
|
||||||
"non-canonical shared-exponent words re-encoded (same value, different bits), while a "
|
"30x30 image without changing their values. A compute shader with an R32_UINT view "
|
||||||
"compute shader reading the same image through an R32_UINT view returns every stored "
|
"preserves the bits. ";
|
||||||
"word: ";
|
|
||||||
detail += DescribeWireE5TransferProbe(measurement);
|
detail += DescribeWireE5TransferProbe(measurement);
|
||||||
detail += ". GL moves RGB9_E5 blocks bit-exactly (glGetTexImage with UNSIGNED_INT_5_9_9_9_REV, "
|
detail += ". Magma copies an R32_UINT intermediate to preserve RGB9_E5 bits during packed "
|
||||||
"glCopyImageSubData), so Magma reads such textures through that shader into an R32_UINT "
|
"glGetTexImage readbacks and glCopyImageSubData copies. "
|
||||||
"twin and copies the twin instead (MOBILEGL_MAGMA_E5_RAW_READS=0 turns it off)";
|
"MOBILEGL_MAGMA_E5_RAW_READS=0 disables the intermediate.";
|
||||||
return DriverBugFinding{"E5B9G9R9 transfer reads canonicalize shared exponents", DriverBugVerdict::Fixed,
|
return DriverBugFinding{"E5B9G9R9 transfer reads canonicalize shared exponents", DriverBugVerdict::Fixed,
|
||||||
Move(detail)};
|
Move(detail)};
|
||||||
}
|
}
|
||||||
@@ -2888,12 +2815,11 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
MGLOG_I("Driver POST: slice copy probe verdict=%s: %s", WireCopySliceProbeVerdictName(verdict),
|
MGLOG_I("Driver POST: slice copy probe verdict=%s: %s", WireCopySliceProbeVerdictName(verdict),
|
||||||
DescribeWireCopySliceProbe(measurement).c_str());
|
DescribeWireCopySliceProbe(measurement).c_str());
|
||||||
if (verdict != WireCopySliceProbeVerdict::CrossFormatSlicesDropped) return std::nullopt;
|
if (verdict != WireCopySliceProbeVerdict::CrossFormatSlicesDropped) return std::nullopt;
|
||||||
String detail =
|
String detail = "A vkCmdCopyImage region between a 2D array and a 3D image of different "
|
||||||
"a vkCmdCopyImage region between a 2D array and a 3D image of DIFFERENT (size-compatible) "
|
"size-compatible formats copies only the first slice. One region per slice works. ";
|
||||||
"formats moves only its first slice, while the same copy as one region per slice is exact: ";
|
|
||||||
detail += DescribeWireCopySliceProbe(measurement);
|
detail += DescribeWireCopySliceProbe(measurement);
|
||||||
detail += ". Magma splits such glCopyImageSubData calls one slice per region "
|
detail += ". Magma emits one region per slice for these glCopyImageSubData calls. "
|
||||||
"(MOBILEGL_MAGMA_SPLIT_SLICE_COPIES=0 turns it off)";
|
"MOBILEGL_MAGMA_SPLIT_SLICE_COPIES=0 disables this split.";
|
||||||
return DriverBugFinding{"Cross-format 2D-array <-> 3D image copies drop slices", DriverBugVerdict::Fixed,
|
return DriverBugFinding{"Cross-format 2D-array <-> 3D image copies drop slices", DriverBugVerdict::Fixed,
|
||||||
Move(detail)};
|
Move(detail)};
|
||||||
}
|
}
|
||||||
@@ -2909,12 +2835,11 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
MGLOG_I("Driver POST: discard state probe verdict=%s: %s", WireDiscardStateProbeVerdictName(verdict),
|
MGLOG_I("Driver POST: discard state probe verdict=%s: %s", WireDiscardStateProbeVerdictName(verdict),
|
||||||
DescribeWireDiscardStateProbe(measurement).c_str());
|
DescribeWireDiscardStateProbe(measurement).c_str());
|
||||||
if (verdict != WireDiscardStateProbeVerdict::DiscardDrawDropsState) return std::nullopt;
|
if (verdict != WireDiscardStateProbeVerdict::DiscardDrawDropsState) return std::nullopt;
|
||||||
String detail =
|
String detail = "A rasterizer-discard draw drops the dynamic viewport and scissor state. The next "
|
||||||
"a draw with a rasterizerDiscardEnable pipeline drops the dynamic viewport/scissor, so a later "
|
"draw produces no fragments if it inherits that state. ";
|
||||||
"draw that inherits them draws nothing, while after a rasterizing draw it does: ";
|
|
||||||
detail += DescribeWireDiscardStateProbe(measurement);
|
detail += DescribeWireDiscardStateProbe(measurement);
|
||||||
detail += ". Magma sets the dynamic state again after every discard draw "
|
detail += ". Magma reissues viewport and scissor state after each discard draw. "
|
||||||
"(MOBILEGL_MAGMA_REEMIT_STATE_AFTER_DISCARD=0 turns it off)";
|
"MOBILEGL_MAGMA_REEMIT_STATE_AFTER_DISCARD=0 disables state reissue.";
|
||||||
return DriverBugFinding{"Rasterizer-discard draws drop dynamic viewport/scissor", DriverBugVerdict::Fixed,
|
return DriverBugFinding{"Rasterizer-discard draws drop dynamic viewport/scissor", DriverBugVerdict::Fixed,
|
||||||
Move(detail)};
|
Move(detail)};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,13 +65,10 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
String AppendFp64AdvertisementNote(String detail) {
|
String AppendFp64AdvertisementNote(String detail) {
|
||||||
if (MG_Config::Features.AdvertiseFp64) {
|
if (MG_Config::Features.AdvertiseFp64) {
|
||||||
return Move(detail) +
|
return Move(detail) +
|
||||||
". GL_ARB_gpu_shader_fp64 IS advertised (MOBILEGL_ADVERTISE_FP64): an application "
|
". MOBILEGL_ADVERTISE_FP64 enables GL_ARB_gpu_shader_fp64. Full precision requires native fp64.";
|
||||||
"that checks the string will believe it has 64-bit precision, which is true only "
|
|
||||||
"where the row above says native";
|
|
||||||
}
|
}
|
||||||
return Move(detail) +
|
return Move(detail) +
|
||||||
". GL_ARB_gpu_shader_fp64 is not advertised by default; set MOBILEGL_ADVERTISE_FP64=1 "
|
". GL_ARB_gpu_shader_fp64 is hidden by default. MOBILEGL_ADVERTISE_FP64 controls exposure.";
|
||||||
"to advertise it anyway";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===================== THE ROW VERDICT TAXONOMY =====================
|
// ===================== THE ROW VERDICT TAXONOMY =====================
|
||||||
@@ -622,19 +619,11 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
// fp64 directly at all. What it has is a complete substitute - the shaders build and
|
// fp64 directly at all. What it has is a complete substitute - the shaders build and
|
||||||
// run - which is exactly what WARN means.
|
// run - which is exactly what WARN means.
|
||||||
builder.Warn("fp64", AppendFp64AdvertisementNote(
|
builder.Warn("fp64", AppendFp64AdvertisementNote(
|
||||||
"demoted to fp32 - ESSL has no 64-bit float type, so every double / "
|
"ESSL has no fp64 type. MobileGL narrows shader values to fp32 and recalculates "
|
||||||
"dvec / dmat in a shader is narrowed to 32 bits before transpilation "
|
"buffer block layouts."));
|
||||||
"(DemoteFloat64Pass). Such shaders COMPILE AND RUN, at single "
|
|
||||||
"precision; a block containing a double is re-laid-out for the "
|
|
||||||
"narrowed members, so an application that hard-codes std140 offsets "
|
|
||||||
"computed for doubles must query them instead"));
|
|
||||||
builder.Warn("64-bit vertex attributes",
|
builder.Warn("64-bit vertex attributes",
|
||||||
"narrowed to float32 (ES has no GL_DOUBLE vertex format, and after the fp64 "
|
"MobileGL converts GL_DOUBLE vertex arrays to float32 at draw time. "
|
||||||
"demotion above there is no 64-bit shader input left to feed either); "
|
"glVertexAttribLFormat and glVertexArrayAttribLFormat retain their GL state.");
|
||||||
"glVertexAttribLFormat / glVertexArrayAttribLFormat succeed, their state is "
|
|
||||||
"queryable, and an ENABLED 64-bit array IS fetched - the source doubles are "
|
|
||||||
"deinterleaved into a float32 stream at draw, so values outside float32's "
|
|
||||||
"range or precision are rounded rather than exact");
|
|
||||||
if (glesFuncs.glPatchParameteri != nullptr) {
|
if (glesFuncs.glPatchParameteri != nullptr) {
|
||||||
builder.Pass("Tessellation patch parameters",
|
builder.Pass("Tessellation patch parameters",
|
||||||
"glPatchParameteri present (GL_PATCH_VERTICES reaches the driver)");
|
"glPatchParameteri present (GL_PATCH_VERTICES reaches the driver)");
|
||||||
@@ -669,10 +658,9 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
"SNORM render target keeps its own encoding instead of a float substitute)");
|
"SNORM render target keeps its own encoding instead of a float substitute)");
|
||||||
} else {
|
} else {
|
||||||
builder.Warn("GL_EXT_render_snorm",
|
builder.Warn("GL_EXT_render_snorm",
|
||||||
"not supported; signed-normalized formats are texture-only, so every SNORM "
|
"The driver cannot render to signed-normalized formats. MobileGL stores 8-bit SNORM "
|
||||||
"render target is stored as a float (8-bit -> *16F, 16-bit -> *32F, which "
|
"channels as 16-bit floats and 16-bit SNORM channels as 32-bit floats to preserve "
|
||||||
"is the narrowest float that still holds a 16-bit SNORM channel exactly) "
|
"precision. MobileGL clamps fragment outputs between -1 and 1.");
|
||||||
"and its fragment outputs are clamped to [-1,1] in software");
|
|
||||||
}
|
}
|
||||||
// FAIL, not WARN: ES 3.x core makes every float format texture-only, and every Iris
|
// FAIL, not WARN: ES 3.x core makes every float format texture-only, and every Iris
|
||||||
// shaderpack renders into at least GL_R11F_G11F_B10F (Complementary's colortex0, BSL's
|
// shaderpack renders into at least GL_R11F_G11F_B10F (Complementary's colortex0, BSL's
|
||||||
@@ -680,8 +668,7 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
// is not renderable either - so shaderpacks cannot work at all on such a driver.
|
// is not renderable either - so shaderpacks cannot work at all on such a driver.
|
||||||
if (caps.SupportsColorBufferFloat) {
|
if (caps.SupportsColorBufferFloat) {
|
||||||
builder.Pass("GL_EXT_color_buffer_float",
|
builder.Pass("GL_EXT_color_buffer_float",
|
||||||
"supported (GL_R11F_G11F_B10F / GL_RGBA16F / GL_RGBA32F are "
|
"GL_R11F_G11F_B10F, GL_RGBA16F, and GL_RGBA32F are color-renderable.");
|
||||||
"color-renderable, which is what every shaderpack renders into)");
|
|
||||||
} else if (caps.SupportsColorBufferHalfFloat) {
|
} else if (caps.SupportsColorBufferHalfFloat) {
|
||||||
builder.Warn("GL_EXT_color_buffer_float",
|
builder.Warn("GL_EXT_color_buffer_float",
|
||||||
"not supported, but GL_EXT_color_buffer_half_float is; 16-bit float render "
|
"not supported, but GL_EXT_color_buffer_half_float is; 16-bit float render "
|
||||||
@@ -689,9 +676,8 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
"that lands on it) do not");
|
"that lands on it) do not");
|
||||||
} else {
|
} else {
|
||||||
builder.Fail("GL_EXT_color_buffer_float",
|
builder.Fail("GL_EXT_color_buffer_float",
|
||||||
"not supported, and neither is GL_EXT_color_buffer_half_float; no floating-point "
|
"Neither GL_EXT_color_buffer_float nor GL_EXT_color_buffer_half_float is available. "
|
||||||
"format is color-renderable on this driver, so no shaderpack can create its "
|
"The driver exposes no floating-point color-renderable format.");
|
||||||
"render targets (Iris reports GL_FRAMEBUFFER_UNSUPPORTED and refuses to load)");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// WARN and never FAIL when it is absent: this is the HOST driver's ability to
|
// WARN and never FAIL when it is absent: this is the HOST driver's ability to
|
||||||
@@ -705,10 +691,9 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
builder.Pass("Driver GL_KHR_parallel_shader_compile",
|
builder.Pass("Driver GL_KHR_parallel_shader_compile",
|
||||||
"supported; the device driver can also compile the translated ESSL off-thread");
|
"supported; the device driver can also compile the translated ESSL off-thread");
|
||||||
} else {
|
} else {
|
||||||
builder.Warn("Driver GL_KHR_parallel_shader_compile",
|
builder.Warn(
|
||||||
"not supported; the device driver compiles the translated ESSL on the calling "
|
"Driver GL_KHR_parallel_shader_compile",
|
||||||
"thread. MobileGL's own compile pool substitutes for the expensive half of the "
|
"The driver compiles ESSL on the calling thread. MobileGL translates shaders in parallel.");
|
||||||
"work (GLSL -> SPIR-V -> ESSL) and is unaffected, so loads still overlap");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (caps.IndirectDrawInstanceIdIncludesBaseInstance) {
|
if (caps.IndirectDrawInstanceIdIncludesBaseInstance) {
|
||||||
@@ -733,11 +718,10 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
const MG_External::GLESFunctionsTable& glesFuncs) {
|
const MG_External::GLESFunctionsTable& glesFuncs) {
|
||||||
const String disabledNote = TimerQueryDisabledNote();
|
const String disabledNote = TimerQueryDisabledNote();
|
||||||
if (!caps.SupportsDisjointTimerQuery) {
|
if (!caps.SupportsDisjointTimerQuery) {
|
||||||
builder.FailOptional("Timer queries",
|
builder.FailOptional(
|
||||||
"GL_EXT_disjoint_timer_query not supported; there is no way to time "
|
"Timer queries",
|
||||||
"GPU work from the client, so glBeginQuery(GL_TIME_ELAPSED) has "
|
"GL_EXT_disjoint_timer_query is unavailable. MobileGL has no GL_TIME_ELAPSED fallback." +
|
||||||
"nothing to stand in for it and Minecraft's F3 GPU% will not show" +
|
disabledNote);
|
||||||
disabledNote);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Every emit carries the extension-presence fact the old standalone
|
// Every emit carries the extension-presence fact the old standalone
|
||||||
@@ -1091,7 +1075,7 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
MG_Util::TextureFormatProcessor::NormalizePixelFormat(
|
MG_Util::TextureFormatProcessor::NormalizePixelFormat(
|
||||||
MG_Util::ConvertTextureInternalFormatToGLEnum(probedFormat), renderTargetOptions,
|
MG_Util::ConvertTextureInternalFormatToGLEnum(probedFormat), renderTargetOptions,
|
||||||
&widenedInternalFormat, nullptr, nullptr);
|
&widenedInternalFormat, nullptr, nullptr);
|
||||||
append(widenedList, name + " -> " + MG_Util::ConvertGLEnumToString(widenedInternalFormat));
|
append(widenedList, name + " to " + MG_Util::ConvertGLEnumToString(widenedInternalFormat));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
append(unusableList, name);
|
append(unusableList, name);
|
||||||
@@ -1105,7 +1089,7 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
}
|
}
|
||||||
if (!unusableList.empty()) {
|
if (!unusableList.empty()) {
|
||||||
if (!detail.empty()) detail += "; ";
|
if (!detail.empty()) detail += "; ";
|
||||||
detail += "NOT renderable and not substitutable: " + unusableList;
|
detail += "not renderable and no substitute available: " + unusableList;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The verdict deliberately does NOT track "every probed format came out usable".
|
// The verdict deliberately does NOT track "every probed format came out usable".
|
||||||
@@ -1146,7 +1130,7 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
} else if (!widenedList.empty()) {
|
} else if (!widenedList.empty()) {
|
||||||
builder.Warn("Three-channel color attachments",
|
builder.Warn("Three-channel color attachments",
|
||||||
detail + " - the substitution costs the extra alpha channel's memory and is "
|
detail + " - the substitution costs the extra alpha channel's memory and is "
|
||||||
"hidden from the application by an ALPHA->ONE swizzle");
|
"hidden from the application by a swizzle that sets alpha to one");
|
||||||
} else {
|
} else {
|
||||||
builder.Pass("Three-channel color attachments", detail);
|
builder.Pass("Three-channel color attachments", detail);
|
||||||
}
|
}
|
||||||
@@ -1641,8 +1625,8 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
|
|
||||||
if (!HasVkExtension(deviceExtensions, VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME) ||
|
if (!HasVkExtension(deviceExtensions, VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME) ||
|
||||||
getFeatures2 == nullptr || getProperties2 == nullptr) {
|
getFeatures2 == nullptr || getProperties2 == nullptr) {
|
||||||
fail("VK_EXT_transform_feedback is unavailable, so the backend has no GPU counter for "
|
fail("Without VK_EXT_transform_feedback, the backend has no GPU counter for "
|
||||||
"GL_PRIMITIVES_GENERATED at all - with or without a capture");
|
"GL_PRIMITIVES_GENERATED, even during capture.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
VkPhysicalDeviceTransformFeedbackFeaturesEXT xfbFeatures{};
|
VkPhysicalDeviceTransformFeedbackFeaturesEXT xfbFeatures{};
|
||||||
@@ -1658,9 +1642,8 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
properties2.pNext = &xfbProperties;
|
properties2.pNext = &xfbProperties;
|
||||||
getProperties2(physicalDevice, &properties2);
|
getProperties2(physicalDevice, &properties2);
|
||||||
if (xfbFeatures.transformFeedback != VK_TRUE || xfbProperties.transformFeedbackQueries != VK_TRUE) {
|
if (xfbFeatures.transformFeedback != VK_TRUE || xfbProperties.transformFeedbackQueries != VK_TRUE) {
|
||||||
fail("the device has VK_EXT_transform_feedback but no usable stream queries "
|
fail("VK_EXT_transform_feedback does not provide usable stream queries on this device. "
|
||||||
"(transformFeedbackQueries = false); GL_PRIMITIVES_GENERATED and "
|
"GL_PRIMITIVES_GENERATED and GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN return 0.");
|
||||||
"GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN queries answer 0");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1810,33 +1793,33 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
// Before any return below: the guard above owns the device and must know.
|
// Before any return below: the guard above owns the device and must know.
|
||||||
probeFenceWaitTimedOut = measurement.fenceWaitTimedOut;
|
probeFenceWaitTimedOut = measurement.fenceWaitTimedOut;
|
||||||
if (!measurement.ran) {
|
if (!measurement.ran) {
|
||||||
fail(format("the probe could not run ({}); the renderer's bring-up probe decides the "
|
fail(format(
|
||||||
"reroute independently",
|
"The probe could not run ({}). The renderer tests independently whether to use a substitute.",
|
||||||
measurement.failureReason));
|
measurement.failureReason));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto shapeFacts = [](const char* name, const PrimitivesGeneratedNoXfbShapeMeasurement& shape) {
|
const auto shapeFacts = [](const char* name, const PrimitivesGeneratedNoXfbShapeMeasurement& shape) {
|
||||||
if (!shape.drawn) {
|
if (!shape.drawn) {
|
||||||
return format("{} not drawn (no tessellationShader)", name);
|
return format("The probe skipped {} because tessellationShader is unavailable.", name);
|
||||||
}
|
}
|
||||||
String facts = format("{}: stream answered {} of {} expected", name, shape.streamGenerated,
|
String facts = format("For {}, the stream query counted {} of {} expected primitives", name,
|
||||||
shape.expectedPrimitives);
|
shape.streamGenerated, shape.expectedPrimitives);
|
||||||
if (shape.primitivesGeneratedExtMeasured) {
|
if (shape.primitivesGeneratedExtMeasured) {
|
||||||
facts += format(", dedicated query answered {}", shape.primitivesGeneratedExt);
|
facts += format(", and the dedicated query counted {}", shape.primitivesGeneratedExt);
|
||||||
}
|
}
|
||||||
if (shape.statisticsMeasured) {
|
if (shape.statisticsMeasured) {
|
||||||
facts += format(", statistics control answered {}", shape.statisticsClippingInput);
|
facts += format(", and the statistics query counted {}", shape.statisticsClippingInput);
|
||||||
}
|
}
|
||||||
if (!shape.primitivesGeneratedExtMeasured && !shape.statisticsMeasured) {
|
if (!shape.primitivesGeneratedExtMeasured && !shape.statisticsMeasured) {
|
||||||
facts += ", no control (neither VK_EXT_primitives_generated_query with its "
|
facts += ". Neither a dedicated query with discard support nor a pipeline statistics query was "
|
||||||
"discard feature nor pipelineStatisticsQuery is available)";
|
"available";
|
||||||
}
|
}
|
||||||
return facts;
|
return facts + ".";
|
||||||
};
|
};
|
||||||
const String facts = shapeFacts("triangles", measurement.trianglesPlain) + "; " +
|
const String facts = shapeFacts("triangles", measurement.trianglesPlain) + " " +
|
||||||
shapeFacts("triangles under discard", measurement.trianglesDiscard) + "; " +
|
shapeFacts("triangles with rasterizer discard", measurement.trianglesDiscard) + " " +
|
||||||
shapeFacts("patches under discard", measurement.patchesDiscard);
|
shapeFacts("patches with rasterizer discard", measurement.patchesDiscard);
|
||||||
|
|
||||||
const auto statisticsExactOn = [](const PrimitivesGeneratedNoXfbShapeMeasurement& shape) {
|
const auto statisticsExactOn = [](const PrimitivesGeneratedNoXfbShapeMeasurement& shape) {
|
||||||
return shape.statisticsMeasured && shape.statisticsClippingInput == shape.expectedPrimitives;
|
return shape.statisticsMeasured && shape.statisticsClippingInput == shape.expectedPrimitives;
|
||||||
@@ -1870,54 +1853,41 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
// whether THIS driver's substitute covers it instead of assuming it does not.
|
// whether THIS driver's substitute covers it instead of assuming it does not.
|
||||||
const auto describeCtsShape = [&]() -> String {
|
const auto describeCtsShape = [&]() -> String {
|
||||||
if (!measurement.patchesDiscard.drawn) {
|
if (!measurement.patchesDiscard.drawn) {
|
||||||
return "the CTS's tessellator-measuring shape (a PATCHES draw under discard) could "
|
return "The probe could not verify the CTS tessellation case because tessellationShader is "
|
||||||
"not be measured here - this device has no tessellationShader - so whether "
|
"unavailable.";
|
||||||
"the substitute covers it is unknown";
|
|
||||||
}
|
}
|
||||||
return statisticsExactOn(measurement.patchesDiscard)
|
return statisticsExactOn(measurement.patchesDiscard)
|
||||||
? "the CTS's tessellator-measuring shape (a PATCHES draw under discard) is "
|
? "The substitute counts the CTS tessellation case correctly."
|
||||||
"NOT among them: the substitute answers it exactly, so those tests are "
|
: "The substitute fails the CTS tessellation probe.";
|
||||||
"repaired"
|
|
||||||
: "the CTS's tessellator-measuring shape (a PATCHES draw under discard) is "
|
|
||||||
"among them, so those tests stay broken on this driver";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (EvaluatePrimitivesGeneratedNoXfbVerdict(measurement)) {
|
switch (EvaluatePrimitivesGeneratedNoXfbVerdict(measurement)) {
|
||||||
case PrimitivesGeneratedNoXfbVerdict::StreamCounts:
|
case PrimitivesGeneratedNoXfbVerdict::StreamCounts:
|
||||||
builder.Pass(RowName, "the stream query counts a draw made with no capture span open, as "
|
builder.Pass(RowName, "The stream query counts primitives without active transform feedback, as "
|
||||||
"VK_EXT_transform_feedback defines (" +
|
"VK_EXT_transform_feedback specifies. " +
|
||||||
facts + ")");
|
facts);
|
||||||
return;
|
return;
|
||||||
case PrimitivesGeneratedNoXfbVerdict::PrimitivesGeneratedExtSubstitute:
|
case PrimitivesGeneratedNoXfbVerdict::PrimitivesGeneratedExtSubstitute:
|
||||||
builder.Warn(RowName, "the stream query answers 0 for a draw made with no capture span open - "
|
builder.Warn(RowName,
|
||||||
"the shape the CTS measures the tessellator with - while a "
|
"The stream query returns 0 without active transform feedback. The renderer uses "
|
||||||
"VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT query around an identical replay answers "
|
"VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT to count these draws correctly, including "
|
||||||
"exactly right, rasterizer discard included, so the renderer "
|
"draws with rasterizer discard. Each draw counted by GL_PRIMITIVES_GENERATED uses one "
|
||||||
"accumulates GL_PRIMITIVES_GENERATED for such draws through the "
|
"extra query slot. " +
|
||||||
"dedicated query instead (one extra query slot per XFB-inactive draw "
|
facts);
|
||||||
"inside a GENERATED span; " +
|
|
||||||
facts + ")");
|
|
||||||
return;
|
return;
|
||||||
case PrimitivesGeneratedNoXfbVerdict::StatisticsSubstitute:
|
case PrimitivesGeneratedNoXfbVerdict::StatisticsSubstitute:
|
||||||
builder.Warn(RowName,
|
builder.Warn(RowName, "The stream query returns 0 without active transform feedback. The renderer uses "
|
||||||
"the stream query answers 0 for a draw made with no capture span open - "
|
"a clipping-invocations query to count these draws correctly, including draws "
|
||||||
"the shape the CTS measures the tessellator with - while a "
|
"with rasterizer discard. Each draw counted by GL_PRIMITIVES_GENERATED uses one "
|
||||||
"clipping-invocations statistics query around an identical replay answers exactly "
|
"extra query slot. " +
|
||||||
"right, rasterizer discard included, so the renderer accumulates "
|
facts);
|
||||||
"GL_PRIMITIVES_GENERATED for such draws through a pipeline-statistics "
|
|
||||||
"pool instead (one extra query slot per XFB-inactive draw inside a "
|
|
||||||
"GENERATED span; " +
|
|
||||||
facts + ")");
|
|
||||||
return;
|
return;
|
||||||
case PrimitivesGeneratedNoXfbVerdict::StatisticsSubstitutePlainOnly:
|
case PrimitivesGeneratedNoXfbVerdict::StatisticsSubstitutePlainOnly:
|
||||||
fail("the stream query answers 0 for a draw made with no capture span open, and the "
|
fail("The clipping-invocations query counts the plain draw correctly but misses " +
|
||||||
"clipping-invocations statistics substitute counts the plain draw exactly but "
|
|
||||||
"misses " +
|
|
||||||
describeMissedStatisticsShapes() +
|
describeMissedStatisticsShapes() +
|
||||||
" - each of them a shape the stream query answered 0 for as well, so the renderer "
|
". The stream query also returned 0 for those draws. The renderer uses the substitute without "
|
||||||
"reroutes XFB-inactive draws (repairing every shape the substitute answers, at no "
|
"active transform feedback. " +
|
||||||
"cost to the rest, which is what the verdict requires); " +
|
describeCtsShape());
|
||||||
describeCtsShape() + " (" + facts + ")");
|
|
||||||
return;
|
return;
|
||||||
case PrimitivesGeneratedNoXfbVerdict::Unfixable: {
|
case PrimitivesGeneratedNoXfbVerdict::Unfixable: {
|
||||||
// Two ways to land here, and the report must not conflate them: no
|
// Two ways to land here, and the report must not conflate them: no
|
||||||
@@ -1940,28 +1910,22 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
noteDowngrade("triangles under rasterizer discard", measurement.trianglesDiscard);
|
noteDowngrade("triangles under rasterizer discard", measurement.trianglesDiscard);
|
||||||
noteDowngrade("patches under rasterizer discard", measurement.patchesDiscard);
|
noteDowngrade("patches under rasterizer discard", measurement.patchesDiscard);
|
||||||
if (statisticsExactOn(measurement.trianglesPlain) && !downgradeShapes.empty()) {
|
if (statisticsExactOn(measurement.trianglesPlain) && !downgradeShapes.empty()) {
|
||||||
fail("the stream query answers 0 for a draw made with no capture span open, and the "
|
fail("The clipping-invocations query would replace correct stream counts for " + downgradeShapes +
|
||||||
"clipping-invocations statistics substitute repairs the plain draw but is wrong "
|
" with incorrect counts. MobileGL keeps the stream query, which returns 0 for the plain "
|
||||||
"on " +
|
"draw without active transform feedback. " +
|
||||||
downgradeShapes +
|
facts);
|
||||||
", which the stream query answers exactly - rerouting every XFB-inactive draw "
|
|
||||||
"would trade a correct count for a wrong one, so MobileGL arms nothing and the "
|
|
||||||
"capture-less query keeps the driver's answers (" +
|
|
||||||
facts + ")");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fail("the stream query answers 0 for a draw made with no capture span open and the "
|
fail("The stream query returns 0 without active transform feedback. No statistics substitute passed. " +
|
||||||
"device offers no working statistics substitute; an application sizing a capture "
|
facts);
|
||||||
"buffer from GL_PRIMITIVES_GENERATED gets 0 (" +
|
|
||||||
facts + ")");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case PrimitivesGeneratedNoXfbVerdict::Inconclusive:
|
case PrimitivesGeneratedNoXfbVerdict::Inconclusive:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fail("the probe reached no verdict - the answers fit neither the defect nor health, and "
|
fail("The probe could not determine whether the stream query works without active transform feedback. "
|
||||||
"MobileGL declines to repair a driver it does not understand (" +
|
"MobileGL keeps the driver query. " +
|
||||||
facts + ")");
|
facts);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Native iterationRP compute witness. This deliberately uses a separate
|
// Native iterationRP compute witness. This deliberately uses a separate
|
||||||
@@ -2009,9 +1973,7 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
// WARN, not FAIL: there is nothing to witness on a device with no native
|
// WARN, not FAIL: there is nothing to witness on a device with no native
|
||||||
// subgroup contract, and the renderer takes its non-subgroup iteration path,
|
// subgroup contract, and the renderer takes its non-subgroup iteration path,
|
||||||
// which produces the same image.
|
// which produces the same image.
|
||||||
builder.Warn(RowName, eligibility.detail +
|
builder.Warn(RowName, eligibility.detail + ". MobileGL uses its non-subgroup iteration path.");
|
||||||
"; the renderer takes its non-subgroup iteration path instead, which "
|
|
||||||
"renders the same thing without the first-reduction shortcut");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (eligibility.eligibility == IterationRPWitnessEligibility::FailInadequateLimits) {
|
if (eligibility.eligibility == IterationRPWitnessEligibility::FailInadequateLimits) {
|
||||||
@@ -2524,12 +2486,12 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
// fallback costs a buffer queue the headless path does not need, and because
|
// fallback costs a buffer queue the headless path does not need, and because
|
||||||
// this used to abort the process instead.
|
// this used to abort the process instead.
|
||||||
if (HasVkExtension(instanceExtensions, VK_EXT_HEADLESS_SURFACE_EXTENSION_NAME)) {
|
if (HasVkExtension(instanceExtensions, VK_EXT_HEADLESS_SURFACE_EXTENSION_NAME)) {
|
||||||
builder.Pass("Headless surface", format("{} present; windowless contexts get a real headless surface",
|
builder.Pass("Headless surface",
|
||||||
VK_EXT_HEADLESS_SURFACE_EXTENSION_NAME));
|
format("Windowless contexts use {}.", VK_EXT_HEADLESS_SURFACE_EXTENSION_NAME));
|
||||||
} else {
|
} else {
|
||||||
builder.Warn("Headless surface",
|
builder.Warn("Headless surface",
|
||||||
format("{} absent; a windowless (pbuffer) context falls back to an AImageReader "
|
format("Without {}, pbuffer contexts use an AImageReader ANativeWindow. This requires "
|
||||||
"ANativeWindow, which needs libmediandk.so and an extra buffer queue",
|
"libmediandk.so and an extra buffer queue.",
|
||||||
VK_EXT_HEADLESS_SURFACE_EXTENSION_NAME));
|
VK_EXT_HEADLESS_SURFACE_EXTENSION_NAME));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2736,20 +2698,21 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
multiDrawExtUsable = multiDrawFeatures.multiDraw == VK_TRUE;
|
multiDrawExtUsable = multiDrawFeatures.multiDraw == VK_TRUE;
|
||||||
}
|
}
|
||||||
if (multiDrawExtUsable) {
|
if (multiDrawExtUsable) {
|
||||||
builder.Pass("VK_EXT_multi_draw",
|
builder.Pass(
|
||||||
"supported; a glMultiDraw* batch runs as one vkCmdDrawMulti(Indexed)EXT");
|
"VK_EXT_multi_draw",
|
||||||
|
"The backend submits each batch in one vkCmdDrawMultiEXT or vkCmdDrawMultiIndexedEXT call.");
|
||||||
} else {
|
} else {
|
||||||
builder.Warn("VK_EXT_multi_draw",
|
builder.Warn("VK_EXT_multi_draw", "MobileGL falls back to indirect or individual draws.");
|
||||||
"unsupported; glMultiDraw* batches take the indirect or unrolled tier "
|
|
||||||
"instead, with identical output");
|
|
||||||
}
|
}
|
||||||
const char* resolvedTier = multiDrawExtUsable ? "ext"
|
const char* resolvedTier = multiDrawExtUsable ? "ext"
|
||||||
: features.multiDrawIndirect == VK_TRUE ? "indirect"
|
: features.multiDrawIndirect == VK_TRUE ? "indirect"
|
||||||
: "unroll";
|
: "unroll";
|
||||||
String tierDetail = format("default tier \"{}\" (chain: ext -> indirect -> unroll)", resolvedTier);
|
String tierDetail = format("The default tier is {}. MobileGL prefers the extension, then indirect draws, "
|
||||||
|
"then individual draws.",
|
||||||
|
resolvedTier);
|
||||||
const MG_Config::MultiDrawMode multiDrawMode = MG_Config::Features.MagmaMultiDrawMode;
|
const MG_Config::MultiDrawMode multiDrawMode = MG_Config::Features.MagmaMultiDrawMode;
|
||||||
if (multiDrawMode != MG_Config::MultiDrawMode::Auto) {
|
if (multiDrawMode != MG_Config::MultiDrawMode::Auto) {
|
||||||
tierDetail += format("; MOBILEGL_MAGMA_MULTIDRAW_MODE={} caps it (clamped to device support)",
|
tierDetail += format(" MOBILEGL_MAGMA_MULTIDRAW_MODE caps the tier at {}, subject to device support.",
|
||||||
multiDrawMode == MG_Config::MultiDrawMode::Ext ? "ext"
|
multiDrawMode == MG_Config::MultiDrawMode::Ext ? "ext"
|
||||||
: multiDrawMode == MG_Config::MultiDrawMode::Indirect ? "indirect"
|
: multiDrawMode == MG_Config::MultiDrawMode::Indirect ? "indirect"
|
||||||
: "unroll");
|
: "unroll");
|
||||||
@@ -2758,9 +2721,7 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
if (multiDrawExtUsable) {
|
if (multiDrawExtUsable) {
|
||||||
builder.Pass("Multi-draw dispatch tier", tierDetail);
|
builder.Pass("Multi-draw dispatch tier", tierDetail);
|
||||||
} else {
|
} else {
|
||||||
builder.Warn("Multi-draw dispatch tier",
|
builder.Warn("Multi-draw dispatch tier", tierDetail + " The fallback can submit more commands.");
|
||||||
tierDetail + "; the batch is replayed rather than handed over whole, which "
|
|
||||||
"renders the same thing for more commands");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (features.vertexPipelineStoresAndAtomics == VK_TRUE) {
|
if (features.vertexPipelineStoresAndAtomics == VK_TRUE) {
|
||||||
@@ -2858,33 +2819,22 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
// and Mali both report VK_FALSE, so the demoted row is what a real phone prints; lavapipe
|
// and Mali both report VK_FALSE, so the demoted row is what a real phone prints; lavapipe
|
||||||
// reports VK_TRUE and gets real doubles.
|
// reports VK_TRUE and gets real doubles.
|
||||||
if (features.shaderFloat64 == VK_TRUE) {
|
if (features.shaderFloat64 == VK_TRUE) {
|
||||||
builder.Pass("fp64", AppendFp64AdvertisementNote(
|
builder.Pass("fp64",
|
||||||
"native (device shaderFloat64 = supported) - every double / dvec / dmat in "
|
AppendFp64AdvertisementNote(
|
||||||
"a shader keeps its declared width, blocks keep the layout glslang computed "
|
"The device supports shaderFloat64. MobileGL preserves fp64 unless the vertex stage "
|
||||||
"for them, and glUniform*d stores 8-byte components. The one exception is a "
|
"declares a 64-bit floating-point input, which triggers program-wide demotion."));
|
||||||
"VERTEX stage that declares a 64-bit float INPUT: there is no 64-bit vertex "
|
|
||||||
"FETCH here, so such a program is narrowed whole exactly as it would be on a "
|
|
||||||
"device without the feature"));
|
|
||||||
} else {
|
} else {
|
||||||
// WARN rather than PASS: the device does not support fp64 at all here, and what
|
// WARN rather than PASS: the device does not support fp64 at all here, and what
|
||||||
// stands in for it is a MobileGL pass that narrows the shader. It runs, at single
|
// stands in for it is a MobileGL pass that narrows the shader. It runs, at single
|
||||||
// precision - the definition of a substitute.
|
// precision - the definition of a substitute.
|
||||||
builder.Warn("fp64", AppendFp64AdvertisementNote(
|
builder.Warn("fp64",
|
||||||
"demoted to fp32 (device shaderFloat64 = unsupported) - every double / dvec "
|
AppendFp64AdvertisementNote(
|
||||||
"/ dmat in a shader is narrowed to 32 bits before pipeline creation, so such "
|
"The device does not support shaderFloat64. MobileGL narrows shader values to fp32 "
|
||||||
"shaders BUILD AND RUN at single precision instead of failing to create a "
|
"before pipeline creation and recalculates buffer block layouts."));
|
||||||
"shader module. A block containing a double is re-laid-out for the narrowed "
|
|
||||||
"members, so an application that hard-codes std140 offsets computed for "
|
|
||||||
"doubles must query them instead"));
|
|
||||||
}
|
}
|
||||||
builder.Warn("64-bit vertex attributes",
|
builder.Warn("64-bit vertex attributes",
|
||||||
"narrowed to float32 on every device, whatever the row above says: there is no "
|
"MobileGL converts 64-bit vertex arrays to float32 at draw time, including on devices with "
|
||||||
"VK_FORMAT_R64*_SFLOAT vertex fetch here, and the format is chosen from the VAO "
|
"shaderFloat64. A 64-bit floating-point vertex input triggers program-wide fp64 demotion.");
|
||||||
"attribute, which does not know what type the shader declared - which is why a "
|
|
||||||
"vertex stage with a 64-bit float INPUT is narrowed whole even where fp64 is native. "
|
|
||||||
"glVertexAttribLFormat succeeds, its state is queryable, and an ENABLED 64-bit array "
|
|
||||||
"IS fetched - the source doubles are deinterleaved into a float32 stream at draw, so "
|
|
||||||
"values outside float32's range or precision are rounded rather than exact");
|
|
||||||
|
|
||||||
Bool shaderDrawParameters = false;
|
Bool shaderDrawParameters = false;
|
||||||
if (vkGetPhysicalDeviceFeatures2Fn != nullptr && properties.apiVersion >= VK_API_VERSION_1_1) {
|
if (vkGetPhysicalDeviceFeatures2Fn != nullptr && properties.apiVersion >= VK_API_VERSION_1_1) {
|
||||||
@@ -2900,7 +2850,7 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
shaderDrawParameters = true;
|
shaderDrawParameters = true;
|
||||||
}
|
}
|
||||||
if (shaderDrawParameters) {
|
if (shaderDrawParameters) {
|
||||||
builder.Pass("shaderDrawParameters", "gl_DrawID/gl_BaseVertex/gl_BaseInstance shaders supported");
|
builder.Pass("shaderDrawParameters", "Shaders can read gl_DrawID, gl_BaseVertex, and gl_BaseInstance.");
|
||||||
} else {
|
} else {
|
||||||
builder.FailOptional("shaderDrawParameters",
|
builder.FailOptional("shaderDrawParameters",
|
||||||
"unavailable; a shader reading gl_DrawID, gl_BaseVertex or "
|
"unavailable; a shader reading gl_DrawID, gl_BaseVertex or "
|
||||||
|
|||||||
@@ -138,44 +138,44 @@ namespace MobileGL::MG_Util::SelfTest {
|
|||||||
const std::uint32_t numSubgroups = output.numSubgroups;
|
const std::uint32_t numSubgroups = output.numSubgroups;
|
||||||
if (numSubgroups < 2u || numSubgroups > kIterationRPWitnessMaxSubgroups) {
|
if (numSubgroups < 2u || numSubgroups > kIterationRPWitnessMaxSubgroups) {
|
||||||
std::ostringstream detail;
|
std::ostringstream detail;
|
||||||
detail << "topology: canonical gl_NumSubgroups=" << numSubgroups << " is outside [2, 32]";
|
detail << "The workgroup reported " << numSubgroups << " subgroups. The probe requires 2 to 32.";
|
||||||
return Failure(IterationRPWitnessValidationFailure::Topology, detail.str());
|
return Failure(IterationRPWitnessValidationFailure::Topology, detail.str());
|
||||||
}
|
}
|
||||||
if ((output.topologyFlags & IterationRPWitnessNonuniformNumSubgroups) != 0u) {
|
if ((output.topologyFlags & IterationRPWitnessNonuniformNumSubgroups) != 0u) {
|
||||||
return Failure(IterationRPWitnessValidationFailure::Topology,
|
return Failure(IterationRPWitnessValidationFailure::Topology,
|
||||||
"topology: gl_NumSubgroups differed across workgroup");
|
"gl_NumSubgroups differed across workgroup invocations.");
|
||||||
}
|
}
|
||||||
if ((output.topologyFlags & IterationRPWitnessInvalidNumSubgroups) != 0u) {
|
if ((output.topologyFlags & IterationRPWitnessInvalidNumSubgroups) != 0u) {
|
||||||
return Failure(IterationRPWitnessValidationFailure::Topology,
|
return Failure(IterationRPWitnessValidationFailure::Topology,
|
||||||
"topology: an invocation reported gl_NumSubgroups outside [2, 32]");
|
"One invocation reported a subgroup count outside the supported range of 2 to 32.");
|
||||||
}
|
}
|
||||||
if ((output.topologyFlags & IterationRPWitnessInvalidSubgroupId) != 0u) {
|
if ((output.topologyFlags & IterationRPWitnessInvalidSubgroupId) != 0u) {
|
||||||
return Failure(IterationRPWitnessValidationFailure::Topology,
|
return Failure(IterationRPWitnessValidationFailure::Topology,
|
||||||
"topology: an invocation reported an invalid gl_SubgroupID");
|
"One invocation reported an invalid gl_SubgroupID.");
|
||||||
}
|
}
|
||||||
if ((output.topologyFlags & IterationRPWitnessInvalidSubgroupLane) != 0u) {
|
if ((output.topologyFlags & IterationRPWitnessInvalidSubgroupLane) != 0u) {
|
||||||
return Failure(IterationRPWitnessValidationFailure::Topology,
|
return Failure(IterationRPWitnessValidationFailure::Topology,
|
||||||
"topology: an invocation reported an invalid subgroup lane");
|
"One invocation reported an invalid subgroup lane.");
|
||||||
}
|
}
|
||||||
if ((output.topologyFlags & ~(IterationRPWitnessNonuniformNumSubgroups | IterationRPWitnessInvalidNumSubgroups |
|
if ((output.topologyFlags & ~(IterationRPWitnessNonuniformNumSubgroups | IterationRPWitnessInvalidNumSubgroups |
|
||||||
IterationRPWitnessInvalidSubgroupId | IterationRPWitnessInvalidSubgroupLane)) !=
|
IterationRPWitnessInvalidSubgroupId | IterationRPWitnessInvalidSubgroupLane)) !=
|
||||||
0u) {
|
0u) {
|
||||||
std::ostringstream detail;
|
std::ostringstream detail;
|
||||||
detail << "topology: unknown topology flags 0x" << std::hex << output.topologyFlags;
|
detail << "The probe reported unknown topology flags 0x" << std::hex << output.topologyFlags;
|
||||||
return Failure(IterationRPWitnessValidationFailure::Topology, detail.str());
|
return Failure(IterationRPWitnessValidationFailure::Topology, detail.str());
|
||||||
}
|
}
|
||||||
const std::uint32_t expectedMask = ExpectedSeenSubgroupMask(numSubgroups);
|
const std::uint32_t expectedMask = ExpectedSeenSubgroupMask(numSubgroups);
|
||||||
if (output.seenSubgroupMask != expectedMask) {
|
if (output.seenSubgroupMask != expectedMask) {
|
||||||
std::ostringstream detail;
|
std::ostringstream detail;
|
||||||
detail << "topology: seen subgroup-ID mask was 0x" << std::hex << output.seenSubgroupMask << ", expected 0x"
|
detail << "The seen subgroup-ID mask was 0x" << std::hex << output.seenSubgroupMask << ", expected 0x"
|
||||||
<< expectedMask;
|
<< expectedMask;
|
||||||
return Failure(IterationRPWitnessValidationFailure::Topology, detail.str());
|
return Failure(IterationRPWitnessValidationFailure::Topology, detail.str());
|
||||||
}
|
}
|
||||||
const std::uint32_t expectedLoopLength = ComputeIterationRPWitnessLoopLength(numSubgroups);
|
const std::uint32_t expectedLoopLength = ComputeIterationRPWitnessLoopLength(numSubgroups);
|
||||||
if (output.loopLength != expectedLoopLength) {
|
if (output.loopLength != expectedLoopLength) {
|
||||||
std::ostringstream detail;
|
std::ostringstream detail;
|
||||||
detail << "topology: loopLength was " << std::dec << output.loopLength << ", expected "
|
detail << "The reduction ran for " << std::dec << output.loopLength << " iterations. The probe expected "
|
||||||
<< expectedLoopLength;
|
<< expectedLoopLength << '.';
|
||||||
return Failure(IterationRPWitnessValidationFailure::Topology, detail.str());
|
return Failure(IterationRPWitnessValidationFailure::Topology, detail.str());
|
||||||
}
|
}
|
||||||
for (std::uint32_t subgroup = 0u; subgroup < numSubgroups; ++subgroup) {
|
for (std::uint32_t subgroup = 0u; subgroup < numSubgroups; ++subgroup) {
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ public final class NavBar {
|
|||||||
LinearLayout bar = new LinearLayout(activity);
|
LinearLayout bar = new LinearLayout(activity);
|
||||||
bar.setOrientation(LinearLayout.HORIZONTAL);
|
bar.setOrientation(LinearLayout.HORIZONTAL);
|
||||||
bar.setBackgroundColor(COLOR_BAR);
|
bar.setBackgroundColor(COLOR_BAR);
|
||||||
addTab(activity, bar, "POST", PostActivity.class, currentTab == TAB_POST);
|
addTab(activity, bar, "Diagnostics", PostActivity.class, currentTab == TAB_POST);
|
||||||
addTab(activity, bar, "Render Server", ServerControlActivity.class, currentTab == TAB_SERVER);
|
addTab(activity, bar, "Server", ServerControlActivity.class, currentTab == TAB_SERVER);
|
||||||
root.addView(bar, new LinearLayout.LayoutParams(
|
root.addView(bar, new LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT, dp(activity, BAR_HEIGHT_DP)));
|
LinearLayout.LayoutParams.MATCH_PARENT, dp(activity, BAR_HEIGHT_DP)));
|
||||||
return root;
|
return root;
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ public final class PostActivity extends Activity {
|
|||||||
setContentView(NavBar.wrap(this, scrollView, NavBar.TAB_POST));
|
setContentView(NavBar.wrap(this, scrollView, NavBar.TAB_POST));
|
||||||
|
|
||||||
addText("MobileGL Driver POST", 20, COLOR_TEXT, true, 0);
|
addText("MobileGL Driver POST", 20, COLOR_TEXT, true, 0);
|
||||||
statusView = addText("Running self-test...", 14, COLOR_INFO, false, dp(8));
|
statusView = addText("Checking drivers…", 14, COLOR_INFO, false, dp(8));
|
||||||
|
|
||||||
progressBar = new ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal);
|
progressBar = new ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal);
|
||||||
progressBar.setIndeterminate(true);
|
progressBar.setIndeterminate(true);
|
||||||
@@ -119,8 +119,6 @@ public final class PostActivity extends Activity {
|
|||||||
postInFlight = true;
|
postInFlight = true;
|
||||||
startWorker = true;
|
startWorker = true;
|
||||||
}
|
}
|
||||||
// else: a probe is already in flight; leave "Running self-test..."
|
|
||||||
// showing and wait for delivery to this (the current) activity.
|
|
||||||
}
|
}
|
||||||
if (renderNow) {
|
if (renderNow) {
|
||||||
renderCachedResult();
|
renderCachedResult();
|
||||||
@@ -174,7 +172,7 @@ public final class PostActivity extends Activity {
|
|||||||
Button button = benchButtons.get(backendType);
|
Button button = benchButtons.get(backendType);
|
||||||
if (button != null) {
|
if (button != null) {
|
||||||
button.setEnabled(false);
|
button.setEnabled(false);
|
||||||
button.setText("Bench running... (can take a minute)");
|
button.setText("Benchmark running…");
|
||||||
}
|
}
|
||||||
LinearLayout container = benchResultContainers.get(backendType);
|
LinearLayout container = benchResultContainers.get(backendType);
|
||||||
if (container != null) {
|
if (container != null) {
|
||||||
@@ -191,7 +189,7 @@ public final class PostActivity extends Activity {
|
|||||||
Button button = benchButtons.get(backendType);
|
Button button = benchButtons.get(backendType);
|
||||||
if (button != null) {
|
if (button != null) {
|
||||||
button.setEnabled(true);
|
button.setEnabled(true);
|
||||||
button.setText("Run Bench");
|
button.setText("Run benchmark");
|
||||||
}
|
}
|
||||||
LinearLayout container = benchResultContainers.get(backendType);
|
LinearLayout container = benchResultContainers.get(backendType);
|
||||||
if (container == null) {
|
if (container == null) {
|
||||||
@@ -202,7 +200,7 @@ public final class PostActivity extends Activity {
|
|||||||
JSONObject root = new JSONObject(json);
|
JSONObject root = new JSONObject(json);
|
||||||
String error = root.optString("error", "");
|
String error = root.optString("error", "");
|
||||||
if (!error.isEmpty()) {
|
if (!error.isEmpty()) {
|
||||||
container.addView(makeText("Bench failed: " + error, 12, COLOR_FAIL, false));
|
container.addView(makeText("Benchmark failed: " + error, 12, COLOR_FAIL, false));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
container.addView(makeText(root.optString("renderer", ""), 11, COLOR_INFO, false));
|
container.addView(makeText(root.optString("renderer", ""), 11, COLOR_INFO, false));
|
||||||
@@ -228,7 +226,7 @@ public final class PostActivity extends Activity {
|
|||||||
container.addView(view);
|
container.addView(view);
|
||||||
}
|
}
|
||||||
} catch (JSONException error) {
|
} catch (JSONException error) {
|
||||||
container.addView(makeText("Bench result unparsable: " + error, 12, COLOR_FAIL, false));
|
container.addView(makeText("Could not read benchmark result: " + error, 12, COLOR_FAIL, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,7 +315,9 @@ public final class PostActivity extends Activity {
|
|||||||
failure = cachedFailure;
|
failure = cachedFailure;
|
||||||
}
|
}
|
||||||
if (failure != null) {
|
if (failure != null) {
|
||||||
showError("Driver POST failed: " + failure);
|
showError("Could not start driver diagnostics.");
|
||||||
|
addDisclosure(contentLayout, "Error details", dp(4))
|
||||||
|
.addView(makeText(failure.toString(), 12, COLOR_DETAIL, false));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
renderReport(json);
|
renderReport(json);
|
||||||
@@ -325,34 +325,37 @@ public final class PostActivity extends Activity {
|
|||||||
|
|
||||||
private void renderReport(String json) {
|
private void renderReport(String json) {
|
||||||
if (json == null || json.isEmpty()) {
|
if (json == null || json.isEmpty()) {
|
||||||
showError("Driver POST returned an empty report.");
|
showError("No diagnostics report was returned.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
JSONObject root;
|
JSONObject root;
|
||||||
try {
|
try {
|
||||||
root = new JSONObject(json);
|
root = new JSONObject(json);
|
||||||
} catch (JSONException error) {
|
} catch (JSONException error) {
|
||||||
showError("Failed to parse POST report: " + error.getMessage() + "\n\n" + json);
|
showError("Could not read the diagnostics report.");
|
||||||
|
addRawJsonSection(json);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String nativeError = root.optString("error", "");
|
String nativeError = root.optString("error", "");
|
||||||
if (!nativeError.isEmpty()) {
|
if (!nativeError.isEmpty()) {
|
||||||
showError(nativeError);
|
showError("Driver diagnostics failed.");
|
||||||
addRawJsonSection(json);
|
addRawJsonSection(json);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
JSONArray backends = extractBackends(root);
|
JSONArray backends = extractBackends(root);
|
||||||
if (backends.length() == 0) {
|
boolean hasBackend = false;
|
||||||
showError("POST report contains no backend sections:\n\n" + json);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
statusView.setText("Self-test complete.");
|
|
||||||
for (int i = 0; i < backends.length(); ++i) {
|
for (int i = 0; i < backends.length(); ++i) {
|
||||||
JSONObject backend = backends.optJSONObject(i);
|
JSONObject backend = backends.optJSONObject(i);
|
||||||
if (backend != null) {
|
if (backend != null) {
|
||||||
renderBackendSection(backend);
|
renderBackendSection(backend);
|
||||||
|
hasBackend = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (hasBackend) {
|
||||||
|
statusView.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
showError("No backend results were reported.");
|
||||||
|
}
|
||||||
addRawJsonSection(json);
|
addRawJsonSection(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -381,88 +384,56 @@ public final class PostActivity extends Activity {
|
|||||||
|
|
||||||
private void renderBackendSection(JSONObject backend) {
|
private void renderBackendSection(JSONObject backend) {
|
||||||
String name = backend.optString("backend", backend.optString("name", "Unknown backend"));
|
String name = backend.optString("backend", backend.optString("name", "Unknown backend"));
|
||||||
addText(sectionTitle(name), 16, COLOR_TEXT, true, dp(20));
|
boolean available = backend.optBoolean("available", true);
|
||||||
|
String verdict = available ? backend.optString("verdict", "Unknown") : "Unavailable";
|
||||||
if (!backend.optBoolean("available", true)) {
|
addText(sectionTitle(name) + " · " + verdict, 16, verdictColor(verdict), true, dp(16));
|
||||||
addText("Driver not present / not probeable", 12, COLOR_INFO, false, dp(4));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String verdict = backend.optString("verdict", "UNKNOWN");
|
|
||||||
addText("Verdict: " + verdict, 14, verdictColor(verdict), true, dp(4));
|
|
||||||
|
|
||||||
String renderer = backend.optString("renderer", "");
|
|
||||||
if (!renderer.isEmpty()) {
|
|
||||||
addText(renderer, 12, COLOR_INFO, false, dp(2));
|
|
||||||
}
|
|
||||||
|
|
||||||
addBenchControls(name);
|
|
||||||
|
|
||||||
JSONArray checks = backend.optJSONArray("checks");
|
JSONArray checks = backend.optJSONArray("checks");
|
||||||
|
JSONArray bugs = backend.optJSONArray("knownDriverBugs");
|
||||||
|
LinearLayout issues = newColumn();
|
||||||
|
LinearLayout otherChecks = newColumn();
|
||||||
if (checks != null) {
|
if (checks != null) {
|
||||||
LinearLayout table = new LinearLayout(this);
|
|
||||||
table.setOrientation(LinearLayout.VERTICAL);
|
|
||||||
LinearLayout.LayoutParams tableParams = new LinearLayout.LayoutParams(
|
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
|
||||||
);
|
|
||||||
tableParams.topMargin = dp(6);
|
|
||||||
contentLayout.addView(table, tableParams);
|
|
||||||
int rowIndex = 0;
|
|
||||||
for (int i = 0; i < checks.length(); ++i) {
|
for (int i = 0; i < checks.length(); ++i) {
|
||||||
JSONObject check = checks.optJSONObject(i);
|
JSONObject check = checks.optJSONObject(i);
|
||||||
if (check == null) {
|
if (check == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
addCheckRow(table, check, rowIndex++);
|
String status = check.optString("status", "INFO");
|
||||||
|
boolean issue = "WARN".equalsIgnoreCase(status) || "FAIL".equalsIgnoreCase(status);
|
||||||
|
addCheckRow(issue ? issues : otherChecks, check.optString("name", "Unnamed check"), status,
|
||||||
|
check.optString("detail", check.optString("message", "")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (bugs != null) {
|
||||||
renderKnownDriverBugs(backend.optJSONArray("knownDriverBugs"));
|
for (int i = 0; i < bugs.length(); ++i) {
|
||||||
renderFormatCapabilities(backend.optJSONObject("formatCapabilities"));
|
JSONObject bug = bugs.optJSONObject(i);
|
||||||
}
|
if (bug == null) {
|
||||||
|
continue;
|
||||||
/**
|
}
|
||||||
* The "Known Driver Bugs" section: core functionality this driver advertises, accepts,
|
String status = bug.optString("verdict", "UNFIXABLE");
|
||||||
* and then does not perform. Separate from the capability checks above because it answers
|
addCheckRow("FIXED".equalsIgnoreCase(status) ? otherChecks : issues,
|
||||||
* a different question and uses its own vocabulary.
|
bug.optString("name", "Unnamed driver bug"), status, bug.optString("detail", ""));
|
||||||
*
|
}
|
||||||
* Only bugs the device actually HAS are reported, so a clean driver renders no section at
|
}
|
||||||
* all rather than a list of reassurances - which is why the verdicts are FIXED (a MobileGL
|
if (issues.getChildCount() != 0) {
|
||||||
* quirk makes application behaviour correct anyway) and UNFIXABLE (no substitute; the
|
contentLayout.addView(issues);
|
||||||
* one-liner says what MobileGL does defensively), never PASS/FAIL.
|
|
||||||
*/
|
|
||||||
private void renderKnownDriverBugs(JSONArray bugs) {
|
|
||||||
if (bugs == null || bugs.length() == 0) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
addText("Known driver bugs", 14, COLOR_TEXT, true, dp(16));
|
|
||||||
LinearLayout table = new LinearLayout(this);
|
|
||||||
table.setOrientation(LinearLayout.VERTICAL);
|
|
||||||
LinearLayout.LayoutParams tableParams = new LinearLayout.LayoutParams(
|
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
|
||||||
);
|
|
||||||
tableParams.topMargin = dp(6);
|
|
||||||
contentLayout.addView(table, tableParams);
|
|
||||||
|
|
||||||
int rowIndex = 0;
|
String renderer = backend.optString("renderer", "");
|
||||||
for (int i = 0; i < bugs.length(); ++i) {
|
String backendType = available ? backendTypeForSection(name) : null;
|
||||||
JSONObject bug = bugs.optJSONObject(i);
|
JSONObject formats = backend.optJSONObject("formatCapabilities");
|
||||||
if (bug == null) {
|
if (!renderer.isEmpty() || otherChecks.getChildCount() != 0 || formats != null || backendType != null) {
|
||||||
continue;
|
LinearLayout details = addDisclosure(contentLayout, "Details", dp(4));
|
||||||
|
if (!renderer.isEmpty()) {
|
||||||
|
details.addView(makeText(renderer, 12, COLOR_INFO, false));
|
||||||
}
|
}
|
||||||
// addCheckRow renders name + chip + collapsible detail, which is exactly this
|
renderFormatCapabilities(details, formats);
|
||||||
// section's shape; the chip text is the verdict rather than a status.
|
if (backendType != null) {
|
||||||
JSONObject row = new JSONObject();
|
addBenchControls(details, backendType);
|
||||||
try {
|
}
|
||||||
row.put("name", bug.optString("name", "unnamed bug"));
|
if (otherChecks.getChildCount() != 0) {
|
||||||
row.put("status", bug.optString("verdict", "UNFIXABLE"));
|
addDisclosure(details, "Other checks", dp(4)).addView(otherChecks);
|
||||||
row.put("detail", bug.optString("detail", ""));
|
|
||||||
} catch (JSONException ignored) {
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
addCheckRow(table, row, rowIndex++);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -485,13 +456,9 @@ public final class PostActivity extends Activity {
|
|||||||
* runs the Minecraft-shaped MG_Benchmark cases through the full MobileGL stack
|
* runs the Minecraft-shaped MG_Benchmark cases through the full MobileGL stack
|
||||||
* on this backend, in a throwaway service process (see BenchService).
|
* on this backend, in a throwaway service process (see BenchService).
|
||||||
*/
|
*/
|
||||||
private void addBenchControls(String sectionName) {
|
private void addBenchControls(LinearLayout parent, String backendType) {
|
||||||
final String backendType = backendTypeForSection(sectionName);
|
|
||||||
if (backendType == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Button button = new Button(this);
|
Button button = new Button(this);
|
||||||
button.setText("Run Bench");
|
button.setText("Run benchmark");
|
||||||
button.setAllCaps(false);
|
button.setAllCaps(false);
|
||||||
button.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13);
|
button.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13);
|
||||||
button.setOnClickListener(v -> startBench(backendType));
|
button.setOnClickListener(v -> startBench(backendType));
|
||||||
@@ -500,7 +467,7 @@ public final class PostActivity extends Activity {
|
|||||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||||
);
|
);
|
||||||
buttonParams.topMargin = dp(6);
|
buttonParams.topMargin = dp(6);
|
||||||
contentLayout.addView(button, buttonParams);
|
parent.addView(button, buttonParams);
|
||||||
benchButtons.put(backendType, button);
|
benchButtons.put(backendType, button);
|
||||||
|
|
||||||
LinearLayout results = new LinearLayout(this);
|
LinearLayout results = new LinearLayout(this);
|
||||||
@@ -510,7 +477,7 @@ public final class PostActivity extends Activity {
|
|||||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||||
);
|
);
|
||||||
resultParams.topMargin = dp(4);
|
resultParams.topMargin = dp(4);
|
||||||
contentLayout.addView(results, resultParams);
|
parent.addView(results, resultParams);
|
||||||
benchResultContainers.put(backendType, results);
|
benchResultContainers.put(backendType, results);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -519,15 +486,12 @@ public final class PostActivity extends Activity {
|
|||||||
* a non-empty detail get a collapse indicator and toggle the detail text on tap;
|
* a non-empty detail get a collapse indicator and toggle the detail text on tap;
|
||||||
* rows without detail show no indicator and are not tappable.
|
* rows without detail show no indicator and are not tappable.
|
||||||
*/
|
*/
|
||||||
private void addCheckRow(LinearLayout table, JSONObject check, int rowIndex) {
|
private void addCheckRow(LinearLayout table, String checkName, String status, String detail) {
|
||||||
String status = check.optString("status", "INFO");
|
|
||||||
String checkName = check.optString("name", "unnamed check");
|
|
||||||
String detail = check.optString("detail", check.optString("message", ""));
|
|
||||||
boolean hasDetail = !detail.isEmpty();
|
boolean hasDetail = !detail.isEmpty();
|
||||||
|
|
||||||
LinearLayout row = new LinearLayout(this);
|
LinearLayout row = new LinearLayout(this);
|
||||||
row.setOrientation(LinearLayout.VERTICAL);
|
row.setOrientation(LinearLayout.VERTICAL);
|
||||||
row.setBackgroundColor(rowIndex % 2 == 0 ? COLOR_ROW_EVEN : COLOR_ROW_ODD);
|
row.setBackgroundColor(table.getChildCount() % 2 == 0 ? COLOR_ROW_EVEN : COLOR_ROW_ODD);
|
||||||
table.addView(row, new LinearLayout.LayoutParams(
|
table.addView(row, new LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||||
@@ -543,7 +507,8 @@ public final class PostActivity extends Activity {
|
|||||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||||
));
|
));
|
||||||
|
|
||||||
TextView indicatorView = makeText(hasDetail ? INDICATOR_COLLAPSED : "", 12, COLOR_INFO, false);
|
String indicator = hasDetail ? INDICATOR_COLLAPSED : "";
|
||||||
|
TextView indicatorView = makeText(indicator, 12, COLOR_INFO, false);
|
||||||
line.addView(indicatorView, new LinearLayout.LayoutParams(
|
line.addView(indicatorView, new LinearLayout.LayoutParams(
|
||||||
dp(16),
|
dp(16),
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||||
@@ -570,8 +535,9 @@ public final class PostActivity extends Activity {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextView detailView = makeText(detail, 11, COLOR_DETAIL, false);
|
TextView detailView = makeText(detail, 13, COLOR_DETAIL, false);
|
||||||
detailView.setPadding(dp(24), 0, dp(8), dp(8));
|
detailView.setTypeface(Typeface.DEFAULT);
|
||||||
|
detailView.setPadding(dp(24), 0, dp(12), dp(10));
|
||||||
detailView.setVisibility(View.GONE);
|
detailView.setVisibility(View.GONE);
|
||||||
row.addView(detailView, new LinearLayout.LayoutParams(
|
row.addView(detailView, new LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
@@ -586,24 +552,22 @@ public final class PostActivity extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Adds one initially-collapsed capability matrix for every reported target. */
|
/** Adds one initially-collapsed capability matrix for every reported target. */
|
||||||
private void renderFormatCapabilities(JSONObject formatCapabilities) {
|
private void renderFormatCapabilities(LinearLayout parent, JSONObject formatCapabilities) {
|
||||||
addText("Format capabilities", 14, COLOR_TEXT, true, dp(16));
|
|
||||||
if (formatCapabilities == null) {
|
if (formatCapabilities == null) {
|
||||||
addText("Format capability table unavailable.", 12, COLOR_INFO, false, dp(4));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSONArray capabilities = formatCapabilities.optJSONArray("capabilities");
|
JSONArray capabilities = formatCapabilities.optJSONArray("capabilities");
|
||||||
JSONArray targets = formatCapabilities.optJSONArray("targets");
|
JSONArray targets = formatCapabilities.optJSONArray("targets");
|
||||||
if (capabilities == null || capabilities.length() == 0 || targets == null || targets.length() == 0) {
|
if (capabilities == null || capabilities.length() == 0 || targets == null || targets.length() == 0) {
|
||||||
addText("Format capability table is empty.", 12, COLOR_INFO, false, dp(4));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LinearLayout formats = addDisclosure(parent, "Format capabilities", dp(6));
|
||||||
for (int targetIndex = 0; targetIndex < targets.length(); ++targetIndex) {
|
for (int targetIndex = 0; targetIndex < targets.length(); ++targetIndex) {
|
||||||
JSONObject target = targets.optJSONObject(targetIndex);
|
JSONObject target = targets.optJSONObject(targetIndex);
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
addFormatTargetTable(target, capabilities);
|
addFormatTargetTable(formats, target, capabilities);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -612,7 +576,7 @@ public final class PostActivity extends Activity {
|
|||||||
* Adds a target header whose table is created only while expanded. Removing the
|
* Adds a target header whose table is created only while expanded. Removing the
|
||||||
* table again on collapse avoids retaining all status cells for both backends.
|
* table again on collapse avoids retaining all status cells for both backends.
|
||||||
*/
|
*/
|
||||||
private void addFormatTargetTable(JSONObject target, JSONArray capabilities) {
|
private void addFormatTargetTable(LinearLayout parent, JSONObject target, JSONArray capabilities) {
|
||||||
String targetName = target.optString("name", "Unknown target");
|
String targetName = target.optString("name", "Unknown target");
|
||||||
JSONArray rows = target.optJSONArray("rows");
|
JSONArray rows = target.optJSONArray("rows");
|
||||||
int formatCount = rows == null ? 0 : rows.length();
|
int formatCount = rows == null ? 0 : rows.length();
|
||||||
@@ -624,7 +588,7 @@ public final class PostActivity extends Activity {
|
|||||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||||
);
|
);
|
||||||
sectionParams.topMargin = dp(6);
|
sectionParams.topMargin = dp(6);
|
||||||
contentLayout.addView(section, sectionParams);
|
parent.addView(section, sectionParams);
|
||||||
|
|
||||||
TextView toggleView = makeText(
|
TextView toggleView = makeText(
|
||||||
INDICATOR_COLLAPSED + " " + targetName + " (" + formatCount + " formats)",
|
INDICATOR_COLLAPSED + " " + targetName + " (" + formatCount + " formats)",
|
||||||
@@ -757,22 +721,35 @@ public final class PostActivity extends Activity {
|
|||||||
row.addView(cell, params);
|
row.addView(cell, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Adds the collapsed "Raw report" toggle plus the (initially hidden) raw JSON dump. */
|
|
||||||
private void addRawJsonSection(String json) {
|
private void addRawJsonSection(String json) {
|
||||||
TextView toggleView = addText(INDICATOR_COLLAPSED + " Raw report (tap to expand)", 12, COLOR_INFO, true, dp(24));
|
LinearLayout details = addDisclosure(contentLayout, "Raw report", dp(12));
|
||||||
toggleView.setMinimumHeight(dp(44));
|
details.addView(makeText(json, 10, COLOR_INFO, false));
|
||||||
toggleView.setGravity(Gravity.CENTER_VERTICAL);
|
}
|
||||||
|
|
||||||
TextView rawView = addText(json, 10, COLOR_INFO, false, dp(4));
|
private LinearLayout addDisclosure(LinearLayout parent, String label, int margin) {
|
||||||
rawView.setVisibility(View.GONE);
|
TextView toggle = makeText(INDICATOR_COLLAPSED + " " + label, 12, COLOR_TEXT, true);
|
||||||
|
toggle.setMinimumHeight(dp(44));
|
||||||
|
toggle.setGravity(Gravity.CENTER_VERTICAL);
|
||||||
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||||
|
params.topMargin = margin;
|
||||||
|
parent.addView(toggle, params);
|
||||||
|
|
||||||
toggleView.setOnClickListener(view -> {
|
LinearLayout section = newColumn();
|
||||||
boolean expanded = rawView.getVisibility() == View.VISIBLE;
|
section.setVisibility(View.GONE);
|
||||||
rawView.setVisibility(expanded ? View.GONE : View.VISIBLE);
|
parent.addView(section);
|
||||||
toggleView.setText(expanded
|
toggle.setOnClickListener(view -> {
|
||||||
? INDICATOR_COLLAPSED + " Raw report (tap to expand)"
|
boolean expanded = section.getVisibility() == View.VISIBLE;
|
||||||
: INDICATOR_EXPANDED + " Raw report (tap to collapse)");
|
section.setVisibility(expanded ? View.GONE : View.VISIBLE);
|
||||||
|
toggle.setText((expanded ? INDICATOR_COLLAPSED : INDICATOR_EXPANDED) + " " + label);
|
||||||
});
|
});
|
||||||
|
return section;
|
||||||
|
}
|
||||||
|
|
||||||
|
private LinearLayout newColumn() {
|
||||||
|
LinearLayout column = new LinearLayout(this);
|
||||||
|
column.setOrientation(LinearLayout.VERTICAL);
|
||||||
|
return column;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String sectionTitle(String backendName) {
|
private static String sectionTitle(String backendName) {
|
||||||
@@ -793,6 +770,7 @@ public final class PostActivity extends Activity {
|
|||||||
case "DEGRADED":
|
case "DEGRADED":
|
||||||
return COLOR_WARN;
|
return COLOR_WARN;
|
||||||
case "UNSUPPORTED":
|
case "UNSUPPORTED":
|
||||||
|
case "UNAVAILABLE":
|
||||||
return COLOR_FAIL;
|
return COLOR_FAIL;
|
||||||
default:
|
default:
|
||||||
return COLOR_INFO;
|
return COLOR_INFO;
|
||||||
@@ -823,9 +801,8 @@ public final class PostActivity extends Activity {
|
|||||||
|
|
||||||
private void showError(String message) {
|
private void showError(String message) {
|
||||||
Log.e(TAG, message);
|
Log.e(TAG, message);
|
||||||
statusView.setText("Self-test failed.");
|
statusView.setText(message);
|
||||||
statusView.setTextColor(COLOR_FAIL);
|
statusView.setTextColor(COLOR_FAIL);
|
||||||
addText(message, 12, COLOR_FAIL, false, dp(8));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private TextView addText(String text, int sizeSp, int color, boolean bold, int topMarginPx) {
|
private TextView addText(String text, int sizeSp, int color, boolean bold, int topMarginPx) {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import android.os.Bundle;
|
|||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
|
import android.view.View;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
@@ -75,32 +76,44 @@ public final class ServerControlActivity extends Activity {
|
|||||||
setContentView(NavBar.wrap(this, scrollView, NavBar.TAB_SERVER));
|
setContentView(NavBar.wrap(this, scrollView, NavBar.TAB_SERVER));
|
||||||
|
|
||||||
contentLayout.addView(makeText("MobileGL Render Server", 20, COLOR_TEXT, true));
|
contentLayout.addView(makeText("MobileGL Render Server", 20, COLOR_TEXT, true));
|
||||||
|
listenField = addField(contentLayout, "Listen address", DEFAULT_ENDPOINT, dp(12));
|
||||||
|
listenField.setHint("tcp://host:port or @name");
|
||||||
|
LinearLayout tokenRow = new LinearLayout(this);
|
||||||
|
tokenRow.setGravity(android.view.Gravity.CENTER_VERTICAL);
|
||||||
|
tokenField = addField(contentLayout, "Access token", "", dp(8));
|
||||||
|
tokenField.setHint("16+ bytes for remote access");
|
||||||
|
contentLayout.removeView(tokenField);
|
||||||
|
contentLayout.addView(tokenRow);
|
||||||
|
tokenRow.addView(tokenField, new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT, 1));
|
||||||
|
|
||||||
TextView hint = makeText(
|
Button generate = new Button(this);
|
||||||
"Starts the render server. Offscreen (default): the supervisor "
|
generate.setText("Generate");
|
||||||
+ "(libMobileGLServer.so --serve) runs as a foreground service. On-screen "
|
generate.setAllCaps(false);
|
||||||
+ "window: the server runs in a display Activity that renders the client's "
|
generate.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13);
|
||||||
+ "frames onto this screen (clients opt in with MOBILEGL_IPC_SURFACE=server). "
|
generate.setOnClickListener(v -> {
|
||||||
+ "Endpoint forms: tcp://host:port for remote clients, @name for an "
|
byte[] bytes = new byte[16];
|
||||||
+ "on-device abstract socket, or a filesystem path (relative to the app's "
|
new java.security.SecureRandom().nextBytes(bytes);
|
||||||
+ "files dir) for on-device clients. Non-loopback TCP requires a token of at "
|
StringBuilder hex = new StringBuilder();
|
||||||
+ "least " + MIN_TOKEN_BYTES + " bytes; unix endpoints need none, but GL programs "
|
for (byte b : bytes)
|
||||||
+ "from other apps (Termux, adb shell) reach the server through its broker, which "
|
hex.append(String.format(Locale.ROOT, "%02x", b & 0xff));
|
||||||
+ "needs one (see the launch command below). Extra env "
|
tokenField.setText(hex.toString());
|
||||||
+ "uses the KEY=VALUE;KEY grammar (e.g. MOBILEGL_BACKEND_TYPE=DirectVulkan). "
|
});
|
||||||
+ "One server per device: the two modes replace each other.",
|
tokenRow.addView(generate);
|
||||||
12, COLOR_INFO, false);
|
|
||||||
LinearLayout.LayoutParams hintParams = new LinearLayout.LayoutParams(
|
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
|
||||||
hintParams.topMargin = dp(8);
|
|
||||||
contentLayout.addView(hint, hintParams);
|
|
||||||
|
|
||||||
listenField = addField(contentLayout, "Listen endpoint", DEFAULT_ENDPOINT, dp(16));
|
Button advanced = new Button(this);
|
||||||
tokenField = addField(contentLayout, "Auth token (empty = loopback only)", "", dp(8));
|
advanced.setText("Advanced settings");
|
||||||
envField = addField(contentLayout, "Extra env (optional)", "", dp(8));
|
advanced.setAllCaps(false);
|
||||||
|
contentLayout.addView(advanced);
|
||||||
|
LinearLayout advancedFields = new LinearLayout(this);
|
||||||
|
advancedFields.setOrientation(LinearLayout.VERTICAL);
|
||||||
|
advancedFields.setVisibility(View.GONE);
|
||||||
|
contentLayout.addView(advancedFields);
|
||||||
|
envField = addField(advancedFields, "Environment variables", "", 0);
|
||||||
|
envField.setHint("KEY=VALUE;KEY");
|
||||||
|
advanced.setOnClickListener(v -> toggleSection(advanced, advancedFields, "Advanced settings"));
|
||||||
|
|
||||||
onScreenBox = new CheckBox(this);
|
onScreenBox = new CheckBox(this);
|
||||||
onScreenBox.setText("On-screen window (render client frames onto this screen)");
|
onScreenBox.setText("Show output on screen");
|
||||||
onScreenBox.setTextColor(COLOR_TEXT);
|
onScreenBox.setTextColor(COLOR_TEXT);
|
||||||
onScreenBox.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13);
|
onScreenBox.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13);
|
||||||
LinearLayout.LayoutParams boxParams = new LinearLayout.LayoutParams(
|
LinearLayout.LayoutParams boxParams = new LinearLayout.LayoutParams(
|
||||||
@@ -141,7 +154,7 @@ public final class ServerControlActivity extends Activity {
|
|||||||
addExternalClientSection(contentLayout);
|
addExternalClientSection(contentLayout);
|
||||||
|
|
||||||
if (isServerRunning()) {
|
if (isServerRunning()) {
|
||||||
setStatus("A server is running (started outside this screen).", COLOR_WARN);
|
setStatus("Running", COLOR_WARN);
|
||||||
} else {
|
} else {
|
||||||
setStatus("Stopped.", COLOR_INFO);
|
setStatus("Stopped.", COLOR_INFO);
|
||||||
}
|
}
|
||||||
@@ -384,42 +397,35 @@ public final class ServerControlActivity extends Activity {
|
|||||||
// helper class, the broker component, and how the token travels (the environment, never argv).
|
// helper class, the broker component, and how the token travels (the environment, never argv).
|
||||||
|
|
||||||
private TextView launchCommandView;
|
private TextView launchCommandView;
|
||||||
|
private Button copyLaunchButton;
|
||||||
|
|
||||||
private void addExternalClientSection(LinearLayout parent) {
|
private void addExternalClientSection(LinearLayout parent) {
|
||||||
TextView title = makeText("Same-device GL programs (Termux, adb shell, other apps)", 14, COLOR_TEXT, true);
|
Button localClients = new Button(this);
|
||||||
LinearLayout.LayoutParams titleParams = new LinearLayout.LayoutParams(
|
localClients.setText("Local clients");
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
localClients.setAllCaps(false);
|
||||||
titleParams.topMargin = dp(20);
|
parent.addView(localClients);
|
||||||
parent.addView(title, titleParams);
|
LinearLayout details = new LinearLayout(this);
|
||||||
|
details.setOrientation(LinearLayout.VERTICAL);
|
||||||
|
details.setVisibility(View.GONE);
|
||||||
|
parent.addView(details);
|
||||||
|
localClients.setOnClickListener(v -> toggleSection(localClients, details, "Local clients"));
|
||||||
|
|
||||||
launchCommandView = makeText("", 12, COLOR_INFO, false);
|
launchCommandView = makeText("", 12, COLOR_INFO, false);
|
||||||
launchCommandView.setTextIsSelectable(true);
|
launchCommandView.setTextIsSelectable(true);
|
||||||
LinearLayout.LayoutParams commandParams = new LinearLayout.LayoutParams(
|
LinearLayout.LayoutParams commandParams = new LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||||
commandParams.topMargin = dp(8);
|
commandParams.topMargin = dp(8);
|
||||||
parent.addView(launchCommandView, commandParams);
|
details.addView(launchCommandView, commandParams);
|
||||||
|
|
||||||
LinearLayout row = new LinearLayout(this);
|
LinearLayout row = new LinearLayout(this);
|
||||||
row.setOrientation(LinearLayout.HORIZONTAL);
|
row.setOrientation(LinearLayout.HORIZONTAL);
|
||||||
LinearLayout.LayoutParams rowParams = new LinearLayout.LayoutParams(
|
LinearLayout.LayoutParams rowParams = new LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||||
rowParams.topMargin = dp(8);
|
rowParams.topMargin = dp(8);
|
||||||
parent.addView(row, rowParams);
|
details.addView(row, rowParams);
|
||||||
|
|
||||||
Button generate = new Button(this);
|
|
||||||
generate.setText("Generate token");
|
|
||||||
generate.setAllCaps(false);
|
|
||||||
generate.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13);
|
|
||||||
generate.setOnClickListener(v -> {
|
|
||||||
byte[] bytes = new byte[16];
|
|
||||||
new java.security.SecureRandom().nextBytes(bytes);
|
|
||||||
StringBuilder hex = new StringBuilder();
|
|
||||||
for (byte b : bytes) hex.append(String.format(Locale.ROOT, "%02x", b & 0xff));
|
|
||||||
tokenField.setText(hex.toString());
|
|
||||||
});
|
|
||||||
row.addView(generate);
|
|
||||||
|
|
||||||
Button copy = new Button(this);
|
Button copy = new Button(this);
|
||||||
|
copyLaunchButton = copy;
|
||||||
copy.setText("Copy launch command");
|
copy.setText("Copy launch command");
|
||||||
copy.setAllCaps(false);
|
copy.setAllCaps(false);
|
||||||
copy.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13);
|
copy.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13);
|
||||||
@@ -431,8 +437,7 @@ public final class ServerControlActivity extends Activity {
|
|||||||
android.content.ClipboardManager clipboard = getSystemService(android.content.ClipboardManager.class);
|
android.content.ClipboardManager clipboard = getSystemService(android.content.ClipboardManager.class);
|
||||||
clipboard.setPrimaryClip(android.content.ClipData.newPlainText("MobileGL launch command",
|
clipboard.setPrimaryClip(android.content.ClipData.newPlainText("MobileGL launch command",
|
||||||
launchCommand(tokenField.getText().toString())));
|
launchCommand(tokenField.getText().toString())));
|
||||||
setStatus("Launch command copied (it carries the token: paste it only where you run the program).",
|
android.widget.Toast.makeText(this, "Command copied", android.widget.Toast.LENGTH_SHORT).show();
|
||||||
COLOR_INFO);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
tokenField.addTextChangedListener(new android.text.TextWatcher() {
|
tokenField.addTextChangedListener(new android.text.TextWatcher() {
|
||||||
@@ -453,19 +458,15 @@ public final class ServerControlActivity extends Activity {
|
|||||||
if (launchCommandView == null) return;
|
if (launchCommandView == null) return;
|
||||||
String token = tokenField.getText().toString();
|
String token = tokenField.getText().toString();
|
||||||
boolean usable = token.getBytes().length >= ExternalClientBroker.MIN_TOKEN_BYTES;
|
boolean usable = token.getBytes().length >= ExternalClientBroker.MIN_TOKEN_BYTES;
|
||||||
StringBuilder text = new StringBuilder();
|
launchCommandView.setText(usable ? launchCommand("<token>")
|
||||||
if (!usable) {
|
: "Generate a token, then start the server with on-screen output off.");
|
||||||
text.append("Needs an Auth token of at least ").append(ExternalClientBroker.MIN_TOKEN_BYTES)
|
copyLaunchButton.setEnabled(usable);
|
||||||
.append(" bytes (Generate token), then start the server offscreen.\n\n");
|
}
|
||||||
}
|
|
||||||
text.append(launchCommand(usable ? token : "<token>")).append("\n\n")
|
private void toggleSection(Button button, LinearLayout section, String title) {
|
||||||
.append("Broker: ").append(getPackageName()).append('/').append(ExternalClientBroker.class.getName())
|
boolean opening = section.getVisibility() != View.VISIBLE;
|
||||||
.append("\nThe token travels in the environment (MOBILEGL_IPC_TOKEN, or MOBILEGL_IPC_TOKEN_FILE=<file>)")
|
section.setVisibility(opening ? View.VISIBLE : View.GONE);
|
||||||
.append(", never on the command line. The program runs over shared memory, off the one cpu core")
|
button.setText(opening ? "Hide " + title.toLowerCase(Locale.ROOT) : title);
|
||||||
.append(" the server's render thread takes (--keep-affinity to opt out); the server keeps")
|
|
||||||
.append(" running as a foreground service. Battery: set both this app and the client's app to")
|
|
||||||
.append(" \"No restrictions\".");
|
|
||||||
launchCommandView.setText(text.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {host, port} for tcp://host:port, or null. */
|
/** {host, port} for tcp://host:port, or null. */
|
||||||
|
|||||||
Reference in new issue
Block a user