[Mesa-dev] [PATCH 1/5] include/GL: add mesa_glinterop.h for OpenGL-OpenCL interop (v3)

Marek Olšák maraeo at gmail.com
Thu Mar 10 09:16:24 UTC 2016


On Thu, Mar 10, 2016 at 9:34 AM, Michel Dänzer <michel at daenzer.net> wrote:
> On 10.03.2016 02:11, Marek Olšák wrote:
>> On Wed, Mar 9, 2016 at 4:31 PM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
>>> On 8 March 2016 at 22:29, Marek Olšák <maraeo at gmail.com> wrote:
>>>
>>>> Actually, I don't see how the version number would make it any better
>>>> for the structures, but returning the version number by
>>>> QueryDeviceInfo would be useful for the caller to know what to expect
>>>> if Mesa version < caller version. The sizes are still useful if Mesa
>>>> version > caller version.
>>>>
>>> If any of this is an issue, then the whole DRI model just won't work ;-)
>>
>> The DRI extension versions only determine the number of function
>> callbacks, not function parameters and return values. This interop
>> thing is a lot more complicated than that, since it allows the "in"
>> and "out" structures to grow, and different rules apply to each. Also,
>> the implementation of DRI extensions allocates the structures, while
>> in the interop the user allocates the structures. It's a totally
>> different model.
>
> BTW, any particular reason against allocating the memory for the out
> structs in the callees? It seems like that could simplify things quite a
> bit.

Not really. First, it's very uncommon to do that. I've never seen an
API doing it this way. Second, the parameter would have to be "**out".
Last but not least, the callee could only do the allocation with
malloc, while the caller would have to use free to release it. It
complicates things.

The current implementation is more straightforward.

Marek


More information about the mesa-dev mailing list