aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJonathan Marek <[email protected]>2019-11-17 12:17:47 -0500
committerJonathan Marek <[email protected]>2019-12-19 15:13:40 -0500
commita3a70588c0a9a72255a69428af4a5ff22544d275 (patch)
tree1cefe4ecbe3316fbdc452376d28654f60e4223b5 /src
parent5c17d9b9ca57269bae5376c64b83432af21ae522 (diff)
freedreno/ir3: support load_base_instance
Not supported by hardware, uses same mechanism as base vertex. Signed-off-by: Jonathan Marek <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3162>
Diffstat (limited to 'src')
-rw-r--r--src/freedreno/ir3/ir3_compiler_nir.c6
-rw-r--r--src/freedreno/ir3/ir3_context.h2
-rw-r--r--src/freedreno/ir3/ir3_nir.c4
-rw-r--r--src/freedreno/ir3/ir3_shader.h1
4 files changed, 12 insertions, 1 deletions
diff --git a/src/freedreno/ir3/ir3_compiler_nir.c b/src/freedreno/ir3/ir3_compiler_nir.c
index b6fc39f2fb1..7bbfe40dc91 100644
--- a/src/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/freedreno/ir3/ir3_compiler_nir.c
@@ -1671,6 +1671,12 @@ emit_intrinsic(struct ir3_context *ctx, nir_intrinsic_instr *intr)
}
dst[0] = ctx->basevertex;
break;
+ case nir_intrinsic_load_base_instance:
+ if (!ctx->base_instance) {
+ ctx->base_instance = create_driver_param(ctx, IR3_DP_INSTID_BASE);
+ }
+ dst[0] = ctx->base_instance;
+ break;
case nir_intrinsic_load_vertex_id_zero_base:
case nir_intrinsic_load_vertex_id:
if (!ctx->vertex_id) {
diff --git a/src/freedreno/ir3/ir3_context.h b/src/freedreno/ir3/ir3_context.h
index 1ce5c6776ca..c5845d4e2c6 100644
--- a/src/freedreno/ir3/ir3_context.h
+++ b/src/freedreno/ir3/ir3_context.h
@@ -83,7 +83,7 @@ struct ir3_context {
struct ir3_instruction *frag_face, *frag_coord;
/* For vertex shaders, keep track of the system values sources */
- struct ir3_instruction *vertex_id, *basevertex, *instance_id;
+ struct ir3_instruction *vertex_id, *basevertex, *instance_id, *base_instance;
/* For fragment shaders: */
struct ir3_instruction *samp_id, *samp_mask_in;
diff --git a/src/freedreno/ir3/ir3_nir.c b/src/freedreno/ir3/ir3_nir.c
index bf643c71439..5d4dbb1135d 100644
--- a/src/freedreno/ir3/ir3_nir.c
+++ b/src/freedreno/ir3/ir3_nir.c
@@ -415,6 +415,10 @@ ir3_nir_scan_driver_consts(nir_shader *shader,
layout->num_driver_params =
MAX2(layout->num_driver_params, IR3_DP_VTXID_BASE + 1);
break;
+ case nir_intrinsic_load_base_instance:
+ layout->num_driver_params =
+ MAX2(layout->num_driver_params, IR3_DP_INSTID_BASE + 1);
+ break;
case nir_intrinsic_load_user_clip_plane:
layout->num_driver_params =
MAX2(layout->num_driver_params, IR3_DP_UCP7_W + 1);
diff --git a/src/freedreno/ir3/ir3_shader.h b/src/freedreno/ir3/ir3_shader.h
index 3a0447a1334..528764b0e27 100644
--- a/src/freedreno/ir3/ir3_shader.h
+++ b/src/freedreno/ir3/ir3_shader.h
@@ -57,6 +57,7 @@ enum ir3_driver_param {
/* vertex shader driver params: */
IR3_DP_VTXID_BASE = 0,
IR3_DP_VTXCNT_MAX = 1,
+ IR3_DP_INSTID_BASE = 2,
/* user-clip-plane components, up to 8x vec4's: */
IR3_DP_UCP0_X = 4,
/* .... */