mirror of https://github.com/bjornbytes/lovr.git
Ensure Mesh attachments are unmapped before drawing;
This commit is contained in:
parent
f4b9552052
commit
d71eccfd0b
|
@ -1104,10 +1104,6 @@ void lovrGraphicsDraw(Mesh* mesh, mat4 transform, DefaultShader defaultShader, i
|
|||
|
||||
lovrGraphicsUseProgram(shader->program);
|
||||
lovrShaderBind(shader);
|
||||
|
||||
lovrGraphicsBindVertexArray(mesh->vao);
|
||||
lovrMeshUnmapVertices(mesh);
|
||||
lovrMeshUnmapIndices(mesh);
|
||||
lovrMeshBind(mesh, shader);
|
||||
|
||||
size_t start = mesh->rangeStart;
|
||||
|
|
|
@ -77,12 +77,21 @@ void lovrMeshBind(Mesh* mesh, Shader* shader) {
|
|||
MeshAttachment layout[MAX_ATTACHMENTS];
|
||||
memset(layout, 0, MAX_ATTACHMENTS * sizeof(MeshAttachment));
|
||||
|
||||
lovrGraphicsBindVertexArray(mesh->vao);
|
||||
lovrMeshUnmapVertices(mesh);
|
||||
lovrMeshUnmapIndices(mesh);
|
||||
if (mesh->indexCount > 0) {
|
||||
lovrGraphicsBindIndexBuffer(mesh->ibo);
|
||||
}
|
||||
|
||||
while ((key = map_next(&mesh->attachments, &iter)) != NULL) {
|
||||
int location = lovrShaderGetAttributeId(shader, key);
|
||||
|
||||
if (location >= 0) {
|
||||
MeshAttachment* attachment = map_get(&mesh->attachments, key);
|
||||
layout[location] = *attachment;
|
||||
lovrMeshUnmapVertices(attachment->mesh);
|
||||
lovrMeshUnmapIndices(attachment->mesh);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue