Fixed texture upload from worker threads.

This commit is contained in:
Leonardo Zide
2021-03-13 14:09:08 -08:00
parent a5a794d3fc
commit c8bd036236
3 changed files with 17 additions and 5 deletions
+6 -2
View File
@@ -255,7 +255,7 @@ void lcScene::DrawOpaqueMeshes(lcContext* Context, bool DrawLit, int PrimitiveTy
}
}
const lcTexture* const Texture = Section->Texture;
lcTexture* const Texture = Section->Texture;
int VertexBufferOffset = Mesh->mVertexCacheOffset != -1 ? Mesh->mVertexCacheOffset : 0;
const int IndexBufferOffset = Mesh->mIndexCacheOffset != -1 ? Mesh->mIndexCacheOffset : 0;
@@ -266,6 +266,8 @@ void lcScene::DrawOpaqueMeshes(lcContext* Context, bool DrawLit, int PrimitiveTy
}
else
{
if (Texture->NeedsUpload())
Texture->Upload(Context);
Context->SetMaterial(TexturedMaterial);
VertexBufferOffset += Mesh->mNumVertices * sizeof(lcVertex);
Context->SetVertexFormat(VertexBufferOffset, 3, 1, 2, 0, DrawLit);
@@ -357,7 +359,7 @@ void lcScene::DrawTranslucentMeshes(lcContext* Context, bool DrawLit, bool DrawF
break;
}
const lcTexture* Texture = Section->Texture;
lcTexture* const Texture = Section->Texture;
int VertexBufferOffset = Mesh->mVertexCacheOffset != -1 ? Mesh->mVertexCacheOffset : 0;
const int IndexBufferOffset = Mesh->mIndexCacheOffset != -1 ? Mesh->mIndexCacheOffset : 0;
@@ -368,6 +370,8 @@ void lcScene::DrawTranslucentMeshes(lcContext* Context, bool DrawLit, bool DrawF
}
else
{
if (Texture->NeedsUpload())
Texture->Upload(Context);
Context->SetMaterial(TexturedMaterial);
VertexBufferOffset += Mesh->mNumVertices * sizeof(lcVertex);
Context->SetVertexFormat(VertexBufferOffset, 3, 1, 2, 0, DrawLit);