diff options
author | dzil123 <5725958+dzil123@users.noreply.github.com> | 2022-11-22 01:44:19 -0800 |
---|---|---|
committer | dzil123 <5725958+dzil123@users.noreply.github.com> | 2022-11-22 03:48:32 -0800 |
commit | b4437cbaa6a293f9b92e64f934d17f6798418368 (patch) | |
tree | bb9ad03f8d220cdcc4b6b332307c79f6e3757e50 | |
parent | 4b4e701e06ecae6f754d206016b8dec5b9bb62d4 (diff) |
Fix various missing rendering parameter checks
-rw-r--r-- | drivers/gles3/storage/mesh_storage.cpp | 2 | ||||
-rw-r--r-- | drivers/gles3/storage/texture_storage.cpp | 1 | ||||
-rw-r--r-- | servers/rendering/renderer_rd/renderer_scene_render_rd.cpp | 2 |
3 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gles3/storage/mesh_storage.cpp b/drivers/gles3/storage/mesh_storage.cpp index a47df42500..1f169dfff7 100644 --- a/drivers/gles3/storage/mesh_storage.cpp +++ b/drivers/gles3/storage/mesh_storage.cpp @@ -1352,6 +1352,8 @@ void MeshStorage::multimesh_set_buffer(RID p_multimesh, const Vector<float> &p_b uint32_t old_stride = multimesh->xform_format == RS::MULTIMESH_TRANSFORM_2D ? 8 : 12; old_stride += multimesh->uses_colors ? 4 : 0; old_stride += multimesh->uses_custom_data ? 4 : 0; + ERR_FAIL_COND(p_buffer.size() != (multimesh->instances * (int)old_stride)); + for (int i = 0; i < multimesh->instances; i++) { { float *dataptr = w + i * old_stride; diff --git a/drivers/gles3/storage/texture_storage.cpp b/drivers/gles3/storage/texture_storage.cpp index 15743c2d78..2f17ec460c 100644 --- a/drivers/gles3/storage/texture_storage.cpp +++ b/drivers/gles3/storage/texture_storage.cpp @@ -723,6 +723,7 @@ void TextureStorage::texture_2d_update(RID p_texture, const Ref<Image> &p_image, texture_set_data(p_texture, p_image, p_layer); #ifdef TOOLS_ENABLED Texture *tex = texture_owner.get_or_null(p_texture); + ERR_FAIL_COND(!tex); tex->image_cache_2d.unref(); #endif diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp index 75fe84f46b..b8b00dddd2 100644 --- a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp @@ -1244,6 +1244,8 @@ float RendererSceneRenderRD::screen_space_roughness_limiter_get_limit() const { } TypedArray<Image> RendererSceneRenderRD::bake_render_uv2(RID p_base, const TypedArray<RID> &p_material_overrides, const Size2i &p_image_size) { + ERR_FAIL_COND_V_MSG(p_image_size.width <= 0, TypedArray<Image>(), "Image width must be greater than 0."); + ERR_FAIL_COND_V_MSG(p_image_size.height <= 0, TypedArray<Image>(), "Image height must be greater than 0."); RD::TextureFormat tf; tf.format = RD::DATA_FORMAT_R8G8B8A8_UNORM; tf.width = p_image_size.width; // Always 64x64 |