mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-09 04:38:30 +09:00
[Test] (MG_Util, MG_State): TEMP spirv-null plumbing probe for the allocator-pathology discriminator
This commit is contained in:
@@ -909,6 +909,19 @@ namespace MobileGL::MG_State::GLState {
|
||||
artifacts.generatedSpirv.size());
|
||||
|
||||
// Linked SPIR-V generated, sanitize and optimize it
|
||||
{
|
||||
// TEMP-STAGE-PROBE: "spirv-null" - the same Optimizer::Run with ZERO passes,
|
||||
// on the pre-optimize binary: pure BuildModule + serialize + IRContext
|
||||
// teardown. Its device/desktop share ratio against "spirv-opt" is the
|
||||
// allocator-pathology discriminator. Costs one extra plumbing round per
|
||||
// module; diagnostic build only.
|
||||
const MG_Util::Debug::TempStageProbeScope tempStageProbeSpirvNull(
|
||||
MG_Util::Debug::kTempStageProbeSpirvNull);
|
||||
for (auto& spv : artifacts.generatedSpirv) {
|
||||
Vector<uint32_t> nullOut;
|
||||
(void)ShaderCompiler::TempProbeNullOptimizeBinary(spv, nullOut);
|
||||
}
|
||||
}
|
||||
{
|
||||
// TEMP-STAGE-PROBE: "spirv-opt" - the spirv-tools optimizer run over every module.
|
||||
const MG_Util::Debug::TempStageProbeScope tempStageProbeSpirvOpt(
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace MobileGL::MG_Util::Debug {
|
||||
kTempStageProbeParseReparse,
|
||||
kTempStageProbeGlslangLink,
|
||||
kTempStageProbeSpirvGen,
|
||||
kTempStageProbeSpirvNull,
|
||||
kTempStageProbeSpirvOpt,
|
||||
kTempStageProbeReflection,
|
||||
kTempStageProbeSpvcRouting,
|
||||
@@ -45,6 +46,7 @@ namespace MobileGL::MG_Util::Debug {
|
||||
"parse-reparse[subset-of-parse]",
|
||||
"glslang-link",
|
||||
"spirv-gen",
|
||||
"spirv-null[plumbing-only]",
|
||||
"spirv-opt",
|
||||
"reflection",
|
||||
"spvc-routing",
|
||||
|
||||
@@ -385,6 +385,19 @@ namespace MobileGL {
|
||||
return optimizer.Run(inputBinary.data(), inputBinary.size(), &outputBinary, options);
|
||||
}
|
||||
|
||||
// TEMP-STAGE-PROBE tempStageProbeNullOptimize: SanitizeAndOptimizeBinary minus
|
||||
// every pass - measures the pure IR plumbing (BuildModule + serialize +
|
||||
// IRContext teardown) so a device run can separate allocator-bound plumbing
|
||||
// from transformation work. Remove with the probes.
|
||||
bool ShaderCompiler::TempProbeNullOptimizeBinary(const Vector<Uint32>& inputBinary,
|
||||
Vector<uint32_t>& outputBinary) {
|
||||
using namespace spvtools;
|
||||
OptimizerOptions options;
|
||||
options.set_run_validator(false);
|
||||
Optimizer optimizer(SPV_ENV_VULKAN_1_1);
|
||||
return optimizer.Run(inputBinary.data(), inputBinary.size(), &outputBinary, options);
|
||||
}
|
||||
|
||||
bool ShaderCompiler::LowerDrawParametersForEssl(const Vector<Uint32>& inputBinary,
|
||||
Vector<uint32_t>& outputBinary) {
|
||||
using namespace spvtools;
|
||||
|
||||
@@ -22,6 +22,10 @@ namespace MobileGL {
|
||||
static Result<Vector<Vector<unsigned>>> GetSpirvBinaryFromProgram(const ProgramBinaryAttrib& attrib);
|
||||
static bool SanitizeAndOptimizeBinary(const Vector<Uint32>& inputBinary,
|
||||
Vector<uint32_t>& outputBinary);
|
||||
// TEMP-STAGE-PROBE: SanitizeAndOptimizeBinary with zero passes - pure IR
|
||||
// plumbing, for the allocator-pathology discriminator. Remove with the probes.
|
||||
static bool TempProbeNullOptimizeBinary(const Vector<Uint32>& inputBinary,
|
||||
Vector<uint32_t>& outputBinary);
|
||||
// Demotes DrawIndex/BaseInstance/BaseVertex builtins to plain Private globals
|
||||
// (mg_DrawID/mg_BaseInstance/mg_BaseVertex) so SPIRV-Cross can emit ESSL.
|
||||
// Only for backends without native draw-parameter support (DirectGLES).
|
||||
|
||||
Reference in New Issue
Block a user