diff options
author | Jason Ekstrand <[email protected]> | 2015-11-11 10:46:09 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-11-23 11:02:15 -0800 |
commit | 1417f6a216b46dbbaa1bfe0cef97e2b4a48224c0 (patch) | |
tree | 76081a43c4f35425327a259c8b3159e304bb1836 /src | |
parent | ce767bbdfff7c2a7829b652c111a11eb9ddba026 (diff) |
nir/lower_tex: Report progress
Reviewed-by: Kenneth Graunke <[email protected]>
Reviewed-by: Iago Toral Quiroga <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/glsl/nir/nir.h | 2 | ||||
-rw-r--r-- | src/glsl/nir/nir_lower_tex.c | 19 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_nir.c | 2 |
3 files changed, 17 insertions, 6 deletions
diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h index b4be145e5ec..28c85459021 100644 --- a/src/glsl/nir/nir.h +++ b/src/glsl/nir/nir.h @@ -1994,7 +1994,7 @@ typedef struct nir_lower_tex_options { unsigned saturate_r; } nir_lower_tex_options; -void nir_lower_tex(nir_shader *shader, +bool nir_lower_tex(nir_shader *shader, const nir_lower_tex_options *options); void nir_lower_idiv(nir_shader *shader); diff --git a/src/glsl/nir/nir_lower_tex.c b/src/glsl/nir/nir_lower_tex.c index 8aaa48ab568..21ed1032a0b 100644 --- a/src/glsl/nir/nir_lower_tex.c +++ b/src/glsl/nir/nir_lower_tex.c @@ -41,6 +41,7 @@ typedef struct { nir_builder b; const nir_lower_tex_options *options; + bool progress; } lower_tex_state; static void @@ -239,15 +240,21 @@ nir_lower_tex_block(nir_block *block, void *void_state) /* If we are clamping any coords, we must lower projector first * as clamping happens *after* projection: */ - if (lower_txp || sat_mask) + if (lower_txp || sat_mask) { project_src(b, tex); + state->progress = true; + } if ((tex->sampler_dim == GLSL_SAMPLER_DIM_RECT) && - state->options->lower_rect) + state->options->lower_rect) { lower_rect(b, tex); + state->progress = true; + } - if (sat_mask) + if (sat_mask) { saturate_src(b, tex, sat_mask); + state->progress = true; + } } return true; @@ -264,13 +271,17 @@ nir_lower_tex_impl(nir_function_impl *impl, lower_tex_state *state) nir_metadata_dominance); } -void +bool nir_lower_tex(nir_shader *shader, const nir_lower_tex_options *options) { lower_tex_state state; state.options = options; + state.progress = false; + nir_foreach_overload(shader, overload) { if (overload->impl) nir_lower_tex_impl(overload->impl, &state); } + + return state.progress; } diff --git a/src/mesa/drivers/dri/i965/brw_nir.c b/src/mesa/drivers/dri/i965/brw_nir.c index 16969530577..62f3171329c 100644 --- a/src/mesa/drivers/dri/i965/brw_nir.c +++ b/src/mesa/drivers/dri/i965/brw_nir.c @@ -260,7 +260,7 @@ brw_preprocess_nir(nir_shader *nir, bool is_scalar) .lower_txp = ~0, }; - OPT_V(nir_lower_tex, &tex_options); + OPT(nir_lower_tex, &tex_options); OPT(nir_normalize_cubemap_coords); OPT(nir_lower_global_vars_to_local); |