mirror of
https://github.com/leozide/leocad.git
synced 2026-07-27 19:56:49 +00:00
Moved global resource creation to startup instead of context creation. Fixes #645.
This commit is contained in:
+7
-17
@@ -52,6 +52,7 @@ lcPiecesLibrary::~lcPiecesLibrary()
|
||||
mCancelLoading = true;
|
||||
WaitForLoadQueue();
|
||||
Unload();
|
||||
ReleaseBuffers();
|
||||
}
|
||||
|
||||
void lcPiecesLibrary::Unload()
|
||||
@@ -1427,10 +1428,14 @@ void lcPiecesLibrary::GetPieceFile(const char* PieceName, std::function<void(lcF
|
||||
}
|
||||
}
|
||||
|
||||
void lcPiecesLibrary::ReleaseBuffers(lcContext* Context)
|
||||
void lcPiecesLibrary::ReleaseBuffers()
|
||||
{
|
||||
lcContext* Context = lcContext::GetGlobalOffscreenContext();
|
||||
|
||||
Context->MakeCurrent();
|
||||
Context->DestroyVertexBuffer(mVertexBuffer);
|
||||
Context->DestroyIndexBuffer(mIndexBuffer);
|
||||
|
||||
mBuffersDirty = true;
|
||||
}
|
||||
|
||||
@@ -1506,6 +1511,7 @@ void lcPiecesLibrary::UnloadUnusedParts()
|
||||
|
||||
bool lcPiecesLibrary::LoadTexture(lcTexture* Texture)
|
||||
{
|
||||
QMutexLocker Lock(&mTextureMutex);
|
||||
char FileName[2*LC_MAXPATH];
|
||||
|
||||
if (mZipFiles[static_cast<int>(lcZipFileType::Official)])
|
||||
@@ -1541,22 +1547,6 @@ void lcPiecesLibrary::ReleaseTexture(lcTexture* Texture)
|
||||
}
|
||||
}
|
||||
|
||||
void lcPiecesLibrary::QueueTextureUpload(lcTexture* Texture)
|
||||
{
|
||||
QMutexLocker Lock(&mTextureMutex);
|
||||
mTextureUploads.push_back(Texture);
|
||||
}
|
||||
|
||||
void lcPiecesLibrary::UploadTextures(lcContext* Context)
|
||||
{
|
||||
QMutexLocker Lock(&mTextureMutex);
|
||||
|
||||
for (lcTexture* Texture : mTextureUploads)
|
||||
Texture->Upload(Context);
|
||||
|
||||
mTextureUploads.clear();
|
||||
}
|
||||
|
||||
bool lcPiecesLibrary::SupportsStudStyle() const
|
||||
{
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user