[Bf-blender-cvs] [c3e832144b0] blender-v2.91-release: GPU: Fix valgrind warnings about branching on uninitialized variables

Clément Foucault noreply at git.blender.org
Thu Nov 5 18:00:37 CET 2020


Commit: c3e832144b0d22e3da883330212247808a9db2cf
Author: Clément Foucault
Date:   Thu Nov 5 17:59:07 2020 +0100
Branches: blender-v2.91-release
https://developer.blender.org/rBc3e832144b0d22e3da883330212247808a9db2cf

GPU: Fix valgrind warnings about branching on uninitialized variables

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

M	source/blender/gpu/intern/gpu_framebuffer_private.hh
M	source/blender/gpu/intern/gpu_immediate_private.hh

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

diff --git a/source/blender/gpu/intern/gpu_framebuffer_private.hh b/source/blender/gpu/intern/gpu_framebuffer_private.hh
index 87f0f3823e6..7afa56bfe3d 100644
--- a/source/blender/gpu/intern/gpu_framebuffer_private.hh
+++ b/source/blender/gpu/intern/gpu_framebuffer_private.hh
@@ -100,10 +100,10 @@ class FrameBuffer {
   /** Debug name. */
   char name_[DEBUG_NAME_LEN];
   /** Frame-buffer state. */
-  int viewport_[4];
-  int scissor_[4];
+  int viewport_[4] = {0};
+  int scissor_[4] = {0};
   bool scissor_test_ = false;
-  bool dirty_state_;
+  bool dirty_state_ = true;
 
  public:
   FrameBuffer(const char *name);
diff --git a/source/blender/gpu/intern/gpu_immediate_private.hh b/source/blender/gpu/intern/gpu_immediate_private.hh
index e6c11120d7e..9fcbe2bdc0b 100644
--- a/source/blender/gpu/intern/gpu_immediate_private.hh
+++ b/source/blender/gpu/intern/gpu_immediate_private.hh
@@ -47,7 +47,7 @@ class Immediate {
 
   /** Current draw call specification. */
   GPUPrimType prim_type = GPU_PRIM_NONE;
-  GPUVertFormat vertex_format;
+  GPUVertFormat vertex_format = {};
   GPUShader *shader = NULL;
   /** Enforce strict vertex count (disabled when using immBeginAtMost). */
   bool strict_vertex_len = true;



More information about the Bf-blender-cvs mailing list