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'.

This might be duplicating some pre-existing functionality in the regular
ANSI C database though.

-- 
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