From f1b10477c28c91f8b29a0ab4a25a149e7f0147db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Tue, 1 Sep 2020 17:04:08 +0200 Subject: GPUOffscreen: Remove scissor and viewport state tracking This was a workaround that is not needed anymore. Fix FT80321 Cropped output with Viewport Render Animation --- source/blender/gpu/intern/gpu_framebuffer.cc | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'source/blender/gpu/intern') diff --git a/source/blender/gpu/intern/gpu_framebuffer.cc b/source/blender/gpu/intern/gpu_framebuffer.cc index ead72bbd0c5..1b6fea56028 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.cc +++ b/source/blender/gpu/intern/gpu_framebuffer.cc @@ -541,13 +541,6 @@ struct GPUOffScreen { GPUTexture *color; GPUTexture *depth; - - /** Saved state of the previously bound framebuffer. */ - /* TODO(fclem) This is quite hacky and a proper fix would be to - * put these states directly inside the GPUFrambuffer. - * But we don't have a GPUFramebuffer for the default framebuffer yet. */ - int saved_viewport[4]; - int saved_scissor[4]; }; /* Returns the correct framebuffer for the current context. */ @@ -642,26 +635,16 @@ void GPU_offscreen_free(GPUOffScreen *ofs) void GPU_offscreen_bind(GPUOffScreen *ofs, bool save) { if (save) { - GPU_scissor_get(ofs->saved_scissor); - GPU_viewport_size_get_i(ofs->saved_viewport); - GPUFrameBuffer *fb = GPU_framebuffer_active_get(); gpuPushFrameBuffer(reinterpret_cast(fb)); } - GPUFrameBuffer *ofs_fb = gpu_offscreen_fb_get(ofs); - GPU_framebuffer_bind(ofs_fb); - glDisable(GL_FRAMEBUFFER_SRGB); - GPU_scissor_test(false); - GPU_shader_set_framebuffer_srgb_target(false); + reinterpret_cast(gpu_offscreen_fb_get(ofs))->bind(false); } -void GPU_offscreen_unbind(GPUOffScreen *ofs, bool restore) +void GPU_offscreen_unbind(GPUOffScreen *UNUSED(ofs), bool restore) { GPUFrameBuffer *fb = NULL; - if (restore) { - GPU_scissor(UNPACK4(ofs->saved_scissor)); - GPU_viewport(UNPACK4(ofs->saved_viewport)); fb = gpuPopFrameBuffer(); } -- cgit v1.2.3