How to use quadtreeprimitive with picked correctly

I use quadtreeprimitive to visual custom vector tile. For each tile, I create primitive with geometryinstances, and PerInstanceColorAppearance. In updateforpick function, I push all colorcommands of primitive to framestate. if the colors of all geometryinstances are same, usescene.pick,i can get right one, but if the colors are not same, scene.pick always return undefine, I can’t pick nothing.
How can I write updateforpick function, so I can use ‘scene.pick’ to get right instance