[Mesa-dev] [PATCH 02/13] i965: Only call brw_upload_tcs/tes_prog when using tessellation.

Kenneth Graunke kenneth at whitecape.org
Tue Dec 22 11:13:26 PST 2015


On Wednesday, December 23, 2015 2:21:49 AM PST eocallaghan at alterapraxis.com 
wrote:
> On 2015-12-22 21:20, Kenneth Graunke wrote:
[snip]
> > diff --git a/src/mesa/drivers/dri/i965/brw_tcs.c
> > b/src/mesa/drivers/dri/i965/brw_tcs.c
> > index b5eb4cd..037a2da 100644
> > --- a/src/mesa/drivers/dri/i965/brw_tcs.c
> > +++ b/src/mesa/drivers/dri/i965/brw_tcs.c
> > @@ -187,6 +187,10 @@ brw_upload_tcs_prog(struct brw_context *brw)
> > 
> >     /* BRW_NEW_TESS_CTRL_PROGRAM */
> >     struct brw_tess_ctrl_program *tcp =
> >     
> >        (struct brw_tess_ctrl_program *) brw->tess_ctrl_program;
> > 
> > +   /* BRW_NEW_TESS_EVAL_PROGRAM */
> > +   struct brw_tess_eval_program *tep =
> > +      (struct brw_tess_eval_program *) brw->tess_eval_program;
> > +   assert(tcp && tep);
> > 
> >     if (!brw_state_dirty(brw,
> >     
> >                          _NEW_TEXTURE,
> > 
> > @@ -195,15 +199,6 @@ brw_upload_tcs_prog(struct brw_context *brw)
> > 
> >                          BRW_NEW_TESS_EVAL_PROGRAM))
> >        
> >        return;
> > 
> > -   if (tcp == NULL) {
> > -      /* Other state atoms had better not try to access prog_data,
> > since
> > -       * there's no HS program.
> > -       */
> > -      brw->tcs.prog_data = NULL;
> > -      brw->tcs.base.prog_data = NULL;
> > -      return;
> > -   }
> > -
> > 
> >     struct gl_program *prog = &tcp->program.Base;
> >     
> >     memset(&key, 0, sizeof(key));
> > 
> > @@ -216,13 +211,9 @@ brw_upload_tcs_prog(struct brw_context *brw)
> > 
> >     brw_populate_sampler_prog_key_data(ctx, prog,
> > 
> > stage_state->sampler_count,
> > 
> >                                        &key.tex);
> > 
> > -   /* BRW_NEW_TESS_EVAL_PROGRAM */
> > 
> >     /* We need to specialize our code generation for tessellation
> > 
> > levels
> > 
> >      * based on the domain the DS is expecting to tessellate.
> >      */
> > 
> > -   struct brw_tess_eval_program *tep =
> > -      (struct brw_tess_eval_program *) brw->tess_eval_program;
> > -   assert(tep);
> > 
> >     key.tes_primitive_mode = tep->program.PrimitiveMode;
> 
> Does this compile? You've killed off *tep yet we still dereference it.

Yep, it does.  I actually just moved the declaration to the top of the
function with most of the other ones.  Check the second hunk.

--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/20151222/b14a79c8/attachment-0001.sig>


More information about the mesa-dev mailing list