Perl 6 - the future is here, just unevenly distributed

IRC log for #pdl, 2015-01-12

| Channels | #pdl index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
14:00 Mithaldu while i fiddle with this, do any of you maybe know if i can usefully approximate this data structure with PDL?
14:00 Mithaldu struct Particle { float Type; Vector3f Pos; Vector3f Vel; float LifetimeMillis; };
14:13 mohawk parallel piddles?
14:13 Mithaldu i'm unclear as to what you're asking
14:13 mohawk approximate with:
14:13 Mithaldu here's what i'm trying to do
14:14 Mithaldu this c code has an array of 1000 particle structs
14:14 mohawk dang, i forgot the right syntax to create piddles
14:14 Mithaldu all of them like that
14:14 mohawk ok
14:14 mohawk so in matrix-ish terms,
14:14 mohawk instead of 1000 x 1-thing-with-4-things-in
14:14 Mithaldu i'm trying to create a multi-level piddle that will give me a memory structure identical to what the C thing has
14:14 mohawk you'd have 4 x 1000 x just-1-piddle
14:15 mohawk i can't answer that but doubt it
14:15 Mithaldu i'm unclear why you're saying it
14:15 Mithaldu *that
14:15 Mithaldu the c code is 1000 x 1 x 4
14:15 mohawk ah, my idea certainly wouldn't be similar memory layout
14:15 mohawk sorry
14:15 Mithaldu with those 4 being a float, 2 element things and a float
14:16 mohawk i think you might achieve a similar memory layout with having the "struct" approximated by a dimension of the right number of bytes
14:17 mohawk and then in C going (Particle *)theappropriate_pdl_address_lookup
14:17 mohawk there's Inline::Struct for arrays of C structs
14:17 Mithaldu err
14:18 Mithaldu i'm not doing C
14:18 mohawk maintained by a M. O'Hawke, an irish gentleman
14:18 mohawk ok
14:18 Mithaldu i'm porting from C to Perl
14:18 Mithaldu and with a dimension of x bytes i give up on being able to manipulate the thing in perl which is also not happy
14:18 Mithaldu maybe inline struct can help
14:18 mohawk porting the whole thing including the library?
14:18 Mithaldu sec, let me give you the code
14:19 mohawk i'm wondering if you really need to mimic the memory layout of the C structs
14:19 mohawk ok
14:21 Mithaldu ok, first off, here's perl code where i've done stuff like that already with simpler structure:
14:21 Mithaldu https://github.com/wchristian/oglde​v/blob/perl/tutorial27/MeshEntry.pm
14:21 Mithaldu https://github.com/wchristian/ogl​dev/blob/perl/tutorial27/mesh.pm
14:21 Mithaldu and here's the C code i'm working on porting now: https://github.com/wchristian/ogldev/blob​/perl/tutorial28/particle_system.cpp#L67
14:22 mohawk i'm just loving how idiomatically perl-ish OpenGL's perl binding is ;-)
14:22 Mithaldu it has various ways to do it actually
14:23 Mithaldu i dunno if the credit for that goes all to chm, but most of these functions work very nicely
14:24 mohawk i am certain it does work
14:24 mohawk i was just ironically observing it's still very C-ish, and not really perl-5-ish
14:25 mohawk however, of course that's forced by working to a C library, so i'm not judging
14:26 Mithaldu i'll be honest, i have no idea what you're talking about and also very little interest in sarcasm
14:27 Mithaldu grumble
14:27 Mithaldu pdl( [float (1), pdl(1,2,3)])
14:27 Mithaldu trying to do that extends the first one into a 3 element piddle :(
14:29 Mithaldu and i'm not sure Inline::Struct can do contiguous arrays of structs
14:35 Mithaldu hm, even OpenGL::Array can't seem to handle arbitrary types
14:35 Mithaldu guess i'll have to fake it with fixed byte length pdls and Inline::Struct
15:09 mohawk Mithaldu, may i ask why in particle_system.cpp#L67 you have Particle Particles[MAX_PARTICLES] but only seem to use the 0-th element?
15:10 Mithaldu mohawk: the shaders do the rest of the work
15:10 Mithaldu the first one is just the launcher
15:11 Mithaldu see: https://github.com/wchristian/oglde​v/blob/perl/tutorial28/ps_update.gs
15:11 mohawk ok, thanks
15:13 Mithaldu http://ogldev.atspace.co.uk/w​ww/tutorial28/tutorial28.html
15:13 Mithaldu that explains it in better detail
15:18 mohawk so it does, thanks
15:19 Mithaldu np, thanks for looking at it :)
15:22 mohawk i think you actually might benefit from looking at using Inline::CPP rather than I::Struct, given https://rt.cpan.org/Public/​Bug/Display.html?id=101050
15:22 mohawk EVEN THOUGH I::CPP isn't mine, and I::Struct is
15:23 Mithaldu tbh, i don't get it
15:24 Mithaldu regardless of what other issues there are, the array thing is the big one
15:24 Mithaldu in other words: goal 1 is a specifically structured memory region i can hand around as a pointer to opengl
15:25 Mithaldu also, i only now realized you made Inline::Struct :v
15:25 mohawk i did not make it, but i did take it over
15:25 Mithaldu ah
15:26 mohawk i do admit that i am in fact the irish gentleman i mentioned, M O'Hawke
15:26 Mithaldu i'm sorry for your lot. must be hard having a first name that's a single letter
15:26 mohawk that was in fact an attempt at humour ;-)
15:29 Mithaldu i'm a little sad the inline cpp docs don't adress my use case
15:40 mohawk did you take a look at Heinz's benchmark?
15:41 Mithaldu i'm not sure what's important about it
15:41 Mithaldu i'm not having a very brainy day
15:42 Mithaldu ELI5 please :v
15:54 mohawk he gives an example of structs accessed via I::CPP, that's all
15:55 Mithaldu not even that
15:55 Mithaldu only a few sentences on how to include Inline Structs
16:00 vicash Mithaldu: i would still recommend stating your problem to the #inline group for I::CPP. they would love to support your use case.
16:00 Mithaldu vicash: check the channel i already did
16:00 vicash cool
16:06 mohawk Mithaldu, he in fact does provide an example, attached to his most recent message; the attach url is: https://rt.cpan.org/Ticket/Attachment/​1448106/769969/inline-cpp-benchmark.pl
16:07 Mithaldu maybe i'm dumb but for the past half hour or so i haven't been able to comprehend anything you're saying
16:07 Mithaldu like
16:07 Mithaldu the docs for Inline::CPP show no c code that includes structs
16:08 Mithaldu the file you just linked me to contains no structs
16:08 Mithaldu what in the fuck are you talking about
16:44 drrho joined #pdl
16:53 mohawk ask tomorrow
16:56 Mithaldu aight
16:59 Mithaldu mohawk: though i doubt i'll bother at this point since it's been only frustration and i don't mind leaving a hack in so i can get back to extending OpenGL.pm

| Channels | #pdl index | Today | | Search | Google Search | Plain-Text | summary