The various Graphics::Draw(...)
calls all seem to start with something along the line of an if check ensuring the state is acceptable and possibly a compiler define check (example below). If the conditions are not met, Draw just silently returns, making it impossible to tell if the call succeeded from both the calling code (e.g. a boolean success state return) and from the log.
#if !defined(GL_ES_VERSION_2_0) || defined(__EMSCRIPTEN__)
if (!indexCount || !indexBuffer_ || !indexBuffer_->GetGPUObjectName() || !instancingSupport_)
return;
This ended up making it a ~3 hour process to figure out why the ImGui integration was failing to draw on an Emscripten build, rather than a ~3 minute process. As such, I was wondering if adding at least a log message would be acceptable, something like
#if !defined(GL_ES_VERSION_2_0) || defined(__EMSCRIPTEN__)
if (!indexCount || !indexBuffer_ || !indexBuffer_->GetGPUObjectName() || !instancingSupport_)
{
URHO3D_LOGERROR("Invalid call to Graphics::DrawInstanced(PrimitiveType type, unsigned indexStart, unsigned indexCount, unsigned minVertex, unsigned vertexCount,
unsigned instanceCount)");
return;
}
...
#else
URHO3D_LOGERROR("Unsupported draw call Graphics::DrawInstanced(PrimitiveType type, unsigned indexStart, unsigned indexCount, unsigned minVertex, unsigned vertexCount,
unsigned instanceCount)");
#endif
Does this sound like a good idea? The main exception I can think of is that a call to Draw with 0 indices could be viewed as succeeding by doing nothing, so that case should possibly be excluded from logging the error.