Page MenuHome

Gawain hardcoded limit of 16 attributes leads to crashes
Open, Confirmed, MediumPublic

Description

Crash when using a high number of attributes (UVs and Vertex Colors), which is more common than not in production files.

How to reproduce:

  • Change to Eevee
  • Add 8 UV maps
  • Add 8 Vertex colors
  • Go to edit mode

BOOM

Alternatively, just open this simple file.

Error:

"vertex_format.c:184: VertexFormat_add_alias: Assertion `format->name_ct < MAX_VERTEX_ATTRIBS' failed."

Full backtrace: P482

Details

Type
Bug

Related Objects

Event Timeline

Gawain limit actually makes sense because Blender has a limit of 8 UV channels and 8 Vcol channels = 16 attribute.

The thing is that Tangents adds 8 possible layers to this limit, and then we still need to include the Positions and Normals.

I still need to create more aliases for certain attrib but this should not get into the limit number.

I also want to point out that this limit should not be inside the VertexFormat but rather inside the ShaderInterface. This limit is for bound attributes, not how many are present in vertex format (even if the smaller the format the better but that's another issue).

Exceeding this limit should also not crash blender, and that would mean handling the overuse of attribs higher in the pipeline (i.e. gpu_codegen.c) to not provoke shader compilation errors.

Moreover, we should use GL_MAX_VERTEX_ATTRIBS to define this limit.

Gawain's limit matches common hardware limits, that's why it's 16. This applies to active attributes in the shader. I talked with @Clément Foucault (fclem) before about aliases — these don't belong in VertexFormat, and the limit should not apply to them. VertexBuffer or Batch is a better place to track aliases... still need to figure out the details!

I accept that my implementation of aliases is flawed and should be revisited.

Still this hard coded limit of 16 should be in the ShaderInterface.

And we should not limit the number of attributes in a VBO. Opengl doesn't have a limit on this. It's only on how many attributes are currently bound for drawing.

@Mike Erwin (merwin) any time frame on when can we expect this to be addressed?

I ran into this limitation twice already in production files. One of them is the one we plan to use to demo Opensubdiv once this gets back in 2.8 (Sintel's dragon). The other one of the potential demo files for Siggraph.

I'm working on this now! Should have a better solution in a few days.