[Chore, Test] (MG_State, MG_Util, DirectGLES, DirectVulkan): make SPIR-V validation task-local

This commit is contained in:
2026-08-15 22:58:28 -04:00
parent d4766513e4
commit 14d3901d30
15 changed files with 188 additions and 180 deletions
@@ -104,7 +104,9 @@ namespace MobileGL::MG_State::GLState {
MGLOG_D("ProgramObject %u: Starting SPIR-V generation", externalIndex);
const Bool deferOutputValidationForDirectVulkan =
m_phaseA->in.env != nullptr && m_phaseA->in.env->backend == BackendType::DirectVulkan;
GenerateSpirv(handoff, externalIndex, deferOutputValidationForDirectVulkan);
const Bool enableSpirvValidation = m_phaseA->in.enableSpirvValidation;
artifacts.enableSpirvValidation = enableSpirvValidation;
GenerateSpirv(handoff, externalIndex, deferOutputValidationForDirectVulkan, enableSpirvValidation);
// GlslangToSpv was the only consumer of the parsed ASTs; everything after this point
// works on the SPIR-V and on the TProgram's own self-contained reflection pool. Drop
// them here rather than at the end of the body, which is ~87% of this node's runtime
@@ -140,7 +142,8 @@ namespace MobileGL::MG_State::GLState {
}
void ProgramSpirvTask::GenerateSpirv(const ProgramLinkTask::SpirvHandoff& handoff, const Uint externalIndex,
const Bool deferOutputValidationForDirectVulkan) {
const Bool deferOutputValidationForDirectVulkan,
const Bool enableSpirvValidation) {
/* As we passed first stage compilation/linking,
* we'll assume all the operations here should
* pass. We may be able to employ some optimizations
@@ -173,7 +176,7 @@ namespace MobileGL::MG_State::GLState {
{
for (auto& spv : artifacts.generatedSpirv) {
auto success = ShaderCompiler::SanitizeAndOptimizeBinary(
spv, spv, !deferOutputValidationForDirectVulkan);
spv, spv, !deferOutputValidationForDirectVulkan, enableSpirvValidation);
if (!success) {
// The one genuine phase-B failure mode: one of the seven optimizer passes
// reported failure, so `spv` is whatever the run left behind. A fordebug