[Mesa-dev] [PATCH 3/4] i965: let if_stack just store the instruction index

Yuanhan Liu yuanhan.liu at linux.intel.com
Tue Nov 29 19:01:34 PST 2011


On Tue, Nov 29, 2011 at 10:35:42AM -0800, Eric Anholt wrote:
> On Tue, 29 Nov 2011 16:08:38 +0800, Yuanhan Liu <yuanhan.liu at linux.intel.com> wrote:
> > Let if_stack just store the instruction pointer(an index). This is
> > somehow more flexible than store the instruction memory address.
> 
> I'd be more specific: This lets us realloc the instruction store.
> 
> > diff --git a/src/mesa/drivers/dri/i965/brw_eu.c b/src/mesa/drivers/dri/i965/brw_eu.c
> > index b5a858b..d6e5c09 100644
> > --- a/src/mesa/drivers/dri/i965/brw_eu.c
> > +++ b/src/mesa/drivers/dri/i965/brw_eu.c
> > @@ -191,8 +191,7 @@ brw_init_compile(struct brw_context *brw, struct brw_compile *p, void *mem_ctx)
> >     /* Set up control flow stack */
> >     p->if_stack_depth = 0;
> >     p->if_stack_array_size = 16;
> > -   p->if_stack =
> > -      rzalloc_array(mem_ctx, struct brw_instruction *, p->if_stack_array_size);
> > +   p->if_stack = rzalloc_array(mem_ctx, GLuint, p->if_stack_array_size);
> >  }
> 
> Please use plain types instead of the awful GL-decorated types, unless
> it's something directly exposed in the GL API.

Agreed. But I somehow followed the type usage of 'GLuint nr_insn'
defined in brw_compile. Since the if_stack is used to store instruction
index, and the index is defined in a GLuint type. That's why I
origianlly used GLuint.

So, I should also change the type of nr_insn to something like int, too?
(BTW, I guess int would be enough, but for good semantics, a positive
index, should I use uint32_t?)

Thanks,
Yuanhan Liu

> 
> (if you want sized types, the standard ones in inttypes.h are good)




More information about the mesa-dev mailing list