diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-08-18 22:21:58 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-08-18 22:30:11 +0300 |
commit | e5796233c7039967b033452afc5d5a10e6cb5b3f (patch) | |
tree | 573623288867c748085e57139eaf463222eefe52 /source/blender/gpu/intern/gpu_texture.cc | |
parent | adca09b643d05572321b5015809245493b8dd762 (diff) |
GPUState: Use GPU_viewport to set viewport state in GPU_framebuffer
also fix a small issue in GPU_texture_clear.
Diffstat (limited to 'source/blender/gpu/intern/gpu_texture.cc')
-rw-r--r-- | source/blender/gpu/intern/gpu_texture.cc | 5 |
1 files changed, 5 insertions, 0 deletions
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); } |