Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renderer Viewport correct sizeof usage. #84952

Merged

Conversation

alesliehughes
Copy link
Contributor

@alesliehughes alesliehughes commented Nov 16, 2023

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.

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.
@alesliehughes alesliehughes requested a review from a team as a code owner November 16, 2023 00:03
@akien-mga akien-mga added this to the 4.2 milestone Nov 16, 2023
@akien-mga akien-mga changed the title Renderer Viewport correct sizeof usage. Renderer Viewport correct sizeof usage. Nov 16, 2023
@akien-mga akien-mga merged commit 60c40ed into godotengine:master Nov 16, 2023
15 checks passed
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants