Am 2016-06-01 15:53, schrieb Marek Olšák:
On Wed, Jun 1, 2016 at 3:02 PM, ⚛ <0xe2.0x9a.0...@gmail.com> wrote:
Shader compilation at game loading time is never a problem, so we can
ignore that.

I have to disagree here. For the dolphin emulator, we proposed a GLSL shader cache (because of mesa...). The idea was discarded as booting the emulator took up to minutes.

Shader compilation right before draw calls is what's unpleasant and
when people talk about it in the negative sense, they mean this.

I guess games with this behavior also: compile one shader, use it, repeat. Within a single frame. A threaded dispatcher (with shader compilation starting on the dispatcher thread) may be able to improve this behavior. I have no clue about the required effort, but I'm sure it's _by far_ more than simple threading primitives abstracted by std::async. And it's orthogonal to parallel compilation ;)

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?

Of course, this will only improve this behavior. There is no way to fit within the 16ms.

But such an implementation will be required for ARB_parallel_shader_compile. For eg the dolphin emulator, we want to compile some slow generic shaders. While running, specialized shaders shall be compiled. But so we need the query to check if the compilation has finished. Of course, in a non-blocking way.

But I see, emulators have some special requirements. I doubt this will help games a lot. Hopefully, engines will start to use this features wisely when they'll more available.

This does not replace the requirement for an on-disk cache, or vise versa.


But bad luck, neither calling "use std::async" nor this mail helps at all. The required restructuring needs months of man power. Not to mention that the shader compiler needs to be thread-safe....



Regards, degasus
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to