[Mesa-dev] Discussion: C++11 std::future in Mesa

Emil Velikov emil.l.velikov at gmail.com
Fri May 27 22:24:56 UTC 2016


On 27 May 2016 at 21:11, Jason Ekstrand <jason at jlekstrand.net> wrote:

> On Fri, May 27, 2016 at 11:49 AM, ⚛ <0xe2.0x9a.0x9b at gmail.com> wrote:
>
>> Hello.
>>
>> http://en.cppreference.com/w/cpp/thread/future
>> http://en.cppreference.com/w/cpp/thread/async
>>
>> Assumption: Shader compilation will need run on separate thread(s).
>>
>> From a certain perspective, one of the easy ways of removing Mesa shader
>> compilation from the "main" thread would be to use std::future for some
>> fields in struct gl_program (defined in mtypes.h) and in related source
>> code.
>>
>
> Given that mtypes.h is included (and struct gl_program) is used by a *lot*
> of C code, I think using any sort of C++ there is a non-starter, 2011 or
> otherwise.
>
> As far as threading goes, we have other ways of dealing with threading
> than introducing C++11.  Something that works with C is probably a better
> path forward.
>
>
>> Using std::future in the source code would mean that some parts of Mesa
>> need to be converted from C to C++11.
>>
>
> The "some parts" you're talking about are almost all of mesa.  I don't
> think that's going to happen.
>
>
>> This post to mesa-dev is just to start the discussion and to determine
>> how many devs are in favor of C++11 (and why) and how many are against
>> C++11 (and why) in Mesa.
>>
>> I believe that most people agree with Jason here, at least I do. In
general the less time we spend re-factoring, the more time we'll have for
bringing features (and/or perf. improvements) to new and old hardware.
Surely one can resolve the said issue, with a smaller hammer (and thus
quicker) than C++11 ?

Regards,
Emil
P.S. Don't be shy to reply on the build fix patch I've Cc'd you earlier. A
"seems to work/Tested-by: ..." or any other input is welcome.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160527/69d25cde/attachment.html>


More information about the mesa-dev mailing list