diff options
author | Dave Airlie <[email protected]> | 2017-01-19 13:48:26 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2017-01-31 09:29:33 +1000 |
commit | 09cd037ca428654e4f67981137cb2a25ef4f2a4a (patch) | |
tree | 46ca3ab81d06379fb126db31e7ee439ec70d79e6 /src | |
parent | e1e9301b2ad358a65a77b9f1cabae721ae571da4 (diff) |
radv/ac: setup function parameters for vs as es and copy shader.
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 19952b3a310..3e1b21862c9 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -87,6 +87,8 @@ struct nir_to_llvm_context { LLVMValueRef vs_prim_id; LLVMValueRef instance_id; + LLVMValueRef es2gs_offset; + LLVMValueRef gsvs_ring_stride; LLVMValueRef gsvs_num_entries; LLVMValueRef gs2vs_offset; @@ -452,14 +454,21 @@ static void create_function(struct nir_to_llvm_context *ctx) arg_types[arg_idx++] = LLVMVectorType(ctx->i32, 3); break; case MESA_SHADER_VERTEX: - arg_types[arg_idx++] = const_array(ctx->v16i8, 16); /* vertex buffers */ - arg_types[arg_idx++] = ctx->i32; // base vertex - arg_types[arg_idx++] = ctx->i32; // start instance - user_sgpr_count = sgpr_count = arg_idx; + if (!ctx->is_gs_copy_shader) { + arg_types[arg_idx++] = const_array(ctx->v16i8, 16); /* vertex buffers */ + arg_types[arg_idx++] = ctx->i32; // base vertex + arg_types[arg_idx++] = ctx->i32; // start instance + } + user_sgpr_count = arg_idx; + if (ctx->options->key.vs.as_es) + arg_types[arg_idx++] = ctx->i32; //es2gs offset + sgpr_count = arg_idx; arg_types[arg_idx++] = ctx->i32; // vertex id - arg_types[arg_idx++] = ctx->i32; // rel auto id - arg_types[arg_idx++] = ctx->i32; // vs prim id - arg_types[arg_idx++] = ctx->i32; // instance id + if (!ctx->is_gs_copy_shader) { + arg_types[arg_idx++] = ctx->i32; // rel auto id + arg_types[arg_idx++] = ctx->i32; // vs prim id + arg_types[arg_idx++] = ctx->i32; // instance id + } break; case MESA_SHADER_GEOMETRY: arg_types[arg_idx++] = ctx->i32; // gsvs stride @@ -569,17 +578,23 @@ static void create_function(struct nir_to_llvm_context *ctx) LLVMGetParam(ctx->main_function, arg_idx++); break; case MESA_SHADER_VERTEX: - set_userdata_location_shader(ctx, AC_UD_VS_VERTEX_BUFFERS, user_sgpr_idx, 2); - user_sgpr_idx += 2; - ctx->vertex_buffers = LLVMGetParam(ctx->main_function, arg_idx++); - set_userdata_location_shader(ctx, AC_UD_VS_BASE_VERTEX_START_INSTANCE, user_sgpr_idx, 2); - user_sgpr_idx += 2; - ctx->base_vertex = LLVMGetParam(ctx->main_function, arg_idx++); - ctx->start_instance = LLVMGetParam(ctx->main_function, arg_idx++); + if (!ctx->is_gs_copy_shader) { + set_userdata_location_shader(ctx, AC_UD_VS_VERTEX_BUFFERS, user_sgpr_idx, 2); + user_sgpr_idx += 2; + ctx->vertex_buffers = LLVMGetParam(ctx->main_function, arg_idx++); + set_userdata_location_shader(ctx, AC_UD_VS_BASE_VERTEX_START_INSTANCE, user_sgpr_idx, 2); + user_sgpr_idx += 2; + ctx->base_vertex = LLVMGetParam(ctx->main_function, arg_idx++); + ctx->start_instance = LLVMGetParam(ctx->main_function, arg_idx++); + } + if (ctx->options->key.vs.as_es) + ctx->es2gs_offset = LLVMGetParam(ctx->main_function, arg_idx++); ctx->vertex_id = LLVMGetParam(ctx->main_function, arg_idx++); - ctx->rel_auto_id = LLVMGetParam(ctx->main_function, arg_idx++); - ctx->vs_prim_id = LLVMGetParam(ctx->main_function, arg_idx++); - ctx->instance_id = LLVMGetParam(ctx->main_function, arg_idx++); + if (!ctx->is_gs_copy_shader) { + ctx->rel_auto_id = LLVMGetParam(ctx->main_function, arg_idx++); + ctx->vs_prim_id = LLVMGetParam(ctx->main_function, arg_idx++); + ctx->instance_id = LLVMGetParam(ctx->main_function, arg_idx++); + } break; case MESA_SHADER_GEOMETRY: set_userdata_location_shader(ctx, AC_UD_GS_VS_RING_STRIDE_ENTRIES, user_sgpr_idx, 2); |