What is a Shape Ptr? #882
-
Hi, When casting a variable of type For example in the following reproducer, import mitsuba as mi
import drjit as dr
mi.set_variant("cuda_ad_rgb")
if __name__ == "__main__":
scene: mi.Scene = mi.load_dict(mi.cornell_box())
print(f"{dr.reinterpret_array_v(mi.UInt, scene.shapes_dr())=}")
ray = mi.Ray3f(mi.Point3f(0, 0, 0), mi.Vector3f(0, -1, 0))
si: mi.SurfaceInteraction3f = scene.ray_intersect(ray)
print(f"{dr.reinterpret_array_v(mi.UInt, si.shape)=}") we got Thanks for your Help |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Internally, Dr.Jit holds a registry of pointers (documentation in source code). Whenever a plugin is instantiated in Mitsuba it is registered with Dr.Jit and hence it's corresponding "vectorized pointer" is the index in that registry.
Yes. Currently, it is guaranteed that a plugin will keep the same register index for however long it lives. Of course, if some plugin is deleted and a new one created, the new plugin might re-use the old one's index. In short, whenever a plugin is instantiated it seems itself assigned an index for the entirety of its lifetime. I hope this makes sense. |
Beta Was this translation helpful? Give feedback.
Hi @DoeringChristian
Internally, Dr.Jit holds a registry of pointers (documentation in source code). Whenever a plugin is instantiated in Mitsuba it is registered with Dr.Jit and hence it's corresponding "vectorized pointer" is the index in that registry.
Yes. Currently, it is guaranteed that a plugin will keep the same register index for however long it lives. Of course, if some plugin is deleted and a new one created, the new plugin might re-use the old one's index.
In short, whenever a plugin is instantiate…