[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mesa3d-dev
Subject:    Re: [Mesa-dev] [PATCHv3 11/16] mesa: add infrastructure for threaded shader compilation
From:       Fredrik =?iso-8859-1?q?H=F6glund?= <fredrik () kde ! org>
Date:       2014-08-20 16:40:23
Message-ID: 201408201840.23588.fredrik () kde ! org
[Download RAW message or body]

On Wednesday 20 August 2014, Chia-I Wu wrote:
> Add _mesa_enable_glsl_threadpool to enable the thread pool for a context, and
> add ctx->Const.DeferCompileShader and ctx->Const.DeferLinkProgram to
> fine-control what gets threaded.
> 
> Setting DeferCompileShader to true will make _mesa_glsl_compile_shader be
> executed in a worker thread.  The function is thread-safe so there is no
> restriction on DeferCompileShader.
> 
> Setting DeferLinkProgram to true will make _mesa_glsl_link_shader be executed
> in a worker thread.  The function is thread-safe only when certain driver
> functions (as documented in struct gl_constants) are thread-safe.  It is
> drivers' responsibility to fix those driver functions before setting
> DeferLinkProgram.
> 
> When DeferLinkProgram is set, drivers are not supposed to inspect the context
> in their LinkShader callbacks.  Instead, NotifyLinkShader is added.  Drivers
> should inspect the context in NotifyLinkShader and save what they need for
> LinkShader in gl_shader_program.
> 
> As a final note, most applications will not benefit from threaded shader
> compilation because they check GL_COMPILE_STATUS/GL_LINK_STATUS immediately,
> giving the worker threads no time to do their jobs.  A possible improvement is
> to split LinkShader into two parts: the first part links and error checks
> while the second part optimizes and generates the machine code.  With the
> split, we can always defer the second part to the thread pool.

It looks like _mesa_create_shader_program() needs a bit of work since
it also checks the compile status immediately after compiling the shader.

Fredrik

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic