[Mesa-dev] [PATCH 02/12] gallim/radeon: add an assertion checking the validity of PIPE_BIND_SCANOUT

Michel Dänzer michel at daenzer.net
Wed Jun 8 03:47:49 UTC 2016


On 07.06.2016 19:04, Marek Olšák wrote:
> 
> @@ -286,6 +283,16 @@ static int r600_init_surface(struct r600_common_screen *rscreen,
>  	    ptex->format == PIPE_FORMAT_R9G9B9E5_FLOAT)
>  		surface->flags |= RADEON_SURF_DISABLE_DCC;
>  
> +	if (ptex->bind & PIPE_BIND_SCANOUT) {
> +		/* This should catch bugs in gallium users setting incorrect flags. */
> +		assert(surface->nsamples == 1 &&
> +		       surface->array_size == 1 &&
> +		       surface->npix_z == 1 &&
> +		       surface->last_level == 0 &&
> +		       !(surface->flags & RADEON_SURF_Z_OR_SBUFFER));

FWIW, it's generally better to have use separate assert() stanzas for
each individual condition, so that it'll be immediately obvious which of
them isn't satisfied.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the mesa-dev mailing list