On Wed, Jun 22, 2016 at 7:43 PM Vasco Alexandre da Silva Costa <
vasco.co...@gmail.com> wrote:
> On Wed, Jun 22, 2016 at 2:36 PM, Param Hanji <param.catchch...@gmail.com>
> wrote:
>
>> - in copy_to_cpu if gpu_seg->seg_sti is zero the cpu_seg->seg_stp->st_id
>>> will be uninitialized. worse. you are writing to an uninitialized pointer.
>>> what I think you want to do is lookup the seg_stp pointer based on the
>>> seg_sti id and use that to initialize the cpu->seg_stp pointer field.
>>>
>>
>> I can't find the relevant code that initializes the seg_stp. The rt_shot
>> methods in primitive files simply copy the passed soltab pointer. In
>> shootray(), this is obtained from a cutter, which is a union for space
>> partitioning.
>>
>> My understanding is that the structure soltab keeps track of all the
>> relevant information pertaining to a solid (primitive). On the GPU side,
>> only ID (seg_sti) is used. How do I initialize the cpu->seg_stp field?
>>
>
> One way to do it would be to store the soltab pointers in an array indexed
> by the integer solid 'id'. You should be able to do this in
> src/librt/primitives/primitive_util.c:clt_db_store. It's iterating through
> a cutter's solids and the current solid pointer is stored in the variable
> 'stp'.
>
> I realized I can loop through all the all the solids using the macros
defined in soltab.h like this
RT_VISIT_ALL_SOLTABS_START(stp, a->a_rt_i) {
if (stp->st_id == (int)gpu_seg->seg_sti)
cpu_seg->seg_stp = stp;
} RT_VISIT_ALL_SOLTABS_END
When I ran this I noticed that some of the GPU segments don't have seg_sti
initialized (value 0). How can I process these?
> --
> 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
>
------------------------------------------------------------------------------
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