mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 14:18:31 +09:00
[Test] (MG_Test): cover the indirect gl_InstanceID probe and shader rewrite
BackendLoaderTest drives ProbeIndirectInstanceIdIncludesBaseInstance (now externally linked) against a fake GLES function table: conforming and ANGLE-style leaking drivers, the no-vertex-SSBO skip, draw-error inconclusiveness, object cleanup, and the FillInGLESCapabilities wiring end-to-end. SanityTest gains PromoteDrawParameterGlobalsToUniforms cases pinning the mg_ZeroBasedInstanceID rewrite and the last-SSBO-binding computation against a non-default binding count, with RAII capability restoration. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -549,8 +549,8 @@ namespace MobileGL::MG_Util::BackendLoader {
|
||||
// vkCmdDraw*Indirect and compiles gl_InstanceID to SPIR-V InstanceIndex, which includes
|
||||
// firstInstance. The DirectGLES native indirect-draw path uses this answer to keep
|
||||
// gl_InstanceID zero-based in rewritten shaders (PromoteDrawParameterGlobalsToUniforms).
|
||||
static Bool ProbeIndirectInstanceIdIncludesBaseInstance(const MG_External::GLESCapabilities& caps,
|
||||
const MG_External::GLESFunctionsTable& f) {
|
||||
Bool ProbeIndirectInstanceIdIncludesBaseInstance(const MG_External::GLESCapabilities& caps,
|
||||
const MG_External::GLESFunctionsTable& f) {
|
||||
const Bool esVersionOk =
|
||||
caps.GLESVersion.Major > 3 || (caps.GLESVersion.Major == 3 && caps.GLESVersion.Minor >= 1);
|
||||
if (!esVersionOk || !f.glDrawArraysIndirect || !f.glBindBufferBase || !f.glMapBufferRange ||
|
||||
|
||||
@@ -1082,6 +1082,11 @@ namespace MobileGL {
|
||||
void AcquireEGLFunctions(MG_External::EGLFunctionsTable& funcs);
|
||||
Bool FillInGLESCapabilities(MG_External::GLESCapabilities& caps,
|
||||
const MG_External::GLESFunctionsTable& glesFuncs);
|
||||
// Detects whether indirect draws leak the command's baseInstance word into
|
||||
// gl_InstanceID (see Loader.cpp). Called by FillInGLESCapabilities; exposed
|
||||
// so MG_Test can drive it against a fake GLES functions table.
|
||||
Bool ProbeIndirectInstanceIdIncludesBaseInstance(const MG_External::GLESCapabilities& caps,
|
||||
const MG_External::GLESFunctionsTable& glesFuncs);
|
||||
} // namespace MG_Util::BackendLoader
|
||||
} // namespace MobileGL
|
||||
#undef MOBILEGL_EXTERNAL_GLES
|
||||
|
||||
Reference in New Issue
Block a user