diff options
author | Dave Airlie <[email protected]> | 2017-01-18 15:22:44 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2017-01-31 09:29:13 +1000 |
commit | ca91db24020dec08b349f4c57e87f2db48b84752 (patch) | |
tree | f0154f4b7383cc31c16c2d00de422bb72c6eb736 /src/amd/common | |
parent | 374e978438c89ca573f54649de675f582fde5d2c (diff) |
radv/ac: handle geom shader sgpr/vgpr inputs
This just sets up the gpr inputs.
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/amd/common')
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 39 | ||||
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.h | 2 |
2 files changed, 41 insertions, 0 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 4e6b72f6276..76a978f8a08 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -86,6 +86,13 @@ struct nir_to_llvm_context { LLVMValueRef vs_prim_id; LLVMValueRef instance_id; + LLVMValueRef gsvs_ring_stride; + LLVMValueRef gsvs_num_entries; + LLVMValueRef gs2vs_offset; + LLVMValueRef gs_wave_id; + LLVMValueRef gs_vtx_offset[6]; + LLVMValueRef gs_prim_id, gs_invocation_id; + LLVMValueRef prim_mask; LLVMValueRef sample_positions; LLVMValueRef persp_sample, persp_center, persp_centroid; @@ -435,6 +442,22 @@ static void create_function(struct nir_to_llvm_context *ctx) 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 + arg_types[arg_idx++] = ctx->i32; // gsvs num entires + user_sgpr_count = arg_idx; + arg_types[arg_idx++] = ctx->i32; // gs2vs offset + arg_types[arg_idx++] = ctx->i32; // wave id + sgpr_count = arg_idx; + arg_types[arg_idx++] = ctx->i32; // vtx0 + arg_types[arg_idx++] = ctx->i32; // vtx1 + arg_types[arg_idx++] = ctx->i32; // prim id + arg_types[arg_idx++] = ctx->i32; // vtx2 + arg_types[arg_idx++] = ctx->i32; // vtx3 + arg_types[arg_idx++] = ctx->i32; // vtx4 + arg_types[arg_idx++] = ctx->i32; // vtx5 + arg_types[arg_idx++] = ctx->i32; // GS instance id + break; case MESA_SHADER_FRAGMENT: arg_types[arg_idx++] = const_array(ctx->f32, 32); /* sample positions */ user_sgpr_count = arg_idx; @@ -531,6 +554,22 @@ 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++); break; + case MESA_SHADER_GEOMETRY: + set_userdata_location_shader(ctx, AC_UD_GS_VS_RING_STRIDE_ENTRIES, user_sgpr_idx, 2); + user_sgpr_idx += 2; + ctx->gsvs_ring_stride = LLVMGetParam(ctx->main_function, arg_idx++); + ctx->gsvs_num_entries = LLVMGetParam(ctx->main_function, arg_idx++); + ctx->gs2vs_offset = LLVMGetParam(ctx->main_function, arg_idx++); + ctx->gs_wave_id = LLVMGetParam(ctx->main_function, arg_idx++); + ctx->gs_vtx_offset[0] = LLVMGetParam(ctx->main_function, arg_idx++); + ctx->gs_vtx_offset[1] = LLVMGetParam(ctx->main_function, arg_idx++); + ctx->gs_prim_id = LLVMGetParam(ctx->main_function, arg_idx++); + ctx->gs_vtx_offset[2] = LLVMGetParam(ctx->main_function, arg_idx++); + ctx->gs_vtx_offset[3] = LLVMGetParam(ctx->main_function, arg_idx++); + ctx->gs_vtx_offset[4] = LLVMGetParam(ctx->main_function, arg_idx++); + ctx->gs_vtx_offset[5] = LLVMGetParam(ctx->main_function, arg_idx++); + ctx->gs_invocation_id = LLVMGetParam(ctx->main_function, arg_idx++); + break; case MESA_SHADER_FRAGMENT: set_userdata_location_shader(ctx, AC_UD_PS_SAMPLE_POS, user_sgpr_idx, 2); user_sgpr_idx += 2; diff --git a/src/amd/common/ac_nir_to_llvm.h b/src/amd/common/ac_nir_to_llvm.h index e71189ad3fe..089cfe14d30 100644 --- a/src/amd/common/ac_nir_to_llvm.h +++ b/src/amd/common/ac_nir_to_llvm.h @@ -75,6 +75,8 @@ enum ac_ud_index { AC_UD_PS_MAX_UD, AC_UD_CS_GRID_SIZE = AC_UD_SHADER_START, AC_UD_CS_MAX_UD, + AC_UD_GS_VS_RING_STRIDE_ENTRIES = AC_UD_SHADER_START, + AC_UD_GS_MAX_UD, AC_UD_MAX_UD = AC_UD_VS_MAX_UD, }; |