mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-13 14:48:32 +09:00
[Fix] (MG_Util, MG_State): reject reserved GLSL identifiers glslang accepts
glslang parses "packed" and "row_major" as plain identifiers outside a layout(...) list and accepts the reserved image*Shadow names outright. A comment/preprocessor-aware pre-scan in the compile path now fails such shaders with a proper info log, while layout(packed)/layout(row_major) qualifier lists stay legal (uniform_block family still passes). KHR-GL31/32/33.CommonBugs.CommonBug_ReservedNames now pass.
This commit is contained in:
@@ -169,6 +169,15 @@ namespace MobileGL::MG_State::GLState {
|
||||
}
|
||||
}
|
||||
|
||||
const std::optional<String> reservedError =
|
||||
MG_Util::ShaderTranspiler::FindReservedIdentifierViolation(compileSource);
|
||||
if (reservedError) {
|
||||
m_compileStatus = false;
|
||||
m_shader.reset();
|
||||
m_infoLog = *reservedError;
|
||||
return;
|
||||
}
|
||||
|
||||
// Compile for OpenGL here, so that we can do validation and link
|
||||
// like a real OpenGL driver at linking stage
|
||||
// Will compile for other backends later.
|
||||
|
||||
Reference in New Issue
Block a user