[Mesa-dev] [PATCH 03/11] ac/nir: Implement input attachments with layered rendering.

Nicolai Hähnle nhaehnle at gmail.com
Thu Aug 24 08:31:33 UTC 2017


Minor comment on #2, but apart from that patches 1-3

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

On 23.08.2017 22:51, Bas Nieuwenhuizen wrote:
> ---
>   src/amd/common/ac_nir_to_llvm.c | 13 +++++++++++--
>   1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
> index f0120a984f8..90406e88dfb 100644
> --- a/src/amd/common/ac_nir_to_llvm.c
> +++ b/src/amd/common/ac_nir_to_llvm.c
> @@ -3345,6 +3345,7 @@ static LLVMValueRef get_image_coords(struct ac_nir_context *ctx,
>   					LLVMBuildAdd(ctx->ac.builder, fmask_load_address[chan],
>   						LLVMBuildFPToUI(ctx->ac.builder, ctx->abi->frag_pos[chan],
>   								ctx->ac.i32, ""), "");
> +			fmask_load_address[2] = to_integer(&ctx->ac, ctx->abi->inputs[radeon_llvm_reg_index_soa(VARYING_SLOT_LAYER, 0)]);
>   		}
>   		sample_index = adjust_sample_index_using_fmask(&ctx->ac,
>   							       fmask_load_address[0],
> @@ -3367,9 +3368,11 @@ static LLVMValueRef get_image_coords(struct ac_nir_context *ctx,
>   		}
>   
>   		if (add_frag_pos) {
> -			for (chan = 0; chan < count; ++chan)
> +			for (chan = 0; chan < 2; ++chan)
>   				coords[chan] = LLVMBuildAdd(ctx->ac.builder, coords[chan], LLVMBuildFPToUI(ctx->ac.builder, ctx->abi->frag_pos[chan],
>   						ctx->ac.i32, ""), "");
> +			coords[2] = to_integer(&ctx->ac, ctx->abi->inputs[radeon_llvm_reg_index_soa(VARYING_SLOT_LAYER, 0)]);
> +			count++;
>   		}
>   		if (is_ms) {
>   			coords[count] = sample_index;
> @@ -3414,7 +3417,9 @@ static LLVMValueRef visit_image_load(struct ac_nir_context *ctx,
>   		res = to_integer(&ctx->ac, res);
>   	} else {
>   		bool is_da = glsl_sampler_type_is_array(type) ||
> -			     glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_CUBE;
> +			     glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_CUBE ||
> +			     glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_SUBPASS ||
> +			     glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_SUBPASS_MS;
>   		LLVMValueRef da = is_da ? i1true : i1false;
>   		LLVMValueRef glc = i1false;
>   		LLVMValueRef slc = i1false;
> @@ -5040,6 +5045,10 @@ handle_fs_inputs_pre(struct nir_to_llvm_context *ctx,
>   		     struct nir_shader *nir)
>   {
>   	unsigned index = 0;
> +
> +	if (ctx->shader_info->info.ps.uses_input_attachments)
> +		ctx->input_mask |= 1ull << VARYING_SLOT_LAYER;
> +
>   	for (unsigned i = 0; i < RADEON_LLVM_MAX_INPUTS; ++i) {
>   		LLVMValueRef interp_param;
>   		LLVMValueRef *inputs = ctx->inputs +radeon_llvm_reg_index_soa(i, 0);
> 


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list