diff options
author | Jason Ekstrand <[email protected]> | 2015-12-14 18:46:16 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-12-15 14:12:31 -0800 |
commit | f6910f072a4117da442ca30d0358f6f79380667e (patch) | |
tree | 3748c104a0368892c30d71f503b682a1a3ea5c66 /src/glsl/nir/nir_lower_clip.c | |
parent | ca5be008bc55a5190171d91994c3251fddb4d8d9 (diff) |
nir/builder: Add a load_system_value helper
While we're at it, go ahead and make nir_lower_clip use it.
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/glsl/nir/nir_lower_clip.c')
-rw-r--r-- | src/glsl/nir/nir_lower_clip.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/glsl/nir/nir_lower_clip.c b/src/glsl/nir/nir_lower_clip.c index 36cc578d1ed..46301351c96 100644 --- a/src/glsl/nir/nir_lower_clip.c +++ b/src/glsl/nir/nir_lower_clip.c @@ -180,18 +180,11 @@ lower_clip_vs(nir_function_impl *impl, unsigned ucp_enables, for (int plane = 0; plane < MAX_CLIP_PLANES; plane++) { if (ucp_enables & (1 << plane)) { - nir_intrinsic_instr *ucp; - - /* insert intrinsic to fetch ucp[plane]: */ - ucp = nir_intrinsic_instr_create(b.shader, - nir_intrinsic_load_user_clip_plane); - ucp->num_components = 4; - ucp->const_index[0] = plane; - nir_ssa_dest_init(&ucp->instr, &ucp->dest, 4, NULL); - nir_builder_instr_insert(&b, &ucp->instr); + nir_ssa_def *ucp = + nir_load_system_value(&b, nir_intrinsic_load_user_clip_plane, plane); /* calculate clipdist[plane] - dot(ucp, cv): */ - clipdist[plane] = nir_fdot4(&b, &ucp->dest.ssa, cv); + clipdist[plane] = nir_fdot4(&b, ucp, cv); } else { /* 0.0 == don't-clip == disabled: */ |