Force RDD::id
to be always uint64_t
#98910
Merged
+4
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On Vulkan, some handles are meant to always be u64, even on 32-bit architectures such as arm32.
Fixes #98654
Testing methodology
Testing this is hard, because most platforms Godot is meant to be run on are already 64-bit.
Effectively this only affects arm32.
My particular worry is what if at some point Godot does the following? (or similar)
More bizarre stuff such as memcpy could be happening.
To check for this very particular scenario I was afraid of, I devised a much larger patch I'm including here:
arch32_test.patch.zip
Which changes RenderingDeviceDriver::id to private and is a RenderingDeviceDriver::id[3]; where I store the value in id[1].
This way, if Godot were to make such horrible type punning (or other dangerous raw manipulation), the value would be lost even on an x64 machine.
I tested this patch, and Godot ran fine. I tested 3 different projects, but not thoroughly.
So far this change appears to be harmless. But I can never be 100% certain. Type punning Vulkan & D3D12 handles as RenderingDeviceDriver::id was not the best idea to begin with. But it is what we have.
Hopefully CI will agree.