GPUFrameBuffer: Put active framebuffer in GPUContext
instead of being ThreadLocal and leading to incorrect usage. We still enforce no framebuffer when changing context. We can lift this restriction later.
This commit is contained in:
@@ -69,6 +69,7 @@ static std::mutex orphans_mutex;
|
||||
|
||||
struct GPUContext {
|
||||
GLuint default_vao;
|
||||
GPUFrameBuffer *current_fbo;
|
||||
std::unordered_set<GPUBatch *> batches; /* Batches that have VAOs from this context */
|
||||
#ifdef DEBUG
|
||||
std::unordered_set<GPUFrameBuffer *> framebuffers; /* Framebuffers that have FBO from this context */
|
||||
@@ -82,6 +83,7 @@ struct GPUContext {
|
||||
|
||||
GPUContext() {
|
||||
thread_is_used = false;
|
||||
current_fbo = 0;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
@@ -315,3 +317,13 @@ void gpu_context_remove_framebuffer(GPUContext *ctx, GPUFrameBuffer *fb)
|
||||
UNUSED_VARS(ctx, fb);
|
||||
#endif
|
||||
}
|
||||
|
||||
void gpu_context_active_framebuffer_set(GPUContext *ctx, GPUFrameBuffer *fb)
|
||||
{
|
||||
ctx->current_fbo = fb;
|
||||
}
|
||||
|
||||
GPUFrameBuffer *gpu_context_active_framebuffer_get(GPUContext *ctx)
|
||||
{
|
||||
return ctx->current_fbo;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user