Ian Romanick <i...@freedesktop.org> writes: > From: Gregory Hainaut <gregory.hain...@gmail.com> > > To avoid NULL pointer check a default pipeline object is installed in > _Shader when no program is current
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h > index d05649c..8a03afd 100644 > --- a/src/mesa/main/mtypes.h > +++ b/src/mesa/main/mtypes.h > @@ -2824,6 +2824,9 @@ struct gl_pipeline_shader_state > /** Currently bound pipeline object. See _mesa_BindProgramPipeline() */ > struct gl_pipeline_object *Current; > > + /* Default Object to ensure that _Shader is never NULL */ > + struct gl_pipeline_object *Default; > + > /** Pipeline objects */ > struct _mesa_HashTable *Objects; > }; > @@ -4131,6 +4134,18 @@ struct gl_context > > struct gl_pipeline_shader_state Pipeline; /**< GLSL pipeline shader > object state */ > struct gl_pipeline_object Shader; /**< GLSL shader object state */ > + > + /** > + * Current active shader pipeline state > + * > + * Almost all internal users want ::_Shader instead of ::Shader. The > + * exceptions are bits of legacy GLSL API that do not know about separate > + * shader objects. > + * > + * Points to ::Shader, ::Pipeline.Current, or ::Pipeline.Default. > + */ > + struct gl_pipeline_object *_Shader; > + Let's see if I followed: It points to Shader when there is a GLSL shader program bound to any stage, it points to Pipeline.Default when all stages are not bound to a GLSL shader but no SSO pipeline is bound, and it points to Pipeline.Current when there are no GLSL shader programs individually bound, but there is a SSO pipeline bound. Is that right? If so, baking some of that into the comments here would be really useful.
pgpTu8dPJg0iC.pgp
Description: PGP signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev