Closed velartrill closed 6 months ago
@velartrill Thanks for reporting. Afaik, most drivers take care of it without further issues...
raylib default shader setups vertex color attribute location because it is used by rlgl batching system (to draw 2d/3d shapes) but most meshes probably do not need them...
Here it is a related issue: https://github.com/raysan5/raylib/issues/3109
Not sure what would be the better solution to address this issue... I vaguely remember having some issue in the past with it...
Please, before submitting a new issue verify and check:
Issue description
when drawing a mesh with the DrawMesh() function, a high-severity GL error is raised if the following two conditions are met:
in vec4 vertexColor
, or the variable is unused in computing the final output and thus elided by the shader compilerthe error as reported by raylib is
the cause of this is rmodels.c:1474, which calls
rlDisableVertexAttribute()
regardless of whether such an attribute was ever enabled ifmesh.vboId[3] == 0
(i.e. the mesh was never given a VBO for vertex color data)it is likely this fairly common case was missed due to a lack of a debug context during testing. i don't know enough about the GL state machine to know how likely this is to cause actual rendering problems; i encountered this as one of large number of errors that mesa reported while trying to debug a GPU crash. i am not yet certain if this bug was the culprit, but at the very least it makes debugging more difficult to have trace output clogged with this error.
i would like to stress that this error cannot be (reliably) fixed by simply adding an
in vec4 vertexColor
to the vertex shader. mesa at the very least will elide variables that cannot be used in the output. a viable workaround might be to forcibly insert an empty VBO into the mesh, bypassing theLoadModel
/GenMesh
API, but this is a rather discomfiting solution as it relies on the knowledge of internal magic numbersit would appear that making this call to
rlDisableVertexAttribute()
conditional upon the presence of a vertex color input location in theShader
object would trivially solve the problem.Environment
nixos unstable (linux 6.1.75), GL 4.5, using mesa software rendering
(LIBGL_ALWAYS_SOFTWARE=1)
. raylib built from master using gcc 13Issue Screenshot
n/a
Code Example