'C-Backed' Vertex Array Ports in Custom Patch

toneburst's picture

Anyone been able to create a custom patch with in/out ports using the new faster structure/array type? Something I was trying to do with OpenCL will have to be done as a custom patch I think, but the ordinary structure ports aren't going to cut it, speed-wise.

a|x

cybero's picture
Re: 'C-Backed' Vertex Array Ports in Custom Patch

Do you mean the Parallel Array / Structure / Queue patches?

franz's picture
Re: 'C-Backed' Vertex Array Ports in Custom Patch

do you have a apple official link describing this new port ?

gtoledo3's picture
Re: 'C-Backed' Vertex Array Ports in Custom Patch

I don't think it's publicly documented (?)

This is what GL Tools recently converted to, so that it can render OpenCL stuff to GL Tools structure render patches.

toneburst's picture
Re: 'C-Backed' Vertex Array Ports in Custom Patch

The new array/structure type is the one used by the new 3D Mesh patches. It's much faster than the old-style structure ports. According to cwright, it's more line a standard C array. The structure data-type has much higher overheads.

a|x

franz's picture
Re: 'C-Backed' Vertex Array Ports in Custom Patch

the standard structure port is NSDictionary. Would the mesh port be NSArray ?

NSDictionary, while being a nice idea, is certainly not suitable for realtime graphics when containing large amount of entries. Hacking the mesh port for custom plugins is a nice idea.

toneburst's picture
Re: 'C-Backed' Vertex Array Ports in Custom Patch

franz wrote:
the standard structure port is NSDictionary. Would the mesh port be NSArray ?

I was under the impression, from what cwright was saying, that it's a C array, rather than an NSArray. I'm vague on the terminology, but my understanding is that they can also be VBOs on the graphics card, so presumably, C arrays on the CPU then uploaded to the graphics card as VBOs.

Quote:
NSDictionary, while being a nice idea, is certainly not suitable for realtime graphics when containing large amount of entries. Hacking the mesh port for custom plugins is a nice idea.

Wasn't my idea originally, but it would be cool if it could be done. I don't think there's any Apple documentation on using them in 'non-skanky' custom patches (though I haven't really looked yet).

a|x

smokris's picture
Re: 'C-Backed' Vertex Array Ports in Custom Patch

toneburst wrote:
I don't think there's any Apple documentation on using them in 'non-skanky' custom patches (though I haven't really looked yet).

I've looked. There isn't. The QCPlugIn docs were last updated spring 2008, long before c-backed structures were available..

The only way to do this currently is via the Unofficial API. The Official API only provides structures represented as NSDictionary data.

toneburst's picture
Re: 'C-Backed' Vertex Array Ports in Custom Patch

That's annoying. Hopefully Apple will add the new array type to the plugin API at some future date.

Have you actually tried with the unofficial API, out of interest?

a|x

toneburst's picture
Re: 'C-Backed' Vertex Array Ports in Custom Patch

And a related question. Are there any particular hoops that have to be jumped through in order to create 3D geometry in a custom patch, that plays nicely with the QC environment (ie can be used inside Lighting/GLSL Shader macro patches)?

a|x

cwright's picture
Re: 'C-Backed' Vertex Array Ports in Custom Patch

Depends on what you're doing -- if you're just pumping out vertices to GL, then as long as you don't break the GL state you're good. (There are some reported issues with Kineme3D + GLSL+render in image that I'm trying to isolate, but we do some aggressive state manipulation to keep stuff on the GPU, and I think I made a mistake somewhere).

If you're trying to output a mesh (or a structure that's suitable for use as a mesh component), the official api is likely to just get in the way. (the structure part is likely doable with some work, the mesh is not doable)

cwright's picture
Re: 'C-Backed' Vertex Array Ports in Custom Patch

we've not done actual C-array structures (it's not quite as simple as just making an array, it has to be wrapped up in various classes that we haven't explored much yet, due to QC4/10.6's general user apathy), but we have made use of NSArray structures (as gtoledo mentioned) for CL mesh support -- this itself is quite an improvement, but not "all the way" as it were :/

dust's picture
Re: 'C-Backed' Vertex Array Ports in Custom Patch

i have used the new parallel queue and found that it doesn't start filling till like index 20, so it seems to me that either it is way faster or slower on the uptake. not sure but i don't like the empty indexes so i have been using the standard queue.