radv/ac: handle geom shader sgpr/vgpr inputs
authorDave Airlie <airlied@redhat.com>
Wed, 18 Jan 2017 05:22:44 +0000 (15:22 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 30 Jan 2017 23:29:13 +0000 (09:29 +1000)
This just sets up the gpr inputs.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/common/ac_nir_to_llvm.c
src/amd/common/ac_nir_to_llvm.h

index 4e6b72f6276f53a7afce925e15e479cf45ff2ffd..76a978f8a084886c4e1dd64ec06215139858346f 100644 (file)
@@ -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;
index e71189ad3febe2f14fccc85d74781e3b916ad807..089cfe14d3054aadc4998d59d486f31227d1fcc0 100644 (file)
@@ -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,
 };