AcademySoftwareFoundation / AcademySoftwareFoundation/OpenShadingLanguage
Mismatch between sizeof(Partio::ParticleIndex), sizeof(size_t), sizeof(int)
- Dominant language
- C++
- Stars
- 2.3k
- Forks
- 414
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 10
Description
There is some assumption Partio uses size_t for its index type:
https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/blob/7e34ce27c7f759b40333a99cf26860f99c9ba2dd/src/liboslexec/pointcloud.cpp#L360-L365
which is apparently wrong (for the last 12 years):
https://github.com/wdas/partio/blob/7cb3743c6e19c04ac049c05f8f81af2f24410ea3/src/lib/Partio.h#L55
`typedef uint64_t ParticleIndex;`
On 32 bit archs the compilation then fails due to:
https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/blob/7e34ce27c7f759b40333a99cf26860f99c9ba2dd/src/liboslexec/pointcloud.cpp#L114-L118
Wouldn't it be better change it to `unsigned long* out_indices` in `RendererServices::pointcloud_search`? (This may require a version bump for 64bit archs, but only if `size_t != unsigned long`. For 32bit archs, the current code does not work anyway). Dito for `pointcloud_get`.
Contributor guide
Research direction
Start by comparing the index handling in src/liboslexec/pointcloud.cpp at the referenced lines with Partio.h, where ParticleIndex is defined as uint64_t. Check the pointcloud_search and pointcloud_get API declarations and verify the proposed type across 32-bit and 64-bit builds; done means the interfaces compile consistently with Partio's index type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- api, computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100