diff options
author | Bas Nieuwenhuizen <[email protected]> | 2017-01-31 21:21:47 +0100 |
---|---|---|
committer | Bas Nieuwenhuizen <[email protected]> | 2017-02-01 19:49:40 +0100 |
commit | 80f4331ed1314d674e385c8753c970d8fa394a88 (patch) | |
tree | 16728080321925bd515c8aa5a40f41497ff9588f /src/amd | |
parent | 25f2d3c1d3328ed4e95547e89dddbe73c423fc9e (diff) |
radv/ac: Add draw index support.
Signed-off-by: Bas Nieuwenhuizen <[email protected]>
Reviewed-by: Dave Airlie <[email protected]>
Reviewed-by: Edward O'Callaghan <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 50ed4d47836..67c5c0618c6 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -82,6 +82,7 @@ struct nir_to_llvm_context { LLVMValueRef vertex_buffers; LLVMValueRef base_vertex; LLVMValueRef start_instance; + LLVMValueRef draw_index; LLVMValueRef vertex_id; LLVMValueRef rel_auto_id; LLVMValueRef vs_prim_id; @@ -560,6 +561,7 @@ static void create_function(struct nir_to_llvm_context *ctx) 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 + arg_types[arg_idx++] = ctx->i32; // draw index } user_sgpr_count = arg_idx; if (ctx->options->key.vs.as_es) @@ -684,10 +686,11 @@ static void create_function(struct nir_to_llvm_context *ctx) 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; + set_userdata_location_shader(ctx, AC_UD_VS_BASE_VERTEX_START_INSTANCE, user_sgpr_idx, 3); + user_sgpr_idx += 3; ctx->base_vertex = LLVMGetParam(ctx->main_function, arg_idx++); ctx->start_instance = LLVMGetParam(ctx->main_function, arg_idx++); + ctx->draw_index = LLVMGetParam(ctx->main_function, arg_idx++); } if (ctx->options->key.vs.as_es) ctx->es2gs_offset = LLVMGetParam(ctx->main_function, arg_idx++); @@ -3263,6 +3266,9 @@ static void visit_intrinsic(struct nir_to_llvm_context *ctx, case nir_intrinsic_load_base_instance: result = ctx->start_instance; break; + case nir_intrinsic_load_draw_id: + result = ctx->draw_index; + break; case nir_intrinsic_load_invocation_id: result = ctx->gs_invocation_id; break; |