GPUState: Use GPU_viewport to set viewport state in GPU_framebuffer
also fix a small issue in GPU_texture_clear.
This commit is contained in:
parent
adca09b643
commit
e5796233c7
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue