On Mon, Jun 27, 2016 at 11:33 AM, Param Hanji <param.catchch...@gmail.com>
wrote:

>
> Also the GPU side seg_sti doesn't have the same meaning at all. It's a
>> unique solid id. In the soltabs list. So '0' would be the first valid solid
>> in the soltabs list. So your code should work like this:
>>
>> unsigned int i=0;
>>     RT_VISIT_ALL_SOLTABS_START(stp, a->a_rt_i) {
>>         /* Ignore "dead" solids in the list.  (They failed prep) */
>>         if (stp->st_aradius <= 0) continue;
>>         /* Infinite solids make the BVH construction explode. */
>>         if (stp->st_aradius >= INFINITY) continue;
>>
>>         if (i == gpu_seg->seg_sti) {
>>             cpu_seg->seg_stp = stp;
>>             break;
>>         }
>>         i++;
>>     } RT_VISIT_ALL_SOLTABS_END
>>
>>
>> Yup, this worked! Just one more thing, how do I perform the reverse of
> this i.e. how do I set seg_sti of the GPU segment given the CPU storage's
> stp pointer?
>
> I believe this is the last missing piece. If even this doesn't work, I'll
> have define and use partitions on the GPU, only segments just won't cut it.
>

That should be pretty easy. You just do the same loop and check if the
iterator stp ==  the pointer to the soltab you want to find. You can just
compare the pointers to see if they point to the same memory region.

If we actually stored the dead solids on the GPU you would be able to do
the same thing by checking the 'stp->st_bit value'. And you should be able
to get the pointer to a solid like this: 'struct soltab *stp =
rtip->rti_Solids[seg_sti]'. As it is now the indexes may mismatch...
So to make the code faster without these loops we can either store the dead
solids, and mark them somehow to ignore them on traversal, or we can create
an array that converts from one index (i.e. stp->st_bit) to the other (i.e.
gpu_seg->seg_sti).

Regards,

-- 
Vasco Alexandre da Silva Costa
PhD in Computer Engineering (Computer Graphics)
Instituto Superior Técnico/University of Lisbon, Portugal
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
BRL-CAD Developer mailing list
brlcad-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-devel

Reply via email to