radeonsi: add DRAWID parameter to vertex shaders
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 8 Aug 2016 13:38:04 +0000 (15:38 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Tue, 9 Aug 2016 13:56:04 +0000 (15:56 +0200)
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeonsi/si_shader.c
src/gallium/drivers/radeonsi/si_shader.h

index 2c00f56d7b0f5a283830edc1e88fff2fe2b0115f..2de20cb1bd0040e646f538de28fcec0a7620e003 100644 (file)
@@ -1668,6 +1668,11 @@ static void declare_system_value(
                                     SI_PARAM_START_INSTANCE);
                break;
 
+       case TGSI_SEMANTIC_DRAWID:
+               value = LLVMGetParam(radeon_bld->main_fn,
+                                    SI_PARAM_DRAWID);
+               break;
+
        case TGSI_SEMANTIC_INVOCATIONID:
                if (ctx->type == PIPE_SHADER_TESS_CTRL)
                        value = unpack_param(ctx, SI_PARAM_REL_IDS, 8, 5);
@@ -5460,7 +5465,8 @@ static void create_function(struct si_shader_context *ctx)
                params[SI_PARAM_VERTEX_BUFFERS] = const_array(ctx->v16i8, SI_NUM_VERTEX_BUFFERS);
                params[SI_PARAM_BASE_VERTEX] = ctx->i32;
                params[SI_PARAM_START_INSTANCE] = ctx->i32;
-               num_params = SI_PARAM_START_INSTANCE+1;
+               params[SI_PARAM_DRAWID] = ctx->i32;
+               num_params = SI_PARAM_DRAWID+1;
 
                if (shader->key.vs.as_es) {
                        params[ctx->param_es2gs_offset = num_params++] = ctx->i32;
index e8560498988ca82bfd5f8f0138f78da84ebe380b..fc1b22d7383b8caf453655dec963503261201016 100644 (file)
@@ -96,6 +96,7 @@ enum {
        SI_SGPR_VERTEX_BUFFERS_HI,
        SI_SGPR_BASE_VERTEX,
        SI_SGPR_START_INSTANCE,
+       SI_SGPR_DRAWID,
        SI_ES_NUM_USER_SGPR,
 
        /* hw VS only */
@@ -142,10 +143,11 @@ enum {
        SI_PARAM_VERTEX_BUFFERS = SI_NUM_RESOURCE_PARAMS,
        SI_PARAM_BASE_VERTEX,
        SI_PARAM_START_INSTANCE,
+       SI_PARAM_DRAWID,
        /* [0] = clamp vertex color, VS as VS only */
        SI_PARAM_VS_STATE_BITS,
        /* same value as TCS_IN_LAYOUT, VS as LS only */
-       SI_PARAM_LS_OUT_LAYOUT = SI_PARAM_START_INSTANCE + 1,
+       SI_PARAM_LS_OUT_LAYOUT = SI_PARAM_DRAWID + 1,
        /* the other VS parameters are assigned dynamically */
 
        /* Layout of TCS outputs in the offchip buffer