summaryrefslogtreecommitdiffstats
path: root/servers/rendering/renderer_viewport.cpp
diff options
context:
space:
mode:
authorAlistair Leslie-Hughes <leslie_alistair@hotmail.com>2023-11-16 06:43:33 +1100
committerAlistair Leslie-Hughes <leslie_alistair@hotmail.com>2023-11-16 11:02:12 +1100
commit367079ffeea3f417901bc6b022908a5cb4483479 (patch)
tree088ab3b56bc9b0badc891a09ce640af674f04f21 /servers/rendering/renderer_viewport.cpp
parent56a2b143a2d8868fdbaba798b7b0145516397f48 (diff)
downloadredot-engine-367079ffeea3f417901bc6b022908a5cb4483479.tar.gz
Renderer Viewport correct sizeof usage.
The current usage. In viewport_find_from_screen_attachment - Allocates a list of pointers, eg sizeof(RID*) * ridcount. We need fill that buffer viewport_owner.fill_owned_buffer(rids); ... p_rid_buffer[idx] = _make_from_id((validator << 32) | i); _make_from_id returns an RID object, not a pointer. Since there isn't a copy constructor, a bitwise copy of the object occurs. This issue will only present itself under 32bit builds. sizeof(RID) : 8 sizeof(RID*) : 4 whereas 64bit builds they are both 8.
Diffstat (limited to 'servers/rendering/renderer_viewport.cpp')
-rw-r--r--servers/rendering/renderer_viewport.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/servers/rendering/renderer_viewport.cpp b/servers/rendering/renderer_viewport.cpp
index 6b47c29382..d0a6542fe4 100644
--- a/servers/rendering/renderer_viewport.cpp
+++ b/servers/rendering/renderer_viewport.cpp
@@ -1387,7 +1387,7 @@ void RendererViewport::viewport_set_sdf_oversize_and_scale(RID p_viewport, RS::V
RID RendererViewport::viewport_find_from_screen_attachment(DisplayServer::WindowID p_id) const {
RID *rids = nullptr;
uint32_t rid_count = viewport_owner.get_rid_count();
- rids = (RID *)alloca(sizeof(RID *) * rid_count);
+ rids = (RID *)alloca(sizeof(RID) * rid_count);
viewport_owner.fill_owned_buffer(rids);
for (uint32_t i = 0; i < rid_count; i++) {
Viewport *viewport = viewport_owner.get_or_null(rids[i]);