diff options
Diffstat (limited to 'source/blender/gpu/intern/gpu_context.cpp')
-rw-r--r-- | source/blender/gpu/intern/gpu_context.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_context.cpp b/source/blender/gpu/intern/gpu_context.cpp index a0e03e61d5d..12a5748b198 100644 --- a/source/blender/gpu/intern/gpu_context.cpp +++ b/source/blender/gpu/intern/gpu_context.cpp @@ -36,6 +36,7 @@ #include "gpu_batch_private.h" #include "gpu_context_private.h" +#include "gpu_matrix_private.h" #include <vector> #include <string.h> @@ -71,6 +72,7 @@ struct GPUContext { std::unordered_set<GPUFrameBuffer *> framebuffers; /* Framebuffers that have FBO from this context */ #endif + struct GPUMatrixState *matrix_state; std::vector<GLuint> orphaned_vertarray_ids; std::vector<GLuint> orphaned_framebuffer_ids; std::mutex orphans_mutex; /* todo: try spinlock instead */ @@ -144,6 +146,7 @@ GPUContext *GPU_context_create(GLuint default_framebuffer) GPUContext *ctx = new GPUContext; glGenVertexArrays(1, &ctx->default_vao); ctx->default_framebuffer = default_framebuffer; + ctx->matrix_state = GPU_matrix_state_create(); GPU_context_active_set(ctx); return ctx; } @@ -164,6 +167,7 @@ void GPU_context_discard(GPUContext *ctx) /* this removes the array entry */ GPU_batch_vao_cache_clear(*ctx->batches.begin()); } + GPU_matrix_state_discard(ctx->matrix_state); glDeleteVertexArrays(1, &ctx->default_vao); delete ctx; active_ctx = NULL; @@ -338,3 +342,9 @@ GPUFrameBuffer *gpu_context_active_framebuffer_get(GPUContext *ctx) { return ctx->current_fbo; } + +struct GPUMatrixState *gpu_context_active_matrix_state_get() +{ + BLI_assert(active_ctx); + return active_ctx->matrix_state; +} |