mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 13:48:30 +09:00
[Fix] (MG_Impl/GLImpl, MG_State/GLState): reject unlinked empty programs [skip ci]
This commit is contained in:
@@ -624,6 +624,13 @@ namespace MobileGL::MG_Impl::GLImpl {
|
|||||||
|
|
||||||
auto& programObject = TryToGetProgramObject(program);
|
auto& programObject = TryToGetProgramObject(program);
|
||||||
if (!programObject) return;
|
if (!programObject) return;
|
||||||
|
if (!programObject->GetLinkStatus()) {
|
||||||
|
MG_State::pGLContext->RecordError(
|
||||||
|
ErrorCode::InvalidOperation,
|
||||||
|
MakeUnique<GenericErrorInfo>("MG_Impl/GLImpl", __func__,
|
||||||
|
"program " + std::to_string(program) + " is not linked."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
MG_State::pGLContext->UseProgram(program);
|
MG_State::pGLContext->UseProgram(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -171,6 +171,11 @@ namespace MobileGL::MG_State::GLState {
|
|||||||
if (addDefaultFSIfMissingForRenderingPipelineProgram) {
|
if (addDefaultFSIfMissingForRenderingPipelineProgram) {
|
||||||
AddDefaultFragmentShaderIfMissing();
|
AddDefaultFragmentShaderIfMissing();
|
||||||
}
|
}
|
||||||
|
if (m_shaders.empty()) {
|
||||||
|
m_infoLog = "No shader objects are attached to program.";
|
||||||
|
MGLOG_E("ProgramObject %u: Link failed - no shader objects attached.", m_externalIndex);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::sort(m_shaders.begin(), m_shaders.end(),
|
std::sort(m_shaders.begin(), m_shaders.end(),
|
||||||
[](const SharedPtr<ShaderObject>& a, const SharedPtr<ShaderObject>& b) {
|
[](const SharedPtr<ShaderObject>& a, const SharedPtr<ShaderObject>& b) {
|
||||||
|
|||||||
Reference in New Issue
Block a user