[Mesa-dev] [PATCH] radeonsi: add support for cull distances.

Edward O'Callaghan funfunctor at folklore1984.net
Tue Aug 23 01:29:35 UTC 2016


Thanks for getting this sent in Dave.

On 08/23/2016 11:28 AM, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
> 
> This should be all that is required for cull distances to work
> on radeonsi.
> 
> Signed-off-by: Dave Airlie <airlied at redhat.com>
Reviewed-by: Edward O'Callaghan <funfunctor at folklore1984.net>

> ---
>  src/gallium/drivers/radeonsi/si_pipe.c  | 3 ++-
>  src/gallium/drivers/radeonsi/si_state.c | 8 ++++----
>  2 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
> index 62b62db..14b0b80 100644
> --- a/src/gallium/drivers/radeonsi/si_pipe.c
> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
> @@ -436,7 +436,6 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>  	case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>  	case PIPE_CAP_VERTEXID_NOBASE:
>  	case PIPE_CAP_QUERY_BUFFER_OBJECT:
> -	case PIPE_CAP_CULL_DISTANCE:
>  	case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES:
>  	case PIPE_CAP_TGSI_VOTE:
>  	case PIPE_CAP_MAX_WINDOW_RECTANGLES:
> @@ -447,6 +446,8 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>  	case PIPE_CAP_MULTI_DRAW_INDIRECT_PARAMS:
>  		return sscreen->has_draw_indirect_multi;
>  
> +	case PIPE_CAP_CULL_DISTANCE:
> +		return 1;
>  	case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
>  		return 30;
>  
> diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
> index 25dfe26..ab11a89 100644
> --- a/src/gallium/drivers/radeonsi/si_state.c
> +++ b/src/gallium/drivers/radeonsi/si_state.c
> @@ -650,21 +650,21 @@ static void si_emit_clip_regs(struct si_context *sctx, struct r600_atom *atom)
>  	   info->properties[TGSI_PROPERTY_VS_WINDOW_SPACE_POSITION];
>  	unsigned clipdist_mask =
>  		info->writes_clipvertex ? SIX_BITS : info->clipdist_writemask;
> -
> +	unsigned total_mask = info->clipdist_writemask | (info->culldist_writemask << info->num_written_clipdistance);
>  	radeon_set_context_reg(cs, R_02881C_PA_CL_VS_OUT_CNTL,
>  		S_02881C_USE_VTX_POINT_SIZE(info->writes_psize) |
>  		S_02881C_USE_VTX_EDGE_FLAG(info->writes_edgeflag) |
>  		S_02881C_USE_VTX_RENDER_TARGET_INDX(info->writes_layer) |
>  	        S_02881C_USE_VTX_VIEWPORT_INDX(info->writes_viewport_index) |
> -		S_02881C_VS_OUT_CCDIST0_VEC_ENA((clipdist_mask & 0x0F) != 0) |
> -		S_02881C_VS_OUT_CCDIST1_VEC_ENA((clipdist_mask & 0xF0) != 0) |
> +		S_02881C_VS_OUT_CCDIST0_VEC_ENA((total_mask & 0x0F) != 0) |
> +		S_02881C_VS_OUT_CCDIST1_VEC_ENA((total_mask & 0xF0) != 0) |
>  		S_02881C_VS_OUT_MISC_VEC_ENA(info->writes_psize ||
>  					    info->writes_edgeflag ||
>  					    info->writes_layer ||
>  					     info->writes_viewport_index) |
>  		S_02881C_VS_OUT_MISC_SIDE_BUS_ENA(1) |
>  		(sctx->queued.named.rasterizer->clip_plane_enable &
> -		 clipdist_mask));
> +		 clipdist_mask) | (info->culldist_writemask << 8));
>  	radeon_set_context_reg(cs, R_028810_PA_CL_CLIP_CNTL,
>  		sctx->queued.named.rasterizer->pa_cl_clip_cntl |
>  		(clipdist_mask ? 0 :
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160823/e34a9b1d/attachment-0001.sig>


More information about the mesa-dev mailing list