mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 21:58:31 +09:00
[Fix] (MG_Backend/DirectVulkan): drop draws and dispatches when a program has no optimized SPIR-V - a phase-B failure left raw glslang words in GetGeneratedSpirv
This commit is contained in:
@@ -5568,6 +5568,19 @@ void main() {
|
|||||||
MakeXfbWritesVisible();
|
MakeXfbWritesVisible();
|
||||||
VkTextureManager::DrawSyncScope drawSyncScope(*m_textureManager);
|
VkTextureManager::DrawSyncScope drawSyncScope(*m_textureManager);
|
||||||
m_textureManager->CollectGarbage();
|
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<int>(drawProgram.GetLinkStatus()),
|
||||||
|
static_cast<int>(drawProgram.GetSpirvStatus()));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (TrySetupDrawFastPath(frame, mode, aspects, drawParams, pIndexBufferView)) {
|
if (TrySetupDrawFastPath(frame, mode, aspects, drawParams, pIndexBufferView)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -6018,6 +6031,11 @@ void main() {
|
|||||||
m_textureManager->CollectGarbage();
|
m_textureManager->CollectGarbage();
|
||||||
auto& frame = m_frameContext.GetCurrent();
|
auto& frame = m_frameContext.GetCurrent();
|
||||||
const auto& program = *MG_State::pGLContext->GetProgramForDraw();
|
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;
|
ProgramFactory::CompileOptionFlags transformFlags = 0;
|
||||||
const auto& programObj = m_programFactory->GetOrCreateProgram(program, transformFlags);
|
const auto& programObj = m_programFactory->GetOrCreateProgram(program, transformFlags);
|
||||||
|
|
||||||
@@ -6058,6 +6076,11 @@ void main() {
|
|||||||
m_textureManager->CollectGarbage();
|
m_textureManager->CollectGarbage();
|
||||||
auto& frame = m_frameContext.GetCurrent();
|
auto& frame = m_frameContext.GetCurrent();
|
||||||
const auto& program = *MG_State::pGLContext->GetProgramForDraw();
|
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;
|
ProgramFactory::CompileOptionFlags transformFlags = 0;
|
||||||
const auto& programObj = m_programFactory->GetOrCreateProgram(program, transformFlags);
|
const auto& programObj = m_programFactory->GetOrCreateProgram(program, transformFlags);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user