Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-08-29 15:03:15 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-08-30 14:11:03 +0300
commit0f372f3966c434da5faa8e221f9da2aa48999a61 (patch)
tree08ed30ca3f78cf767691c7b3575703ce25cfb9ee /source/blender/gpu/opengl
parentbb530a77b638d1ccab779e1f43675030597f995e (diff)
GPUContext: Update internal framebuffer size when activating context
This is to ensure the FrameBuffer extents are always up to date.
Diffstat (limited to 'source/blender/gpu/opengl')
-rw-r--r--source/blender/gpu/opengl/gl_context.cc22
-rw-r--r--source/blender/gpu/opengl/gl_framebuffer.cc3
2 files changed, 23 insertions, 2 deletions
diff --git a/source/blender/gpu/opengl/gl_context.cc b/source/blender/gpu/opengl/gl_context.cc
index 8c1022c8fd1..380b396f0cd 100644
--- a/source/blender/gpu/opengl/gl_context.cc
+++ b/source/blender/gpu/opengl/gl_context.cc
@@ -55,6 +55,7 @@ GLContext::GLContext(void *ghost_window, GLSharedOrphanLists &shared_orphan_list
glBindBuffer(GL_ARRAY_BUFFER, 0);
state_manager = new GLStateManager();
+ ghost_window_ = ghost_window;
if (ghost_window) {
GLuint default_fbo = GHOST_GetDefaultOpenGLFramebuffer((GHOST_WindowHandle)ghost_window);
@@ -129,6 +130,27 @@ void GLContext::activate(void)
/* Clear accumulated orphans. */
orphans_clear();
+
+ if (ghost_window_) {
+ /* Get the correct framebuffer size for the internal framebuffers. */
+ GHOST_RectangleHandle bounds = GHOST_GetClientBounds((GHOST_WindowHandle)ghost_window_);
+ int w = GHOST_GetWidthRectangle(bounds);
+ int h = GHOST_GetHeightRectangle(bounds);
+ GHOST_DisposeRectangle(bounds);
+
+ if (front_left) {
+ front_left->size_set(w, h);
+ }
+ if (back_left) {
+ back_left->size_set(w, h);
+ }
+ if (front_right) {
+ front_right->size_set(w, h);
+ }
+ if (back_right) {
+ back_right->size_set(w, h);
+ }
+ }
}
void GLContext::deactivate(void)
diff --git a/source/blender/gpu/opengl/gl_framebuffer.cc b/source/blender/gpu/opengl/gl_framebuffer.cc
index bf2a782b083..7e50d37928e 100644
--- a/source/blender/gpu/opengl/gl_framebuffer.cc
+++ b/source/blender/gpu/opengl/gl_framebuffer.cc
@@ -214,8 +214,7 @@ void GLFrameBuffer::update_attachments(void)
GPUAttachment &attach = attachments_[first_attachment];
int size[3];
GPU_texture_get_mipmap_size(attach.tex, attach.mip, size);
- width_ = size[0];
- height_ = size[1];
+ this->size_set(size[0], size[1]);
srgb_ = (GPU_texture_format(attach.tex) == GPU_SRGB8_A8);
}