diff --git a/MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.cpp b/MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.cpp index 7448f192..bbcecba6 100644 --- a/MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.cpp +++ b/MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.cpp @@ -5568,6 +5568,19 @@ void main() { MakeXfbWritesVisible(); VkTextureManager::DrawSyncScope drawSyncScope(*m_textureManager); m_textureManager->CollectGarbage(); + { + // Mirror DirectGLES's SyncToBackend gate: a program whose phase-B job failed or + // was cancelled has no usable optimized module - and on an in-place + // SanitizeAndOptimizeBinary failure GetGeneratedSpirv() still holds the RAW + // glslang words, which must never reach vkCreateShaderModule. Drop the draw. + const auto& drawProgram = *MG_State::pGLContext->GetProgramForDraw(); + if (!drawProgram.GetLinkStatus() || !drawProgram.GetSpirvStatus()) { + MGLOG_D("SetupDraw skipped: program=%u is linked=%d spirv=%d", + drawProgram.GetExternalIndex(), static_cast(drawProgram.GetLinkStatus()), + static_cast(drawProgram.GetSpirvStatus())); + return false; + } + } if (TrySetupDrawFastPath(frame, mode, aspects, drawParams, pIndexBufferView)) { return true; } @@ -6018,6 +6031,11 @@ void main() { m_textureManager->CollectGarbage(); auto& frame = m_frameContext.GetCurrent(); const auto& program = *MG_State::pGLContext->GetProgramForDraw(); + if (!program.GetLinkStatus() || !program.GetSpirvStatus()) { + MGLOG_E("DispatchCompute skipped: program=%u has no optimized SPIR-V", + program.GetExternalIndex()); + return; + } ProgramFactory::CompileOptionFlags transformFlags = 0; const auto& programObj = m_programFactory->GetOrCreateProgram(program, transformFlags); @@ -6058,6 +6076,11 @@ void main() { m_textureManager->CollectGarbage(); auto& frame = m_frameContext.GetCurrent(); const auto& program = *MG_State::pGLContext->GetProgramForDraw(); + if (!program.GetLinkStatus() || !program.GetSpirvStatus()) { + MGLOG_E("DispatchComputeIndirect skipped: program=%u has no optimized SPIR-V", + program.GetExternalIndex()); + return; + } ProgramFactory::CompileOptionFlags transformFlags = 0; const auto& programObj = m_programFactory->GetOrCreateProgram(program, transformFlags);