[Mesa-dev] [PATCH RFC 1/1] r600, compute: Use vtx #3 for kernel arguments

Tom Stellard tom at stellard.net
Tue Jul 12 00:46:26 UTC 2016


On Sun, Jun 26, 2016 at 08:40:55PM -0400, Jan Vesely wrote:
> Both explicit and implicit.
> Using vtx 0 (as existing llvm code implies) does not work for dynamic offsets.
> 
> Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>

I have no idea why vtx#3 works when vtx#0, maybe add a comment
explaining why we are using vtx#3.

With that change:

Reviewed-by: Tom Stellard <thomas.stellard at amd.com>

> ---
> Hi,
> 
> I ran into problem when using VTX_READ from constant buffer would work only for 0 index. The LLVM code implied that it should work (or maybe they considered constant offsets only), but I could not find one way or the other in ISA docs.
> 
> Switching to vtx#3 fixed the problem, though I'm not sure if it's the right solution.
> 
> thanks,
> Jan
> 
> 
>  src/gallium/drivers/r600/evergreen_compute.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c
> index 7f9580c..b351cee 100644
> --- a/src/gallium/drivers/r600/evergreen_compute.c
> +++ b/src/gallium/drivers/r600/evergreen_compute.c
> @@ -369,6 +369,8 @@ static void evergreen_compute_upload_input(struct pipe_context *ctx,
>  	ctx->transfer_unmap(ctx, transfer);
>  
>  	/* ID=0 is reserved for the parameters */
> +	evergreen_cs_set_vertex_buffer(rctx, 3, 0,
> +			(struct pipe_resource*)shader->kernel_param);
>  	evergreen_cs_set_constant_buffer(rctx, 0, 0, input_size,
>  			(struct pipe_resource*)shader->kernel_param);
>  }
> @@ -614,9 +616,9 @@ static void evergreen_set_compute_resources(struct pipe_context *ctx,
>  			start, count);
>  
>  	for (unsigned i = 0; i < count; i++) {
> -		/* The First three vertex buffers are reserved for parameters and
> +		/* The First four vertex buffers are reserved for parameters and
>  		 * global buffers. */
> -		unsigned vtx_id = 3 + i;
> +		unsigned vtx_id = 4 + i;
>  		if (resources[i]) {
>  			struct r600_resource_global *buffer =
>  				(struct r600_resource_global*)
> -- 
> 2.7.4
> 


More information about the mesa-dev mailing list