[core] Thread GLObjectStore through to Holder objects
This eliminates the reliance on ThreadContext to provide GLObjectStore, and statically enforces that GL cleanup functions happen only when GLObjectStore::performCleanup is called. With the elimination of the Map thread, this becomes important because there may be multiple GLObjectStore's per-thread, and Map will need to ensure that the correct context is active when calling GLObjectStore::performCleanup.
This commit is contained in:
@@ -44,22 +44,6 @@ ThreadPriority ThreadContext::getPriority() {
|
||||
}
|
||||
}
|
||||
|
||||
gl::GLObjectStore* ThreadContext::getGLObjectStore() {
|
||||
if (current.get() != nullptr) {
|
||||
return current.get()->glObjectStore;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void ThreadContext::setGLObjectStore(gl::GLObjectStore* glObjectStore) {
|
||||
if (current.get() != nullptr) {
|
||||
current.get()->glObjectStore = glObjectStore;
|
||||
} else {
|
||||
throw std::runtime_error("Current thread has no current ThreadContext.");
|
||||
}
|
||||
}
|
||||
|
||||
class MainThreadContextRegistrar {
|
||||
public:
|
||||
MainThreadContextRegistrar() : context("Main", ThreadType::Main, ThreadPriority::Regular) {
|
||||
|
||||
Reference in New Issue
Block a user