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-18 22:21:58 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-08-18 22:30:11 +0300
commite5796233c7039967b033452afc5d5a10e6cb5b3f (patch)
tree573623288867c748085e57139eaf463222eefe52
parentadca09b643d05572321b5015809245493b8dd762 (diff)
GPUState: Use GPU_viewport to set viewport state in GPU_framebuffer
also fix a small issue in GPU_texture_clear.
-rw-r--r--source/blender/gpu/intern/gpu_framebuffer.cc6
-rw-r--r--source/blender/gpu/intern/gpu_texture.cc5
2 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/gpu/intern/gpu_framebuffer.cc b/source/blender/gpu/intern/gpu_framebuffer.cc
index a94212969b9..da8ab80b347 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.cc
+++ b/source/blender/gpu/intern/gpu_framebuffer.cc
@@ -552,7 +552,7 @@ void GPU_framebuffer_bind(GPUFrameBuffer *fb)
}
#endif
- glViewport(0, 0, fb->width, fb->height);
+ GPU_viewport(0, 0, fb->width, fb->height);
}
/* Workaround for binding a srgb framebuffer without doing the srgb transform. */
@@ -611,7 +611,7 @@ void GPU_framebuffer_viewport_set(GPUFrameBuffer *fb, int x, int y, int w, int h
{
CHECK_FRAMEBUFFER_IS_BOUND(fb);
- glViewport(x, y, w, h);
+ GPU_viewport(x, y, w, h);
}
void GPU_framebuffer_clear(GPUFrameBuffer *fb,
@@ -866,7 +866,7 @@ void GPU_framebuffer_recursive_downsample(GPUFrameBuffer *fb,
BLI_assert(GL_FRAMEBUFFER_COMPLETE == glCheckFramebufferStatus(GL_FRAMEBUFFER));
- glViewport(0, 0, current_dim[0], current_dim[1]);
+ GPU_viewport(0, 0, current_dim[0], current_dim[1]);
callback(userData, i);
if (current_dim[0] == 1 && current_dim[1] == 1) {
diff --git a/source/blender/gpu/intern/gpu_texture.cc b/source/blender/gpu/intern/gpu_texture.cc
index a0a230f2980..91990dac83f 100644
--- a/source/blender/gpu/intern/gpu_texture.cc
+++ b/source/blender/gpu/intern/gpu_texture.cc
@@ -1611,6 +1611,9 @@ void GPU_texture_clear(GPUTexture *tex, eGPUDataFormat gpu_data_format, const vo
/* This means that this function can only be used in one context for each texture. */
BLI_assert(tex->copy_fb_ctx == GPU_context_active_get());
+ int viewport[4];
+ GPU_viewport_size_get_i(viewport);
+
glBindFramebuffer(GL_FRAMEBUFFER, tex->copy_fb);
glViewport(0, 0, tex->w, tex->h);
@@ -1675,6 +1678,8 @@ void GPU_texture_clear(GPUTexture *tex, eGPUDataFormat gpu_data_format, const vo
glClear(GL_COLOR_BUFFER_BIT);
}
+ glViewport(UNPACK4(viewport));
+
if (prev_fb) {
GPU_framebuffer_bind(prev_fb);
}