nir: Inline lower_clip_vs() into nir_lower_clip_vs().
It's now called exactly once, and there's not really any distinction. Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
bfa789aceb
commit
63c8696874
|
@ -150,12 +150,23 @@ find_output(nir_shader *shader, unsigned drvloc)
|
|||
* VS lowering
|
||||
*/
|
||||
|
||||
static void
|
||||
lower_clip_vs(nir_function_impl *impl, unsigned ucp_enables,
|
||||
nir_ssa_def *cv, nir_variable **out)
|
||||
/* ucp_enables is bitmask of enabled ucps. Actual ucp values are
|
||||
* passed in to shader via user_clip_plane system-values
|
||||
*/
|
||||
bool
|
||||
nir_lower_clip_vs(nir_shader *shader, unsigned ucp_enables)
|
||||
{
|
||||
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
|
||||
nir_ssa_def *clipdist[MAX_CLIP_PLANES];
|
||||
nir_builder b;
|
||||
int clipvertex = -1;
|
||||
int position = -1;
|
||||
int maxloc = -1;
|
||||
nir_ssa_def *cv;
|
||||
nir_variable *out[2] = { NULL };
|
||||
|
||||
if (!ucp_enables)
|
||||
return false;
|
||||
|
||||
nir_builder_init(&b, impl);
|
||||
|
||||
|
@ -171,43 +182,6 @@ lower_clip_vs(nir_function_impl *impl, unsigned ucp_enables,
|
|||
assert(impl->end_block->predecessors->entries == 1);
|
||||
b.cursor = nir_after_cf_list(&impl->body);
|
||||
|
||||
for (int plane = 0; plane < MAX_CLIP_PLANES; plane++) {
|
||||
if (ucp_enables & (1 << plane)) {
|
||||
nir_ssa_def *ucp = nir_load_user_clip_plane(&b, plane);
|
||||
|
||||
/* calculate clipdist[plane] - dot(ucp, cv): */
|
||||
clipdist[plane] = nir_fdot4(&b, ucp, cv);
|
||||
}
|
||||
else {
|
||||
/* 0.0 == don't-clip == disabled: */
|
||||
clipdist[plane] = nir_imm_float(&b, 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
if (ucp_enables & 0x0f)
|
||||
store_clipdist_output(&b, out[0], &clipdist[0]);
|
||||
if (ucp_enables & 0xf0)
|
||||
store_clipdist_output(&b, out[1], &clipdist[4]);
|
||||
|
||||
nir_metadata_preserve(impl, nir_metadata_dominance);
|
||||
}
|
||||
|
||||
/* ucp_enables is bitmask of enabled ucps. Actual ucp values are
|
||||
* passed in to shader via user_clip_plane system-values
|
||||
*/
|
||||
bool
|
||||
nir_lower_clip_vs(nir_shader *shader, unsigned ucp_enables)
|
||||
{
|
||||
nir_function_impl *impl = nir_shader_get_entrypoint(shader);
|
||||
int clipvertex = -1;
|
||||
int position = -1;
|
||||
int maxloc = -1;
|
||||
nir_ssa_def *cv;
|
||||
nir_variable *out[2] = { NULL };
|
||||
|
||||
if (!ucp_enables)
|
||||
return false;
|
||||
|
||||
/* find clipvertex/position outputs: */
|
||||
nir_foreach_variable(var, &shader->outputs) {
|
||||
int loc = var->data.driver_location;
|
||||
|
@ -250,7 +224,24 @@ nir_lower_clip_vs(nir_shader *shader, unsigned ucp_enables)
|
|||
out[1] =
|
||||
create_clipdist_var(shader, ++maxloc, true, VARYING_SLOT_CLIP_DIST1);
|
||||
|
||||
lower_clip_vs(impl, ucp_enables, cv, out);
|
||||
for (int plane = 0; plane < MAX_CLIP_PLANES; plane++) {
|
||||
if (ucp_enables & (1 << plane)) {
|
||||
nir_ssa_def *ucp = nir_load_user_clip_plane(&b, plane);
|
||||
|
||||
/* calculate clipdist[plane] - dot(ucp, cv): */
|
||||
clipdist[plane] = nir_fdot4(&b, ucp, cv);
|
||||
} else {
|
||||
/* 0.0 == don't-clip == disabled: */
|
||||
clipdist[plane] = nir_imm_float(&b, 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
if (ucp_enables & 0x0f)
|
||||
store_clipdist_output(&b, out[0], &clipdist[0]);
|
||||
if (ucp_enables & 0xf0)
|
||||
store_clipdist_output(&b, out[1], &clipdist[4]);
|
||||
|
||||
nir_metadata_preserve(impl, nir_metadata_dominance);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue