Fix: EEVEE: Avoid Valgrind issues

Running valgrind on a render test exhibit a lot of warnings
about `Conditional jump or move depends on uninitialised value(s)`.

This patch makes sure to initialize the memory to avoid
platform dependent bugs.

Pull Request: https://projects.blender.org/blender/blender/pulls/144995
This commit is contained in:
Clément Foucault
2025-08-25 14:05:50 +02:00
committed by Clément Foucault
parent 5c325c394a
commit 87fe13fb7b
11 changed files with 19 additions and 14 deletions

View File

@@ -28,7 +28,7 @@ class AmbientOcclusion {
private:
class Instance &inst_;
bool render_pass_enabled_;
bool render_pass_enabled_ = false;
int ray_count_ = 0;
int step_count_ = 0;

View File

@@ -105,7 +105,7 @@ class Camera {
float radius;
} bound_sphere;
float overscan_;
float overscan_ = -1.0f;
bool overscan_changed_;
/** Whether or not the camera was synced from a camera object. */
bool is_camera_object_ = false;

View File

@@ -70,7 +70,7 @@ class Film {
gpu::Texture *combined_final_tx_ = nullptr;
/** Are we using the compute shader/pipeline. */
bool use_compute_;
bool use_compute_ = false;
/** Copy of v3d->shading properties used to detect viewport settings update. */
eViewLayerEEVEEPassType ui_render_pass_ = eViewLayerEEVEEPassType(0);
@@ -96,7 +96,7 @@ class Film {
PassSimple cryptomatte_post_ps_ = {"Film.Cryptomatte.Post"};
FilmData &data_;
int2 display_extent;
int2 display_extent = int2(-1);
eViewLayerEEVEEPassType enabled_passes_ = eViewLayerEEVEEPassType(0);
/* Store the pass types needed by the viewport compositor separately, because some passes might

View File

@@ -272,9 +272,12 @@ void Instance::init_light_bake(Depsgraph *depsgraph, draw::Manager *manager)
rcti empty_rect{0, 0, 0, 0};
film.init(int2(1), &empty_rect);
render_buffers.init();
ambient_occlusion.init();
velocity.init();
raytracing.init();
depth_of_field.init();
shadows.init();
motion_blur.init();
main_view.init();
light_probes.init();
planar_probes.init();

View File

@@ -55,7 +55,7 @@ namespace blender::eevee {
/* Combines data from several modules to avoid wasting binding slots. */
struct UniformDataModule {
UniformDataBuf data;
UniformDataBuf data = {"UniformDataBuf"};
void push_update()
{

View File

@@ -63,7 +63,7 @@ class Sampling {
*/
static constexpr int interactive_mode_threshold = 3;
SamplingDataBuf data_;
SamplingDataBuf data_ = {"SamplingDataBuf"};
ClampData &clamp_data_;

View File

@@ -76,10 +76,10 @@ struct ShadowTileMap : public ShadowTileMapData {
/** Cube face index. */
eCubeFace cubeface = Z_NEG;
/** Cached, used for detecting updates. */
float4x4 object_mat;
float4x4 object_mat = float4x4::identity();
public:
ShadowTileMap(int tiles_index_)
ShadowTileMap(int tiles_index_) : ShadowTileMapData{}
{
tiles_index = tiles_index_;
/* For now just the same index. */

View File

@@ -303,7 +303,7 @@ template<
/* bool device_only = false */>
class UniformBuffer : public T, public detail::UniformCommon<T, 1, false> {
public:
UniformBuffer(const char *name = nullptr) : detail::UniformCommon<T, 1, false>(name)
UniformBuffer(const char *name = nullptr) : T{}, detail::UniformCommon<T, 1, false>(name)
{
/* TODO(@fclem): How could we map this? */
this->data_ = static_cast<T *>(this);
@@ -496,7 +496,7 @@ template<
bool device_only = false>
class StorageBuffer : public T, public detail::StorageCommon<T, 1, device_only> {
public:
StorageBuffer(const char *name = nullptr) : detail::StorageCommon<T, 1, device_only>(name)
StorageBuffer(const char *name = nullptr) : T{}, detail::StorageCommon<T, 1, device_only>(name)
{
/* TODO(@fclem): How could we map this? */
this->data_ = static_cast<T *>(this);

View File

@@ -19,7 +19,7 @@
namespace blender::gpu {
GPUCapabilities GCaps;
GPUCapabilities GCaps = {};
}

View File

@@ -28,11 +28,11 @@ class VertBuf;
class StorageBuf {
protected:
/** Data size in bytes. Doesn't need to match actual allocation size due to alignment rules. */
size_t size_in_bytes_;
size_t size_in_bytes_ = -1;
/** Continuous memory block to copy to GPU. This data is owned by the StorageBuf. */
void *data_ = nullptr;
/** Debugging name */
char name_[DEBUG_NAME_LEN];
char name_[DEBUG_NAME_LEN] = {};
public:
StorageBuf(size_t size, const char *name);

View File

@@ -10,6 +10,8 @@
#include "MEM_guardedalloc.h"
#include "GPU_vertex_buffer.hh"
#include "gpu_storage_buffer_private.hh"
namespace blender {
@@ -25,7 +27,7 @@ class GLStorageBuf : public StorageBuf {
/** OpenGL Object handle. */
GLuint ssbo_id_ = 0;
/** Usage type. */
GPUUsageType usage_;
GPUUsageType usage_ = GPUUsageType(-1);
/* Read */
GLuint read_ssbo_id_ = 0;
GLsync read_fence_ = 0;