[Mesa-dev] [PATCH] r600g/cayman: hande empty vertex shaders

Glenn Kennard glenn.kennard at gmail.com
Mon Nov 17 17:48:06 PST 2014


On Tue, 18 Nov 2014 02:23:51 +0100, Dave Airlie <airlied at gmail.com> wrote:

> From: Dave Airlie <airlied at redhat.com>
>
> Some of the geom shader tests produce an empty vertex shader,
> on cayman we'd crash in the finaliser because last_cf was NULL.
>
> cayman doesn't need the NOP workaround, so if the code arrives
> here with no last_cf, just emit an END.
>
> fixes crashes in a bunch of piglit geom shader tests.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/gallium/drivers/r600/sb/sb_bc_finalize.cpp | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/drivers/r600/sb/sb_bc_finalize.cpp  
> b/src/gallium/drivers/r600/sb/sb_bc_finalize.cpp
> index 5c22f96..f0849ca 100644
> --- a/src/gallium/drivers/r600/sb/sb_bc_finalize.cpp
> +++ b/src/gallium/drivers/r600/sb/sb_bc_finalize.cpp
> @@ -83,14 +83,18 @@ int bc_finalizer::run() {
>  		last_cf = c;
>  	}
> -	if (last_cf->bc.op_ptr->flags & CF_ALU) {
> +	if (!ctx.is_cayman() && last_cf->bc.op_ptr->flags & CF_ALU) {
>  		last_cf = sh.create_cf(CF_OP_NOP);
>  		sh.root->push_back(last_cf);
>  	}
> -	if (ctx.is_cayman())
> -		last_cf->insert_after(sh.create_cf(CF_OP_CF_END));
> -	else
> +	if (ctx.is_cayman()) {
> +		if (!last_cf) {
> +			cf_node *c = sh.create_cf(CF_OP_CF_END);
> +			sh.root->push_back(c);
> +		} else
> +			last_cf->insert_after(sh.create_cf(CF_OP_CF_END));
> +	} else
>  		last_cf->bc.end_of_program = 1;
> 	for (unsigned t = EXP_PIXEL; t < EXP_TYPE_COUNT; ++t) {

Reviewed-by: Glenn Kennard <glenn.kennard at gmail.com>


More information about the mesa-dev mailing list