[Mesa-dev] Discussion: C++11 std::future in Mesa
Francisco Jerez
currojerez at riseup.net
Wed Jun 1 01:21:40 UTC 2016
⚛ <0xe2.0x9a.0x9b at gmail.com> writes:
> 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.
>
> Using std::future in the source code would mean that some parts of Mesa
> need to be converted from C to C++11.
>
> 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.
>
> Looking forward to your opinions.
Yeah, IMO std::async is a minimally intrusive way to offload
computations to a separate thread which avoids many of the pitfalls of
managing concurrency and thread pools by hand. For the moment I'm going
to stay away from the discussion of whether it's the right solution for
the GL front-end or not, but I think it would definitely make sense to
try out your idea in the CL state tracker, since it already uses C++11
extensively and currently doesn't take advantage of concurrency for
kernel compilation (even though the CL API was designed to allow
implementations to build CL kernels asynchronously).
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160531/30afc7c6/attachment.sig>
More information about the mesa-dev
mailing list