[Bf-blender-cvs] [f1b10477c28] master: GPUOffscreen: Remove scissor and viewport state tracking

Clément Foucault noreply at git.blender.org
Tue Sep 1 17:23:06 CEST 2020


Commit: f1b10477c28c91f8b29a0ab4a25a149e7f0147db
Author: Clément Foucault
Date:   Tue Sep 1 17:04:08 2020 +0200
Branches: master
https://developer.blender.org/rBf1b10477c28c91f8b29a0ab4a25a149e7f0147db

GPUOffscreen: Remove scissor and viewport state tracking

This was a workaround that is not needed anymore.

Fix FT80321 Cropped output with Viewport Render Animation

===================================================================

M	source/blender/gpu/intern/gpu_framebuffer.cc

===================================================================

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<GPUFrameBuffer *>(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<FrameBuffer *>(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();
   }



More information about the Bf-blender-cvs mailing list