From: Dave Airlie Date: Thu, 30 Mar 2017 19:15:23 +0000 (+0100) Subject: radv/ac: setup lds for tessellation X-Git-Tag: upstream/17.1.0~667 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cb1518e96be44714c3925066379d8394adcc161e;p=platform%2Fupstream%2Fmesa.git radv/ac: setup lds for tessellation This seems to get lost in the rebases, should fix the tessellation demos, crash in llvm. Reviewed-by: Bas Nieuwenhuizen Signed-off-by: Dave Airlie --- diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index c29fb95..520e4cf 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -548,6 +548,14 @@ static void set_userdata_location_indirect(struct ac_userdata_info *ud_info, uin } #endif +static void declare_tess_lds(struct nir_to_llvm_context *ctx) +{ + unsigned lds_size = ctx->options->chip_class >= CIK ? 65536 : 32768; + ctx->lds = LLVMBuildIntToPtr(ctx->builder, ctx->i32zero, + LLVMPointerType(LLVMArrayType(ctx->i32, lds_size / 4), LOCAL_ADDR_SPACE), + "tess_lds"); +} + static void create_function(struct nir_to_llvm_context *ctx) { LLVMTypeRef arg_types[23]; @@ -785,6 +793,8 @@ static void create_function(struct nir_to_llvm_context *ctx) ctx->vs_prim_id = LLVMGetParam(ctx->main_function, arg_idx++); ctx->instance_id = LLVMGetParam(ctx->main_function, arg_idx++); } + if (ctx->options->key.vs.as_ls) + declare_tess_lds(ctx); break; case MESA_SHADER_TESS_CTRL: set_userdata_location_shader(ctx, AC_UD_TCS_OFFCHIP_LAYOUT, user_sgpr_idx, 4); @@ -797,6 +807,8 @@ static void create_function(struct nir_to_llvm_context *ctx) ctx->tess_factor_offset = LLVMGetParam(ctx->main_function, arg_idx++); ctx->tcs_patch_id = LLVMGetParam(ctx->main_function, arg_idx++); ctx->tcs_rel_ids = LLVMGetParam(ctx->main_function, arg_idx++); + + declare_tess_lds(ctx); break; case MESA_SHADER_TESS_EVAL: set_userdata_location_shader(ctx, AC_UD_TES_OFFCHIP_LAYOUT, user_sgpr_idx, 1);