mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 21:58:31 +09:00
[Fix] (GLImpl/Program, MG_Backend/DirectGLES): guard against not linked program object
This commit is contained in:
@@ -223,7 +223,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
namespace PrgramImpl {
|
namespace PrgramImpl {
|
||||||
void SyncCurrentProgram() {
|
void SyncCurrentProgram() {
|
||||||
auto currentProgram = MG_State::pGLContext->GetCurrentProgram();
|
auto currentProgram = MG_State::pGLContext->GetCurrentProgram();
|
||||||
if (!currentProgram) {
|
if (!currentProgram || !currentProgram->GetLinkStatus()) {
|
||||||
MG_External::GLES::glUseProgram(0);
|
MG_External::GLES::glUseProgram(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -311,7 +311,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
MG_External::GLES::glActiveTexture(GL_TEXTURE0 + originalActiveUnit);
|
MG_External::GLES::glActiveTexture(GL_TEXTURE0 + originalActiveUnit);
|
||||||
|
|
||||||
const auto& currentProgram = MG_State::pGLContext->GetCurrentProgram();
|
const auto& currentProgram = MG_State::pGLContext->GetCurrentProgram();
|
||||||
if (currentProgram) {
|
if (currentProgram && currentProgram->GetLinkStatus()) {
|
||||||
const auto& backendProgramIt = PrgramImpl::g_backendProgramObjects.find(currentProgram);
|
const auto& backendProgramIt = PrgramImpl::g_backendProgramObjects.find(currentProgram);
|
||||||
if (backendProgramIt != PrgramImpl::g_backendProgramObjects.end()) {
|
if (backendProgramIt != PrgramImpl::g_backendProgramObjects.end()) {
|
||||||
backendProgramIt->second->Use();
|
backendProgramIt->second->Use();
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ namespace MobileGL {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto programObject = TryToGetProgramObject(program);
|
auto programObject = TryToGetProgramObject(program);
|
||||||
if (!programObject) return;
|
if (!programObject || !programObject->GetLinkStatus()) return;
|
||||||
auto attribCount = programObject->GetActiveAttributesCount();
|
auto attribCount = programObject->GetActiveAttributesCount();
|
||||||
if (index >= attribCount) {
|
if (index >= attribCount) {
|
||||||
MG_State::pGLContext->RecordError(
|
MG_State::pGLContext->RecordError(
|
||||||
@@ -183,7 +183,7 @@ namespace MobileGL {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto programObject = TryToGetProgramObject(program);
|
auto programObject = TryToGetProgramObject(program);
|
||||||
if (!programObject) return;
|
if (!programObject || !programObject->GetLinkStatus()) return;
|
||||||
auto uniformCount = programObject->GetUniformCount();
|
auto uniformCount = programObject->GetUniformCount();
|
||||||
if (index >= uniformCount) {
|
if (index >= uniformCount) {
|
||||||
MG_State::pGLContext->RecordError(
|
MG_State::pGLContext->RecordError(
|
||||||
@@ -438,6 +438,7 @@ namespace MobileGL {
|
|||||||
void LinkProgram_State(GLuint program) {
|
void LinkProgram_State(GLuint program) {
|
||||||
auto programObject = TryToGetProgramObject(program);
|
auto programObject = TryToGetProgramObject(program);
|
||||||
if (!programObject) return;
|
if (!programObject) return;
|
||||||
|
MGLOG_D("%s: linking program %d", __func__, program);
|
||||||
programObject->Link();
|
programObject->Link();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -827,7 +828,7 @@ namespace MobileGL {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ValidateProgram_State(GLuint program) {
|
void ValidateProgram_State(GLuint program) {
|
||||||
THROW_UNIMPL_EXCEPTION;
|
// THROW_UNIMPL_EXCEPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AttachShader(GLuint program, GLuint shader) {
|
void AttachShader(GLuint program, GLuint shader) {
|
||||||
|
|||||||
Reference in New Issue
Block a user