mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 21:58:31 +09:00
[Feat] (MG_Impl, DirectGLES): advertise GL_ARB_get_program_binary with no binary format
glProgramParameteri is not core before GL 4.1, so in the 4.0 context the CTS runs it only exists through GL_ARB_get_program_binary or GL_ARB_separate_shader_objects. MobileGL advertised neither, so dEQP's loader left the entry point null - and KHR-GL40.api.coverage, which registers glProgramParameteri from GL 3.2 upwards, called straight through the null pointer and took the process down. GL_NUM_PROGRAM_BINARY_FORMATS was already 0, and the extension explicitly allows an implementation to support no binary format at all; that is the honest state of things here, since a MobileGL program is a glslang link plus a per-backend translation with no serialised form. So the extension is advertised for what it really provides: glProgramParameteri stores GL_PROGRAM_BINARY_RETRIEVABLE_HINT (reported back by glGetProgramiv alongside a GL_PROGRAM_BINARY_LENGTH of zero), glGetProgramBinary is the INVALID_OPERATION the spec requires when that length is zero, and glProgramBinary rejects every format with INVALID_ENUM and leaves the program's LINK_STATUS false. Applications that ask for a binary get the documented "no formats" answer and fall back, which is what they already had to do - only now they can ask.
This commit is contained in:
@@ -377,6 +377,17 @@ namespace MobileGL::MG_State::GLState {
|
||||
|
||||
Bool GetDeleteStatus() const { return m_deleteStatus; }
|
||||
Bool GetLinkStatus() const { return m_linkStatus; }
|
||||
// GL_PROGRAM_BINARY_RETRIEVABLE_HINT. MobileGL exposes no program binary format
|
||||
// (GL_NUM_PROGRAM_BINARY_FORMATS is 0), so the hint is pure state - which is all
|
||||
// ARB_get_program_binary requires of it.
|
||||
Bool GetBinaryRetrievableHint() const { return m_binaryRetrievableHint; }
|
||||
void SetBinaryRetrievableHint(Bool hint) { m_binaryRetrievableHint = hint; }
|
||||
// glProgramBinary always fails here (there is no format it could accept) and the
|
||||
// spec then requires the program's LINK_STATUS to read FALSE.
|
||||
void MarkLinkFailedByProgramBinary() {
|
||||
ResetLinkArtifacts();
|
||||
m_infoLog = "No program binary format is supported.";
|
||||
}
|
||||
Bool GetValidateStatus() const { return m_validateStatus; }
|
||||
Int GetActiveAtomicCounterCount() const { return m_program->getNumAtomicCounters(); }
|
||||
Int GetActiveAttributesCount() const { return m_program->getNumPipeInputs(); }
|
||||
@@ -593,6 +604,7 @@ namespace MobileGL::MG_State::GLState {
|
||||
String m_infoLog;
|
||||
Bool m_deleteStatus = false;
|
||||
Bool m_linkStatus = false;
|
||||
Bool m_binaryRetrievableHint = false;
|
||||
Bool m_validateStatus = true;
|
||||
Uint32 m_backendStateVersion = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user