[Mesa-dev] [Mesa-stable] [PATCH] glsl: always re-validate program pipeline

Kenneth Graunke kenneth at whitecape.org
Fri Dec 4 16:15:22 PST 2015


On Wednesday, December 02, 2015 10:45:02 AM Timothy Arceri wrote:
> On Tue, 2015-12-01 at 13:46 +0200, Tapani Pälli wrote:
> > On 12/01/2015 02:13 AM, Timothy Arceri wrote:
> > > Just because the validation passed the last time is was called
> > > doesn't
> > > automatically mean it will pass again the next time its called.
> > 
> > This is a rather large hammer though :/ Maybe we should look at 
> > invalidating the pipeline when samplers are changed instead. Was
> > there 
> > other issues this resolves/fixes than sampler validation?
> 
> There are no other tests that this fixes however I believe that's just
> because the tests use ValidateProgramPipeline to check for problems
> rather than issuing a draw call. For example this patch is the
> equivalent of doing this in ValidateProgramPipeline
> 
> if (!ctx->_Shader->Validated)
>    _mesa_validate_program_pipeline(ctx, pipe, false);
> 
> And this causes the CTS pipeline test to fail. The interesting thing is
> that the piglit test this fixes also fails on Nvidia.
> 
> The spec is somewhat confusing in its wording:
> 
> "Therefore validation is done when the first rendering command which
> triggers shader invocations is issued, to determine if the set of
> active program objects can be executed."
> 
> This seem like its saying we only need to check it on the first call
> however even then ctx->_Shader->Validated may have been set by
> ValidateProgramPipeline rather than validation triggered a rendering
> command.
> 
> Also the spec goes on to say:
> 
> "An INVALID_OPERATION error is generated by any command that trans-fers
> vertices to the GL or launches compute work"
> 
> Which seems to conflict with the first statement.
> 
> It seems to me the intention is to call validation each time as
> relinking or changing samplers could cause validation to fail.
> 
> Maybe we should have a test which does a draw call, then relinks with
> SEPARABLE to false, then calls draw again and checks for a failure.
> 
> A less hammer type approach may be to reset ctx->_Shader->Validated
> after linking and when samplers are changed but we really need more
> tests to make sure we get this right.

I agree with Tapani, performing shader validation on every draw call is
a pretty big hammer, and will almost certainly impact performance - we
really want less draw-time validation, where possible.

Setting Validated = false when re-linking, changing program stages, or
otherwise altering the pipeline sounds like a good idea.  That way we
validate it on the first draw following the change, but can avoid it
after that.

--Ken
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20151204/b2a49806/attachment.sig>


More information about the mesa-dev mailing list