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

Marek Olšák maraeo at gmail.com
Wed Jun 1 17:07:37 UTC 2016


On Wed, Jun 1, 2016 at 6:06 PM, ⚛ <0xe2.0x9a.0x9b at gmail.com> wrote:
> On Wed, Jun 1, 2016 at 3:53 PM, Marek Olšák <maraeo at gmail.com> wrote:
>> Because of external factors you can't predict, your driver suddenly
>> receives a bunch of shaders that take 2000 ms to compile right before
>> a draw call. Your budget is 16 ms per frame to get 30 fps, but you
>> can't render the frame if you don't compile those shaders. The problem
>> is how to fit the compilation that takes 2000 ms and is required
>> render the frame into 16 ms. Can you see where I'm going?
>
> I don't understand why transforming parts of shader compilation into
> asynchronous code isn't the right way to go. Async parts of
> compilation can potentially run on other CPU cores, maybe lowering
> those 2000ms down to 750ms.

No. Shader compilation can only be asynchronous if it's far enough
from a draw call and the app doesn't query its status. If it's next to
a draw call, multithreading is useless. Completely useless.

We need to get below 33 ms for all shaders needed to be compiled to
render a frame. If there are 10 VS and 10 PS, one shader must be
compiled within 1.65 ms on average. I don't see where your random
guess meets that goal.

Marek


More information about the mesa-dev mailing list