summaryrefslogtreecommitdiff
path: root/servers/rendering/rasterizer_rd
diff options
context:
space:
mode:
authorRafał Mikrut <mikrutrafal54@gmail.com>2020-04-01 19:29:35 +0200
committerRafał Mikrut <mikrutrafal54@gmail.com>2020-04-01 19:29:35 +0200
commit359bebd8c08a626e64ade1ac45c3c925352bd8a4 (patch)
tree83769dbf9cdb5ca7e6dee2e04b95dfc2c1f587c4 /servers/rendering/rasterizer_rd
parent0168709978154a89f137b44f33647e5d28a46250 (diff)
Fix out of bound array access caused by unassigned variable
Diffstat (limited to 'servers/rendering/rasterizer_rd')
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_scene_rd.h6
-rw-r--r--servers/rendering/rasterizer_rd/rasterizer_storage_rd.h14
2 files changed, 10 insertions, 10 deletions
diff --git a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.h b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.h
index 0a1cc8ebd7..2b30855915 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.h
+++ b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.h
@@ -571,7 +571,7 @@ private:
Rect2 atlas_rect;
};
- RS::LightType light_type;
+ RS::LightType light_type = RS::LIGHT_DIRECTIONAL;
ShadowTransform shadow_transform[4];
@@ -581,7 +581,7 @@ private:
Vector3 light_vector;
Vector3 spot_vector;
- float linear_att;
+ float linear_att = 0.0;
uint64_t shadow_pass = 0;
uint64_t last_scene_pass = 0;
@@ -590,7 +590,7 @@ private:
uint32_t light_index = 0;
uint32_t light_directional_index = 0;
- uint32_t current_shadow_atlas_key;
+ uint32_t current_shadow_atlas_key = 0;
Vector2 dp;
diff --git a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.h b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.h
index e69be644d7..ab02ca1331 100644
--- a/servers/rendering/rasterizer_rd/rasterizer_storage_rd.h
+++ b/servers/rendering/rasterizer_rd/rasterizer_storage_rd.h
@@ -218,7 +218,7 @@ private:
struct Mesh {
struct Surface {
- RS::PrimitiveType primitive;
+ RS::PrimitiveType primitive = RS::PRIMITIVE_POINTS;
uint32_t format = 0;
RID vertex_buffer;
@@ -232,8 +232,8 @@ private:
// cache-efficient structure.
struct Version {
- uint32_t input_mask;
- RD::VertexFormatID vertex_format;
+ uint32_t input_mask = 0;
+ RD::VertexFormatID vertex_format = 0;
RID vertex_array;
};
@@ -246,7 +246,7 @@ private:
uint32_t index_count = 0;
struct LOD {
- float edge_length;
+ float edge_length = 0.0;
RID index_buffer;
RID index_array;
};
@@ -456,9 +456,9 @@ private:
RID color;
//used for retrieving from CPU
- RD::DataFormat color_format;
- RD::DataFormat color_format_srgb;
- Image::Format image_format;
+ RD::DataFormat color_format = RD::DATA_FORMAT_R4G4_UNORM_PACK8;
+ RD::DataFormat color_format_srgb = RD::DATA_FORMAT_R4G4_UNORM_PACK8;
+ Image::Format image_format = Image::FORMAT_L8;
bool flags[RENDER_TARGET_FLAG_MAX];