SRP Batcher for Particle Systems: Not rendered on Android OpenGL ES

Hi,

I’m trying to implement SRP Batcher for Particle Systems with source code.

Particles are not shown on Android OpenGL ES with the APK, however, the rendering is basically good in RenderDoc capturing from the phone (if opening the capture in Local, which renders in Windows, or Remote, which renders on the phone, context).

If editor Console is connected to the phone, I get:
AndroidPlayer(ADB@127.0.0.1:34999) Assertion failed: glDrawElementsBaseVertex: GL_INVALID_OPERATION: Operation illegal in current state
AndroidPlayer(ADB@127.0.0.1:34999) Assertion failed: OpenGL Error after calling glDrawElementsBaseVertex(4, 300, 5123, 0x0, 144)
AndroidPlayer(ADB@127.0.0.1:34999) Assertion failed: glDrawElements: GL_INVALID_OPERATION: Operation illegal in current state
AndroidPlayer(ADB@127.0.0.1:34999) Assertion failed: OpenGL Error after calling glDrawElements(4, 300, 5123, 0x708)
AndroidPlayer(ADB@127.0.0.1:34999) Assertion failed: OpenGL Error after calling glDrawElementsBaseVertex(4, 300, 5123, 0x258, 344)
AndroidPlayer(ADB@127.0.0.1:34999) Assertion failed: OpenGL Error after calling glDrawElementsBaseVertex(4, 300, 5123, 0x4b0, 689)
AndroidPlayer(ADB@127.0.0.1:34999) Assertion failed: OpenGL Error after calling glDrawElementsBaseVertex(4, 300, 5123, 0x708, 1285)
AndroidPlayer(ADB@127.0.0.1:34999) Assertion failed: OpenGL Error after calling glDrawElementsBaseVertex(4, 300, 5123, 0x708, 786)

What could be the reasons?

Thanks.

https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glDrawElementsBaseVertex.xhtml

The only relevant information is something might not be unmapped, however, if an unmap is missing in GfxDeviceGLES > DrawBuffersBatchMode(), it should be equally missing for MeshRenderer.

The error is not specific to glDrawElementsBaseVertex, even with a single Particle System:
AndroidPlayer(ADB@127.0.0.1:34999) Assertion failed: glDrawElements: GL_INVALID_OPERATION: Operation illegal in current state
AndroidPlayer(ADB@127.0.0.1:34999) Assertion failed: OpenGL Error after calling glDrawElements(4, 300, 5123, 0x0)

Is it vertex buffer that is not unmapped?

Hi @aleksandrk , then basically I will need to unmap the vertex buffer and index buffer before ScriptableBatchRenderer::RenderMultipleMeshes() > device.DrawBuffersBatchMode(deviceBatchParams), how do I do that? Thanks.

https://www.khronos.org/registry/OpenGL-Refpages/es3.0/html/glMapBufferRange.xhtml

I’m doing unmapping directly in GfxDeviceGLES :: DrawBuffersBatchMode() mimicking BufferGLES::EndWrite():
//pVbBufferGLES->GetActiveBuffer()->FlushMappedRange(0, pVbBufferGLES->GetActiveBuffer()->GetSize());
pVbBufferGLES->GetActiveBuffer()->Unmap();
pVbBufferGLES->SetIsMapped(false);

The rendering is now correct, just these code might break the integrity of state and results in some assertion failures.