diff options
author | Matt Turner <[email protected]> | 2017-02-24 15:38:28 -0800 |
---|---|---|
committer | Matt Turner <[email protected]> | 2017-03-23 14:34:43 -0700 |
commit | 5a7e4ae23d686566aee38290bc87f9ceee927d5b (patch) | |
tree | dc3d104a45f112c8ee089cdb62bde1c7f92c1794 | |
parent | 19345fc160e1cd6d8176068f9919b1f0e7f5164c (diff) |
nir: Return progress from nir_lower_clip_cull_distance_arrays().
Reviewed-by: Jason Ekstrand <[email protected]>
-rw-r--r-- | src/compiler/nir/nir.h | 2 | ||||
-rw-r--r-- | src/compiler/nir/nir_lower_clip_cull_distance_arrays.c | 24 |
2 files changed, 21 insertions, 5 deletions
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 80efa063f31..44396bcdc36 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -2499,7 +2499,7 @@ bool nir_lower_idiv(nir_shader *shader); void nir_lower_clip_vs(nir_shader *shader, unsigned ucp_enables); void nir_lower_clip_fs(nir_shader *shader, unsigned ucp_enables); -void nir_lower_clip_cull_distance_arrays(nir_shader *nir); +bool nir_lower_clip_cull_distance_arrays(nir_shader *nir); void nir_lower_two_sided_color(nir_shader *shader); diff --git a/src/compiler/nir/nir_lower_clip_cull_distance_arrays.c b/src/compiler/nir/nir_lower_clip_cull_distance_arrays.c index 5a89eddc271..6705a3c4597 100644 --- a/src/compiler/nir/nir_lower_clip_cull_distance_arrays.c +++ b/src/compiler/nir/nir_lower_clip_cull_distance_arrays.c @@ -121,13 +121,14 @@ rewrite_references(nir_instr *instr, /* There's no need to update writemasks; it's a scalar array. */ } -static void +static bool combine_clip_cull(nir_shader *nir, struct exec_list *vars, bool store_info) { nir_variable *cull = NULL; nir_variable *clip = NULL; + bool progress = false; nir_foreach_variable(var, vars) { if (var->data.location == VARYING_SLOT_CLIP_DIST0) @@ -174,15 +175,30 @@ combine_clip_cull(nir_shader *nir, exec_node_remove(&cull->node); ralloc_free(cull); } + + nir_foreach_function(function, nir) { + if (function->impl) { + nir_metadata_preserve(function->impl, + nir_metadata_block_index | + nir_metadata_dominance); + } + } + progress = true; } + + return progress; } -void +bool nir_lower_clip_cull_distance_arrays(nir_shader *nir) { + bool progress = false; + if (nir->stage <= MESA_SHADER_GEOMETRY) - combine_clip_cull(nir, &nir->outputs, true); + progress |= combine_clip_cull(nir, &nir->outputs, true); if (nir->stage > MESA_SHADER_VERTEX) - combine_clip_cull(nir, &nir->inputs, false); + progress |= combine_clip_cull(nir, &nir->inputs, false); + + return progress; } |